native_browser_view.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 ATOM_BROWSER_NATIVE_BROWSER_VIEW_H_
  5. #define ATOM_BROWSER_NATIVE_BROWSER_VIEW_H_
  6. #include <vector>
  7. #include "atom/common/draggable_region.h"
  8. #include "base/macros.h"
  9. #include "content/public/browser/web_contents.h"
  10. #include "third_party/skia/include/core/SkColor.h"
  11. namespace brightray {
  12. class InspectableWebContents;
  13. class InspectableWebContentsView;
  14. } // namespace brightray
  15. namespace gfx {
  16. class Rect;
  17. }
  18. namespace atom {
  19. enum AutoResizeFlags {
  20. kAutoResizeWidth = 0x1,
  21. kAutoResizeHeight = 0x2,
  22. };
  23. class NativeBrowserView {
  24. public:
  25. virtual ~NativeBrowserView();
  26. static NativeBrowserView* Create(
  27. brightray::InspectableWebContents* inspectable_web_contents);
  28. brightray::InspectableWebContents* GetInspectableWebContents() {
  29. return inspectable_web_contents_;
  30. }
  31. brightray::InspectableWebContentsView* GetInspectableWebContentsView();
  32. content::WebContents* GetWebContents();
  33. virtual void SetAutoResizeFlags(uint8_t flags) = 0;
  34. virtual void SetBounds(const gfx::Rect& bounds) = 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(
  41. brightray::InspectableWebContents* inspectable_web_contents);
  42. brightray::InspectableWebContents* inspectable_web_contents_;
  43. private:
  44. DISALLOW_COPY_AND_ASSIGN(NativeBrowserView);
  45. };
  46. } // namespace atom
  47. #endif // ATOM_BROWSER_NATIVE_BROWSER_VIEW_H_