OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_WEB_CONTENTS_VIEW_H_ | 5 #ifndef CHROME_BROWSER_WEB_CONTENTS_VIEW_H_ |
6 #define CHROME_BROWSER_WEB_CONTENTS_VIEW_H_ | 6 #define CHROME_BROWSER_WEB_CONTENTS_VIEW_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/gfx/rect.h" | 14 #include "base/gfx/rect.h" |
15 #include "base/gfx/size.h" | 15 #include "base/gfx/size.h" |
16 #include "chrome/browser/render_view_host_delegate.h" | 16 #include "chrome/browser/render_view_host_delegate.h" |
17 | 17 |
18 class Browser; | 18 class Browser; |
19 class RenderViewHost; | 19 class RenderViewHost; |
20 class RenderWidgetHost; | 20 class RenderWidgetHost; |
21 class RenderWidgetHostView; | 21 class RenderWidgetHostView; |
22 class RenderWidgetHostViewWin; // TODO(brettw) this should not be necessary. | 22 class RenderWidgetHostViewWin; // TODO(brettw) this should not be necessary. |
23 class WebContents; | 23 class WebContents; |
24 struct WebDropData; | 24 struct WebDropData; |
25 class WebKeyboardEvent; | 25 class WebKeyboardEvent; |
26 | 26 |
| 27 namespace base { |
| 28 class WaitableEvent; |
| 29 } |
| 30 |
27 // The WebContentsView is an interface that is implemented by the platform- | 31 // The WebContentsView is an interface that is implemented by the platform- |
28 // dependent web contents views. The WebContents uses this interface to talk to | 32 // dependent web contents views. The WebContents uses this interface to talk to |
29 // them. View-related messages will also get forwarded directly to this class | 33 // them. View-related messages will also get forwarded directly to this class |
30 // from RenderViewHost via RenderViewHostDelegate::View. | 34 // from RenderViewHost via RenderViewHostDelegate::View. |
31 // | 35 // |
32 // It contains a small amount of logic with respect to creating new sub-view | 36 // It contains a small amount of logic with respect to creating new sub-view |
33 // that should be the same for all platforms. | 37 // that should be the same for all platforms. |
34 class WebContentsView : public RenderViewHostDelegate::View { | 38 class WebContentsView : public RenderViewHostDelegate::View { |
35 public: | 39 public: |
36 virtual ~WebContentsView() {} | 40 virtual ~WebContentsView() {} |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 149 |
146 // Internal interface for some functions in the RenderViewHostDelegate::View | 150 // Internal interface for some functions in the RenderViewHostDelegate::View |
147 // interface. Subclasses should implement this rather than the corresponding | 151 // interface. Subclasses should implement this rather than the corresponding |
148 // ...::View functions directly, since the routing stuff will already be | 152 // ...::View functions directly, since the routing stuff will already be |
149 // computed. They should implement the rest of the functions as normal. | 153 // computed. They should implement the rest of the functions as normal. |
150 // | 154 // |
151 // The only difference is that the Create functions return the newly | 155 // The only difference is that the Create functions return the newly |
152 // created objects so that they can be associated with the given routes. When | 156 // created objects so that they can be associated with the given routes. When |
153 // they are shown later, we'll look them up again and pass the objects to | 157 // they are shown later, we'll look them up again and pass the objects to |
154 // the Show functions rather than the route ID. | 158 // the Show functions rather than the route ID. |
155 virtual WebContents* CreateNewWindowInternal(int route_id, | 159 virtual WebContents* CreateNewWindowInternal |
156 HANDLE modal_dialog_event) = 0; | 160 (int route_id, base::WaitableEvent* modal_dialog_event) = 0; |
157 virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id, | 161 virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id, |
158 bool activatable) = 0; | 162 bool activatable) = 0; |
159 virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, | 163 virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, |
160 WindowOpenDisposition disposition, | 164 WindowOpenDisposition disposition, |
161 const gfx::Rect& initial_pos, | 165 const gfx::Rect& initial_pos, |
162 bool user_gesture) = 0; | 166 bool user_gesture) = 0; |
163 virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view, | 167 virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view, |
164 const gfx::Rect& initial_pos) = 0; | 168 const gfx::Rect& initial_pos) = 0; |
165 | 169 |
166 private: | 170 private: |
167 // We implement these functions on RenderViewHostDelegate::View directly and | 171 // We implement these functions on RenderViewHostDelegate::View directly and |
168 // do some book-keeping associated with the request. The request is then | 172 // do some book-keeping associated with the request. The request is then |
169 // forwarded to *Internal which does platform-specific work. | 173 // forwarded to *Internal which does platform-specific work. |
170 virtual void CreateNewWindow(int route_id, HANDLE modal_dialog_event); | 174 virtual void CreateNewWindow(int route_id, |
| 175 base::WaitableEvent* modal_dialog_event); |
171 virtual void CreateNewWidget(int route_id, bool activatable); | 176 virtual void CreateNewWidget(int route_id, bool activatable); |
172 virtual void ShowCreatedWindow(int route_id, | 177 virtual void ShowCreatedWindow(int route_id, |
173 WindowOpenDisposition disposition, | 178 WindowOpenDisposition disposition, |
174 const gfx::Rect& initial_pos, | 179 const gfx::Rect& initial_pos, |
175 bool user_gesture); | 180 bool user_gesture); |
176 virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos); | 181 virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos); |
177 | 182 |
178 // Tracks created WebContents objects that have not been shown yet. They are | 183 // Tracks created WebContents objects that have not been shown yet. They are |
179 // identified by the route ID passed to CreateNewWindow. | 184 // identified by the route ID passed to CreateNewWindow. |
180 typedef std::map<int, WebContents*> PendingContents; | 185 typedef std::map<int, WebContents*> PendingContents; |
181 PendingContents pending_contents_; | 186 PendingContents pending_contents_; |
182 | 187 |
183 // These maps hold on to the widgets that we created on behalf of the | 188 // These maps hold on to the widgets that we created on behalf of the |
184 // renderer that haven't shown yet. | 189 // renderer that haven't shown yet. |
185 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; | 190 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; |
186 PendingWidgetViews pending_widget_views_; | 191 PendingWidgetViews pending_widget_views_; |
187 | 192 |
188 DISALLOW_COPY_AND_ASSIGN(WebContentsView); | 193 DISALLOW_COPY_AND_ASSIGN(WebContentsView); |
189 }; | 194 }; |
190 | 195 |
191 #endif // CHROME_BROWSER_WEB_CONTENTS_VIEW_H_ | 196 #endif // CHROME_BROWSER_WEB_CONTENTS_VIEW_H_ |
OLD | NEW |