OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Mac-specific implementation of the WebContentsView. It owns an NSView that | 56 // Mac-specific implementation of the WebContentsView. It owns an NSView that |
57 // contains all of the contents of the tab and associated child views. | 57 // contains all of the contents of the tab and associated child views. |
58 class WebContentsViewMac : public WebContentsView, | 58 class WebContentsViewMac : public WebContentsView, |
59 public RenderViewHostDelegateView { | 59 public RenderViewHostDelegateView { |
60 public: | 60 public: |
61 // The corresponding WebContentsImpl is passed in the constructor, and manages | 61 // The corresponding WebContentsImpl is passed in the constructor, and manages |
62 // our lifetime. This doesn't need to be the case, but is this way currently | 62 // our lifetime. This doesn't need to be the case, but is this way currently |
63 // because that's what was easiest when they were split. | 63 // because that's what was easiest when they were split. |
64 WebContentsViewMac(WebContentsImpl* web_contents, | 64 WebContentsViewMac(WebContentsImpl* web_contents, |
65 WebContentsViewDelegate* delegate); | 65 WebContentsViewDelegate* delegate); |
66 virtual ~WebContentsViewMac(); | 66 ~WebContentsViewMac() override; |
67 | 67 |
68 // WebContentsView implementation -------------------------------------------- | 68 // WebContentsView implementation -------------------------------------------- |
69 virtual gfx::NativeView GetNativeView() const override; | 69 gfx::NativeView GetNativeView() const override; |
70 virtual gfx::NativeView GetContentNativeView() const override; | 70 gfx::NativeView GetContentNativeView() const override; |
71 virtual gfx::NativeWindow GetTopLevelNativeWindow() const override; | 71 gfx::NativeWindow GetTopLevelNativeWindow() const override; |
72 virtual void GetContainerBounds(gfx::Rect* out) const override; | 72 void GetContainerBounds(gfx::Rect* out) const override; |
73 virtual void SizeContents(const gfx::Size& size) override; | 73 void SizeContents(const gfx::Size& size) override; |
74 virtual void Focus() override; | 74 void Focus() override; |
75 virtual void SetInitialFocus() override; | 75 void SetInitialFocus() override; |
76 virtual void StoreFocus() override; | 76 void StoreFocus() override; |
77 virtual void RestoreFocus() override; | 77 void RestoreFocus() override; |
78 virtual DropData* GetDropData() const override; | 78 DropData* GetDropData() const override; |
79 virtual gfx::Rect GetViewBounds() const override; | 79 gfx::Rect GetViewBounds() const override; |
80 virtual void SetAllowOtherViews(bool allow) override; | 80 void SetAllowOtherViews(bool allow) override; |
81 virtual bool GetAllowOtherViews() const override; | 81 bool GetAllowOtherViews() const override; |
82 virtual void CreateView( | 82 void CreateView(const gfx::Size& initial_size, |
83 const gfx::Size& initial_size, gfx::NativeView context) override; | 83 gfx::NativeView context) override; |
84 virtual RenderWidgetHostViewBase* CreateViewForWidget( | 84 RenderWidgetHostViewBase* CreateViewForWidget( |
85 RenderWidgetHost* render_widget_host, bool is_guest_view_hack) override; | 85 RenderWidgetHost* render_widget_host, |
86 virtual RenderWidgetHostViewBase* CreateViewForPopupWidget( | 86 bool is_guest_view_hack) override; |
| 87 RenderWidgetHostViewBase* CreateViewForPopupWidget( |
87 RenderWidgetHost* render_widget_host) override; | 88 RenderWidgetHost* render_widget_host) override; |
88 virtual void SetPageTitle(const base::string16& title) override; | 89 void SetPageTitle(const base::string16& title) override; |
89 virtual void RenderViewCreated(RenderViewHost* host) override; | 90 void RenderViewCreated(RenderViewHost* host) override; |
90 virtual void RenderViewSwappedIn(RenderViewHost* host) override; | 91 void RenderViewSwappedIn(RenderViewHost* host) override; |
91 virtual void SetOverscrollControllerEnabled(bool enabled) override; | 92 void SetOverscrollControllerEnabled(bool enabled) override; |
92 virtual bool IsEventTracking() const override; | 93 bool IsEventTracking() const override; |
93 virtual void CloseTabAfterEventTracking() override; | 94 void CloseTabAfterEventTracking() override; |
94 | 95 |
95 // Backend implementation of RenderViewHostDelegateView. | 96 // Backend implementation of RenderViewHostDelegateView. |
96 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, | 97 void ShowContextMenu(RenderFrameHost* render_frame_host, |
97 const ContextMenuParams& params) override; | 98 const ContextMenuParams& params) override; |
98 virtual void ShowPopupMenu(RenderFrameHost* render_frame_host, | 99 void ShowPopupMenu(RenderFrameHost* render_frame_host, |
99 const gfx::Rect& bounds, | 100 const gfx::Rect& bounds, |
100 int item_height, | 101 int item_height, |
101 double item_font_size, | 102 double item_font_size, |
102 int selected_item, | 103 int selected_item, |
103 const std::vector<MenuItem>& items, | 104 const std::vector<MenuItem>& items, |
104 bool right_aligned, | 105 bool right_aligned, |
105 bool allow_multiple_selection) override; | 106 bool allow_multiple_selection) override; |
106 virtual void HidePopupMenu() override; | 107 void HidePopupMenu() override; |
107 virtual void StartDragging(const DropData& drop_data, | 108 void StartDragging(const DropData& drop_data, |
108 blink::WebDragOperationsMask allowed_operations, | 109 blink::WebDragOperationsMask allowed_operations, |
109 const gfx::ImageSkia& image, | 110 const gfx::ImageSkia& image, |
110 const gfx::Vector2d& image_offset, | 111 const gfx::Vector2d& image_offset, |
111 const DragEventSourceInfo& event_info) override; | 112 const DragEventSourceInfo& event_info) override; |
112 virtual void UpdateDragCursor(blink::WebDragOperation operation) override; | 113 void UpdateDragCursor(blink::WebDragOperation operation) override; |
113 virtual void GotFocus() override; | 114 void GotFocus() override; |
114 virtual void TakeFocus(bool reverse) override; | 115 void TakeFocus(bool reverse) override; |
115 | 116 |
116 // A helper method for closing the tab in the | 117 // A helper method for closing the tab in the |
117 // CloseTabAfterEventTracking() implementation. | 118 // CloseTabAfterEventTracking() implementation. |
118 void CloseTab(); | 119 void CloseTab(); |
119 | 120 |
120 WebContentsImpl* web_contents() { return web_contents_; } | 121 WebContentsImpl* web_contents() { return web_contents_; } |
121 WebContentsViewDelegate* delegate() { return delegate_.get(); } | 122 WebContentsViewDelegate* delegate() { return delegate_.get(); } |
122 | 123 |
123 private: | 124 private: |
124 // The WebContentsImpl whose contents we display. | 125 // The WebContentsImpl whose contents we display. |
(...skipping 13 matching lines...) Expand all Loading... |
138 bool allow_other_views_; | 139 bool allow_other_views_; |
139 | 140 |
140 scoped_ptr<PopupMenuHelper> popup_menu_helper_; | 141 scoped_ptr<PopupMenuHelper> popup_menu_helper_; |
141 | 142 |
142 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); | 143 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); |
143 }; | 144 }; |
144 | 145 |
145 } // namespace content | 146 } // namespace content |
146 | 147 |
147 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ | 148 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ |
OLD | NEW |