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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 class WebContentsView : public RenderViewHostDelegate::View { | 35 class WebContentsView : public RenderViewHostDelegate::View { |
36 public: | 36 public: |
37 WebContentsView(WebContents* web_contents); | 37 WebContentsView(WebContents* web_contents); |
38 virtual ~WebContentsView() {} | 38 virtual ~WebContentsView() {} |
39 | 39 |
40 // Creates the appropriate type of WebContentsView for the current system. | 40 // Creates the appropriate type of WebContentsView for the current system. |
41 // The return value is a new heap allocated view with ownership passing to | 41 // The return value is a new heap allocated view with ownership passing to |
42 // the caller. | 42 // the caller. |
43 static WebContentsView* Create(WebContents* web_contents); | 43 static WebContentsView* Create(WebContents* web_contents); |
44 | 44 |
45 virtual WebContents* GetWebContents() = 0; | 45 WebContents* web_contents() const { return web_contents_; } |
46 | 46 |
47 virtual void CreateView() = 0; | 47 virtual void CreateView() = 0; |
48 | 48 |
49 // Sets up the View that holds the rendered web page, receives messages for | 49 // Sets up the View that holds the rendered web page, receives messages for |
50 // it and contains page plugins. The host view should be sized to the current | 50 // it and contains page plugins. The host view should be sized to the current |
51 // size of the WebContents. | 51 // size of the WebContents. |
52 virtual RenderWidgetHostView* CreateViewForWidget( | 52 virtual RenderWidgetHostView* CreateViewForWidget( |
53 RenderWidgetHost* render_widget_host) = 0; | 53 RenderWidgetHost* render_widget_host) = 0; |
54 | 54 |
55 // Returns the native widget that contains the contents of the tab. | 55 // Returns the native widget that contains the contents of the tab. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, | 138 virtual void ShowCreatedWindowInternal(WebContents* new_web_contents, |
139 WindowOpenDisposition disposition, | 139 WindowOpenDisposition disposition, |
140 const gfx::Rect& initial_pos, | 140 const gfx::Rect& initial_pos, |
141 bool user_gesture) = 0; | 141 bool user_gesture) = 0; |
142 | 142 |
143 virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id, | 143 virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id, |
144 bool activatable); | 144 bool activatable); |
145 virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view, | 145 virtual void ShowCreatedWidgetInternal(RenderWidgetHostView* widget_host_view, |
146 const gfx::Rect& initial_pos); | 146 const gfx::Rect& initial_pos); |
147 | 147 |
148 protected: | |
149 WebContents* web_contents_; | |
150 | |
151 private: | 148 private: |
152 // We implement these functions on RenderViewHostDelegate::View directly and | 149 // We implement these functions on RenderViewHostDelegate::View directly and |
153 // do some book-keeping associated with the request. The request is then | 150 // do some book-keeping associated with the request. The request is then |
154 // forwarded to *Internal which does platform-specific work. | 151 // forwarded to *Internal which does platform-specific work. |
155 virtual void CreateNewWindow(int route_id, | 152 virtual void CreateNewWindow(int route_id, |
156 base::WaitableEvent* modal_dialog_event); | 153 base::WaitableEvent* modal_dialog_event); |
157 virtual void CreateNewWidget(int route_id, bool activatable); | 154 virtual void CreateNewWidget(int route_id, bool activatable); |
158 virtual void ShowCreatedWindow(int route_id, | 155 virtual void ShowCreatedWindow(int route_id, |
159 WindowOpenDisposition disposition, | 156 WindowOpenDisposition disposition, |
160 const gfx::Rect& initial_pos, | 157 const gfx::Rect& initial_pos, |
161 bool user_gesture); | 158 bool user_gesture); |
162 virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos); | 159 virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos); |
163 | 160 |
| 161 // The WebContents whose contents we display. |
| 162 WebContents* web_contents_; |
| 163 |
164 // Tracks created WebContents objects that have not been shown yet. They are | 164 // Tracks created WebContents objects that have not been shown yet. They are |
165 // identified by the route ID passed to CreateNewWindow. | 165 // identified by the route ID passed to CreateNewWindow. |
166 typedef std::map<int, WebContents*> PendingContents; | 166 typedef std::map<int, WebContents*> PendingContents; |
167 PendingContents pending_contents_; | 167 PendingContents pending_contents_; |
168 | 168 |
169 // These maps hold on to the widgets that we created on behalf of the | 169 // These maps hold on to the widgets that we created on behalf of the |
170 // renderer that haven't shown yet. | 170 // renderer that haven't shown yet. |
171 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; | 171 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; |
172 PendingWidgetViews pending_widget_views_; | 172 PendingWidgetViews pending_widget_views_; |
173 | 173 |
174 DISALLOW_COPY_AND_ASSIGN(WebContentsView); | 174 DISALLOW_COPY_AND_ASSIGN(WebContentsView); |
175 }; | 175 }; |
176 | 176 |
177 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_H_ | 177 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_H_ |
OLD | NEW |