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_RENDER_VIEW_HOST_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "content/browser/site_instance_impl.h" | 13 #include "content/browser/site_instance_impl.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
17 #include "content/public/browser/render_view_host_delegate.h" | 17 #include "content/public/browser/render_view_host_delegate.h" |
18 | 18 |
19 class InterstitialPageImpl; | 19 class InterstitialPageImpl; |
20 class NavigationControllerImpl; | 20 class NavigationControllerImpl; |
21 class WebUIImpl; | 21 class WebUIImpl; |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 class BrowserContext; | 24 class BrowserContext; |
25 class NavigationEntry; | 25 class NavigationEntry; |
26 class NavigationEntryImpl; | 26 class NavigationEntryImpl; |
27 class RenderViewHost; | 27 class RenderViewHost; |
28 class RenderViewHostImpl; | 28 class RenderViewHostImpl; |
| 29 class RenderWidgetHostDelegate; |
29 class RenderWidgetHostView; | 30 class RenderWidgetHostView; |
30 class TestWebContents; | 31 class TestWebContents; |
31 } | 32 } |
32 | 33 |
33 // Manages RenderViewHosts for a WebContentsImpl. Normally there is only one and | 34 // Manages RenderViewHosts for a WebContentsImpl. Normally there is only one and |
34 // it is easy to do. But we can also have transitions of processes (and hence | 35 // it is easy to do. But we can also have transitions of processes (and hence |
35 // RenderViewHosts) that can get complex. | 36 // RenderViewHosts) that can get complex. |
36 class CONTENT_EXPORT RenderViewHostManager | 37 class CONTENT_EXPORT RenderViewHostManager |
37 : public content::RenderViewHostDelegate::RendererManagement, | 38 : public content::RenderViewHostDelegate::RendererManagement, |
38 public content::NotificationObserver { | 39 public content::NotificationObserver { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Focuses the location bar. | 94 // Focuses the location bar. |
94 virtual void SetFocusToLocationBar(bool select_all) = 0; | 95 virtual void SetFocusToLocationBar(bool select_all) = 0; |
95 | 96 |
96 // Creates a view and sets the size for the specified RVH. | 97 // Creates a view and sets the size for the specified RVH. |
97 virtual void CreateViewAndSetSizeForRVH(content::RenderViewHost* rvh) = 0; | 98 virtual void CreateViewAndSetSizeForRVH(content::RenderViewHost* rvh) = 0; |
98 | 99 |
99 protected: | 100 protected: |
100 virtual ~Delegate() {} | 101 virtual ~Delegate() {} |
101 }; | 102 }; |
102 | 103 |
103 // Both delegate pointers must be non-NULL and are not owned by this class. | 104 // All three delegate pointers must be non-NULL and are not owned by this |
104 // They must outlive this class. The RenderViewHostDelegate is what will be | 105 // class. They must outlive this class. The RenderViewHostDelegate and |
105 // installed into all RenderViewHosts that are created. | 106 // RenderWidgetHostDelegate are what will be installed into all |
| 107 // RenderViewHosts that are created. |
106 // | 108 // |
107 // You must call Init() before using this class. | 109 // You must call Init() before using this class. |
108 RenderViewHostManager(content::RenderViewHostDelegate* render_view_delegate, | 110 RenderViewHostManager( |
109 Delegate* delegate); | 111 content::RenderViewHostDelegate* render_view_delegate, |
| 112 content::RenderWidgetHostDelegate* render_widget_delegate, |
| 113 Delegate* delegate); |
110 virtual ~RenderViewHostManager(); | 114 virtual ~RenderViewHostManager(); |
111 | 115 |
112 // For arguments, see WebContentsImpl constructor. | 116 // For arguments, see WebContentsImpl constructor. |
113 void Init(content::BrowserContext* browser_context, | 117 void Init(content::BrowserContext* browser_context, |
114 content::SiteInstance* site_instance, | 118 content::SiteInstance* site_instance, |
115 int routing_id); | 119 int routing_id); |
116 | 120 |
117 // Returns the currently active RenderViewHost. | 121 // Returns the currently active RenderViewHost. |
118 // | 122 // |
119 // This will be non-NULL between Init() and Shutdown(). You may want to NULL | 123 // This will be non-NULL between Init() and Shutdown(). You may want to NULL |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 void RendererProcessClosing(content::RenderProcessHost* render_process_host); | 276 void RendererProcessClosing(content::RenderProcessHost* render_process_host); |
273 | 277 |
274 // Our delegate, not owned by us. Guaranteed non-NULL. | 278 // Our delegate, not owned by us. Guaranteed non-NULL. |
275 Delegate* delegate_; | 279 Delegate* delegate_; |
276 | 280 |
277 // Whether a navigation requiring different RenderView's is pending. This is | 281 // Whether a navigation requiring different RenderView's is pending. This is |
278 // either cross-site request is (in the new process model), or when required | 282 // either cross-site request is (in the new process model), or when required |
279 // for the view type (like view source versus not). | 283 // for the view type (like view source versus not). |
280 bool cross_navigation_pending_; | 284 bool cross_navigation_pending_; |
281 | 285 |
282 // Implemented by the owner of this class, this delegate is installed into all | 286 // Implemented by the owner of this class, these delegates are installed into |
283 // the RenderViewHosts that we create. | 287 // all the RenderViewHosts that we create. |
284 content::RenderViewHostDelegate* render_view_delegate_; | 288 content::RenderViewHostDelegate* render_view_delegate_; |
| 289 content::RenderWidgetHostDelegate* render_widget_delegate_; |
285 | 290 |
286 // Our RenderView host and its associated Web UI (if any, will be NULL for | 291 // Our RenderView host and its associated Web UI (if any, will be NULL for |
287 // non-DOM-UI pages). This object is responsible for all communication with | 292 // non-DOM-UI pages). This object is responsible for all communication with |
288 // a child RenderView instance. | 293 // a child RenderView instance. |
289 content::RenderViewHostImpl* render_view_host_; | 294 content::RenderViewHostImpl* render_view_host_; |
290 scoped_ptr<WebUIImpl> web_ui_; | 295 scoped_ptr<WebUIImpl> web_ui_; |
291 | 296 |
292 // A RenderViewHost used to load a cross-site page. This remains hidden | 297 // A RenderViewHost used to load a cross-site page. This remains hidden |
293 // while a cross-site request is pending until it calls DidNavigate. It may | 298 // while a cross-site request is pending until it calls DidNavigate. It may |
294 // have an associated Web UI, in which case the Web UI pointer will be non- | 299 // have an associated Web UI, in which case the Web UI pointer will be non- |
(...skipping 20 matching lines...) Expand all Loading... |
315 // The intersitial page currently shown if any, not own by this class | 320 // The intersitial page currently shown if any, not own by this class |
316 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 321 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
317 InterstitialPageImpl* interstitial_page_; | 322 InterstitialPageImpl* interstitial_page_; |
318 | 323 |
319 content::NotificationRegistrar registrar_; | 324 content::NotificationRegistrar registrar_; |
320 | 325 |
321 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 326 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); |
322 }; | 327 }; |
323 | 328 |
324 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 329 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
OLD | NEW |