native_browser_view.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright (c) 2017 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef SHELL_BROWSER_NATIVE_BROWSER_VIEW_H_
  5. #define SHELL_BROWSER_NATIVE_BROWSER_VIEW_H_
  6. #include <vector>
  7. #include "base/macros.h"
  8. #include "content/public/browser/web_contents.h"
  9. #include "third_party/skia/include/core/SkColor.h"
  10. namespace gfx {
  11. class Rect;
  12. }
  13. namespace electron {
  14. enum AutoResizeFlags {
  15. kAutoResizeWidth = 0x1,
  16. kAutoResizeHeight = 0x2,
  17. kAutoResizeHorizontal = 0x4,
  18. kAutoResizeVertical = 0x8,
  19. };
  20. class InspectableWebContents;
  21. class InspectableWebContentsView;
  22. class NativeBrowserView {
  23. public:
  24. virtual ~NativeBrowserView();
  25. static NativeBrowserView* Create(
  26. InspectableWebContents* inspectable_web_contents);
  27. InspectableWebContents* GetInspectableWebContents() {
  28. return inspectable_web_contents_;
  29. }
  30. InspectableWebContentsView* GetInspectableWebContentsView();
  31. content::WebContents* GetWebContents();
  32. virtual void SetAutoResizeFlags(uint8_t flags) = 0;
  33. virtual void SetBounds(const gfx::Rect& bounds) = 0;
  34. virtual gfx::Rect GetBounds() = 0;
  35. virtual void SetBackgroundColor(SkColor color) = 0;
  36. // Called when the window needs to update its draggable region.
  37. virtual void UpdateDraggableRegions(
  38. const std::vector<gfx::Rect>& system_drag_exclude_areas) {}
  39. protected:
  40. explicit NativeBrowserView(InspectableWebContents* inspectable_web_contents);
  41. InspectableWebContents* inspectable_web_contents_;
  42. private:
  43. DISALLOW_COPY_AND_ASSIGN(NativeBrowserView);
  44. };
  45. } // namespace electron
  46. #endif // SHELL_BROWSER_NATIVE_BROWSER_VIEW_H_