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_TAB_CONTENTS_WEB_CONTENTS_VIEW_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_H_ |
7 | 7 |
8 #include <windows.h> | |
9 | |
10 #include <map> | 8 #include <map> |
11 #include <string> | 9 #include <string> |
12 | 10 |
13 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/gfx/native_widget_types.h" |
14 #include "base/gfx/rect.h" | 13 #include "base/gfx/rect.h" |
15 #include "base/gfx/size.h" | 14 #include "base/gfx/size.h" |
16 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 15 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
17 | 16 |
18 class Browser; | 17 class Browser; |
19 class RenderViewHost; | 18 class RenderViewHost; |
20 class RenderWidgetHost; | 19 class RenderWidgetHost; |
21 class RenderWidgetHostView; | 20 class RenderWidgetHostView; |
22 class RenderWidgetHostViewWin; // TODO(brettw) this should not be necessary. | 21 class RenderWidgetHostViewWin; // TODO(brettw) this should not be necessary. |
23 class WebContents; | 22 class WebContents; |
(...skipping 19 matching lines...) Expand all Loading... |
43 | 42 |
44 virtual void CreateView() = 0; | 43 virtual void CreateView() = 0; |
45 | 44 |
46 // Sets up the View that holds the rendered web page, receives messages for | 45 // Sets up the View that holds the rendered web page, receives messages for |
47 // it and contains page plugins. | 46 // it and contains page plugins. |
48 // TODO(brettw) make this so we don't need to return the Win version (see the | 47 // TODO(brettw) make this so we don't need to return the Win version (see the |
49 // caller in WebContents). | 48 // caller in WebContents). |
50 virtual RenderWidgetHostViewWin* CreateViewForWidget( | 49 virtual RenderWidgetHostViewWin* CreateViewForWidget( |
51 RenderWidgetHost* render_widget_host) = 0; | 50 RenderWidgetHost* render_widget_host) = 0; |
52 | 51 |
53 // Returns the HWND that contains the contents of the tab. | 52 // Returns the native widget that contains the contents of the tab. |
54 // TODO(brettw) this should not be necessary in this cross-platform interface. | 53 virtual gfx::NativeView GetNativeView() const = 0; |
55 virtual HWND GetContainerHWND() const = 0; | |
56 | 54 |
57 // Returns the HWND with the main content of the tab (i.e. the main render | 55 // Returns the native widget with the main content of the tab (i.e. the main |
58 // view host, though there may be many popups in the tab as children of the | 56 // render view host, though there may be many popups in the tab as children of |
59 // container HWND). | 57 // the container). |
60 // TODO(brettw) this should not be necessary in this cross-platform interface. | 58 virtual gfx::NativeView GetContentNativeView() const = 0; |
61 virtual HWND GetContentHWND() const = 0; | |
62 | 59 |
63 // Computes the rectangle for the native widget that contains the contents of | 60 // Computes the rectangle for the native widget that contains the contents of |
64 // the tab relative to its parent. | 61 // the tab relative to its parent. |
65 virtual void GetContainerBounds(gfx::Rect *out) const = 0; | 62 virtual void GetContainerBounds(gfx::Rect *out) const = 0; |
66 | 63 |
67 // Helper function for GetContainerBounds. Most callers just want to know the | 64 // Helper function for GetContainerBounds. Most callers just want to know the |
68 // size, and this makes it more clear. | 65 // size, and this makes it more clear. |
69 gfx::Size GetContainerSize() const { | 66 gfx::Size GetContainerSize() const { |
70 gfx::Rect rc; | 67 gfx::Rect rc; |
71 GetContainerBounds(&rc); | 68 GetContainerBounds(&rc); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 146 |
150 // Internal interface for some functions in the RenderViewHostDelegate::View | 147 // Internal interface for some functions in the RenderViewHostDelegate::View |
151 // interface. Subclasses should implement this rather than the corresponding | 148 // interface. Subclasses should implement this rather than the corresponding |
152 // ...::View functions directly, since the routing stuff will already be | 149 // ...::View functions directly, since the routing stuff will already be |
153 // computed. They should implement the rest of the functions as normal. | 150 // computed. They should implement the rest of the functions as normal. |
154 // | 151 // |
155 // The only difference is that the Create functions return the newly | 152 // The only difference is that the Create functions return the newly |
156 // created objects so that they can be associated with the given routes. When | 153 // created objects so that they can be associated with the given routes. When |
157 // they are shown later, we'll look them up again and pass the objects to | 154 // they are shown later, we'll look them up again and pass the objects to |
158 // the Show functions rather than the route ID. | 155 // the Show functions rather than the route ID. |
159 virtual WebContents* CreateNewWindowInternal | 156 virtual WebContents* CreateNewWindowInternal( |
160 (int route_id, base::WaitableEvent* modal_dialog_event) = 0; | 157 int route_id, |
| 158 base::WaitableEvent* modal_dialog_event) = 0; |
161 virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id, | 159 virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id, |
162 bool activatable) = 0; | 160 bool activatable) = 0; |
163 virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, | 161 virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, |
164 WindowOpenDisposition disposition, | 162 WindowOpenDisposition disposition, |
165 const gfx::Rect& initial_pos, | 163 const gfx::Rect& initial_pos, |
166 bool user_gesture) = 0; | 164 bool user_gesture) = 0; |
167 virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view, | 165 virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view, |
168 const gfx::Rect& initial_pos) = 0; | 166 const gfx::Rect& initial_pos) = 0; |
169 | 167 |
170 private: | 168 private: |
(...skipping 16 matching lines...) Expand all Loading... |
187 | 185 |
188 // These maps hold on to the widgets that we created on behalf of the | 186 // These maps hold on to the widgets that we created on behalf of the |
189 // renderer that haven't shown yet. | 187 // renderer that haven't shown yet. |
190 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; | 188 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; |
191 PendingWidgetViews pending_widget_views_; | 189 PendingWidgetViews pending_widget_views_; |
192 | 190 |
193 DISALLOW_COPY_AND_ASSIGN(WebContentsView); | 191 DISALLOW_COPY_AND_ASSIGN(WebContentsView); |
194 }; | 192 }; |
195 | 193 |
196 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_H_ | 194 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_H_ |
OLD | NEW |