inspectable_web_contents_view.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_H_
  2. #define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_H_
  3. #include "base/strings/string16.h"
  4. #include "ui/gfx/native_widget_types.h"
  5. class DevToolsContentsResizingStrategy;
  6. #if defined(TOOLKIT_VIEWS)
  7. namespace views {
  8. class View;
  9. }
  10. #endif
  11. namespace brightray {
  12. class InspectableWebContentsViewDelegate;
  13. class InspectableWebContentsView {
  14. public:
  15. InspectableWebContentsView() : delegate_(nullptr) {}
  16. virtual ~InspectableWebContentsView() {}
  17. // The delegate manages its own life.
  18. void SetDelegate(InspectableWebContentsViewDelegate* delegate) {
  19. delegate_ = delegate;
  20. }
  21. InspectableWebContentsViewDelegate* GetDelegate() const { return delegate_; }
  22. #if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
  23. // Returns the container control, which has devtools view attached.
  24. virtual views::View* GetView() = 0;
  25. // Returns the web view control, which can be used by the
  26. // GetInitiallyFocusedView() to set initial focus to web view.
  27. virtual views::View* GetWebView() = 0;
  28. #else
  29. virtual gfx::NativeView GetNativeView() const = 0;
  30. #endif
  31. virtual void ShowDevTools() = 0;
  32. // Hide the DevTools view.
  33. virtual void CloseDevTools() = 0;
  34. virtual bool IsDevToolsViewShowing() = 0;
  35. virtual bool IsDevToolsViewFocused() = 0;
  36. virtual void SetIsDocked(bool docked) = 0;
  37. virtual void SetContentsResizingStrategy(
  38. const DevToolsContentsResizingStrategy& strategy) = 0;
  39. virtual void SetTitle(const base::string16& title) = 0;
  40. private:
  41. InspectableWebContentsViewDelegate* delegate_; // weak references.
  42. };
  43. } // namespace brightray
  44. #endif // BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_H_