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 <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/mac/scoped_nsobject.h" | 14 #include "base/mac/scoped_nsobject.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 16 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
17 #include "content/browser/web_contents/web_contents_view.h" | 17 #include "content/browser/web_contents/web_contents_view.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/common/drag_event_source_info.h" | 19 #include "content/common/drag_event_source_info.h" |
20 #include "ui/base/cocoa/base_view.h" | 20 #include "ui/base/cocoa/base_view.h" |
21 #include "ui/gfx/geometry/size.h" | 21 #include "ui/gfx/geometry/size.h" |
22 | 22 |
23 @class FocusTracker; | 23 @class FocusTracker; |
24 @class WebDragDest; | 24 @class WebDragDest; |
25 @class WebDragSource; | 25 @class WebDragSource; |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 class PopupMenuHelper; | 28 class PopupMenuHelper; |
| 29 class RenderWidgetHostViewMac; |
29 class WebContentsImpl; | 30 class WebContentsImpl; |
30 class WebContentsViewDelegate; | 31 class WebContentsViewDelegate; |
31 class WebContentsViewMac; | 32 class WebContentsViewMac; |
32 } | 33 } |
33 | 34 |
34 namespace gfx { | 35 namespace gfx { |
35 class Vector2d; | 36 class Vector2d; |
36 } | 37 } |
37 | 38 |
38 CONTENT_EXPORT | 39 CONTENT_EXPORT |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void GotFocus() override; | 122 void GotFocus() override; |
122 void TakeFocus(bool reverse) override; | 123 void TakeFocus(bool reverse) override; |
123 | 124 |
124 // A helper method for closing the tab in the | 125 // A helper method for closing the tab in the |
125 // CloseTabAfterEventTracking() implementation. | 126 // CloseTabAfterEventTracking() implementation. |
126 void CloseTab(); | 127 void CloseTab(); |
127 | 128 |
128 WebContentsImpl* web_contents() { return web_contents_; } | 129 WebContentsImpl* web_contents() { return web_contents_; } |
129 WebContentsViewDelegate* delegate() { return delegate_.get(); } | 130 WebContentsViewDelegate* delegate() { return delegate_.get(); } |
130 | 131 |
| 132 using RenderWidgetHostViewCreateFunction = |
| 133 RenderWidgetHostViewMac* (*)(RenderWidgetHost*, bool); |
| 134 |
| 135 // Used to override the creation of RenderWidgetHostViews in tests. |
| 136 CONTENT_EXPORT static void InstallCreateHookForTests( |
| 137 RenderWidgetHostViewCreateFunction create_render_widget_host_view); |
| 138 |
131 private: | 139 private: |
132 // Returns the fullscreen view, if one exists; otherwise, returns the content | 140 // Returns the fullscreen view, if one exists; otherwise, returns the content |
133 // native view. This ensures that the view currently attached to a NSWindow is | 141 // native view. This ensures that the view currently attached to a NSWindow is |
134 // being used to query or set first responder state. | 142 // being used to query or set first responder state. |
135 gfx::NativeView GetNativeViewForFocus() const; | 143 gfx::NativeView GetNativeViewForFocus() const; |
136 | 144 |
137 // The WebContentsImpl whose contents we display. | 145 // The WebContentsImpl whose contents we display. |
138 WebContentsImpl* web_contents_; | 146 WebContentsImpl* web_contents_; |
139 | 147 |
140 // The Cocoa NSView that lives in the view hierarchy. | 148 // The Cocoa NSView that lives in the view hierarchy. |
(...skipping 10 matching lines...) Expand all Loading... |
151 bool allow_other_views_; | 159 bool allow_other_views_; |
152 | 160 |
153 std::unique_ptr<PopupMenuHelper> popup_menu_helper_; | 161 std::unique_ptr<PopupMenuHelper> popup_menu_helper_; |
154 | 162 |
155 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); | 163 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); |
156 }; | 164 }; |
157 | 165 |
158 } // namespace content | 166 } // namespace content |
159 | 167 |
160 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ | 168 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ |
OLD | NEW |