OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FRAME_HOST_RENDER_VIEW_HOST_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_VIEW_HOST_MANAGER_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/browser/renderer_host/render_view_host_delegate.h" | 12 #include "content/browser/renderer_host/render_view_host_delegate.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/common/referrer.h" | 17 #include "content/public/common/referrer.h" |
18 | 18 |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class BrowserContext; | 21 class BrowserContext; |
22 class InterstitialPageImpl; | 22 class InterstitialPageImpl; |
23 class NavigationControllerImpl; | 23 class NavigationControllerImpl; |
24 class NavigationEntry; | 24 class NavigationEntry; |
25 class NavigationEntryImpl; | 25 class NavigationEntryImpl; |
| 26 class RenderFrameHostManagerTest; |
26 class RenderViewHost; | 27 class RenderViewHost; |
27 class RenderViewHostImpl; | 28 class RenderViewHostImpl; |
28 class RenderViewHostManagerTest; | |
29 class RenderWidgetHostDelegate; | 29 class RenderWidgetHostDelegate; |
30 class RenderWidgetHostView; | 30 class RenderWidgetHostView; |
31 class TestWebContents; | 31 class TestWebContents; |
32 class WebUIImpl; | 32 class WebUIImpl; |
33 | 33 |
34 // Manages RenderViewHosts for a WebContentsImpl. Normally there is only one and | 34 // Manages RenderFrameHosts for a FrameTreeNode. This class acts as a state |
35 // it is easy to do. But we can also have transitions of processes (and hence | 35 // machine to make cross-process navigations in a frame possible. |
36 // RenderViewHosts) that can get complex. | 36 class CONTENT_EXPORT RenderFrameHostManager |
37 class CONTENT_EXPORT RenderViewHostManager | |
38 : public RenderViewHostDelegate::RendererManagement, | 37 : public RenderViewHostDelegate::RendererManagement, |
39 public NotificationObserver { | 38 public NotificationObserver { |
40 public: | 39 public: |
41 // Functions implemented by our owner that we need. | 40 // Functions implemented by our owner that we need. |
42 // | 41 // |
43 // TODO(brettw) Clean this up! These are all the functions in WebContentsImpl | 42 // TODO(brettw) Clean this up! These are all the functions in WebContentsImpl |
44 // that are required to run this class. The design should probably be better | 43 // that are required to run this class. The design should probably be better |
45 // such that these are more clear. | 44 // such that these are more clear. |
46 // | 45 // |
47 // There is additional complexity that some of the functions we need in | 46 // There is additional complexity that some of the functions we need in |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 protected: | 105 protected: |
107 virtual ~Delegate() {} | 106 virtual ~Delegate() {} |
108 }; | 107 }; |
109 | 108 |
110 // All three delegate pointers must be non-NULL and are not owned by this | 109 // All three delegate pointers must be non-NULL and are not owned by this |
111 // class. They must outlive this class. The RenderViewHostDelegate and | 110 // class. They must outlive this class. The RenderViewHostDelegate and |
112 // RenderWidgetHostDelegate are what will be installed into all | 111 // RenderWidgetHostDelegate are what will be installed into all |
113 // RenderViewHosts that are created. | 112 // RenderViewHosts that are created. |
114 // | 113 // |
115 // You must call Init() before using this class. | 114 // You must call Init() before using this class. |
116 RenderViewHostManager( | 115 RenderFrameHostManager( |
117 RenderViewHostDelegate* render_view_delegate, | 116 RenderViewHostDelegate* render_view_delegate, |
118 RenderWidgetHostDelegate* render_widget_delegate, | 117 RenderWidgetHostDelegate* render_widget_delegate, |
119 Delegate* delegate); | 118 Delegate* delegate); |
120 virtual ~RenderViewHostManager(); | 119 virtual ~RenderFrameHostManager(); |
121 | 120 |
122 // For arguments, see WebContentsImpl constructor. | 121 // For arguments, see WebContentsImpl constructor. |
123 void Init(BrowserContext* browser_context, | 122 void Init(BrowserContext* browser_context, |
124 SiteInstance* site_instance, | 123 SiteInstance* site_instance, |
125 int routing_id, | 124 int routing_id, |
126 int main_frame_routing_id); | 125 int main_frame_routing_id); |
127 | 126 |
128 // Returns the currently active RenderViewHost. | 127 // Returns the currently active RenderViewHost. |
129 // | 128 // |
130 // This will be non-NULL between Init() and Shutdown(). You may want to NULL | 129 // This will be non-NULL between Init() and Shutdown(). You may want to NULL |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 240 |
242 // Returns the swapped out RenderViewHost for the given SiteInstance, if any. | 241 // Returns the swapped out RenderViewHost for the given SiteInstance, if any. |
243 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance); | 242 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance); |
244 | 243 |
245 // Runs the unload handler in the current page, when we know that a pending | 244 // Runs the unload handler in the current page, when we know that a pending |
246 // cross-process navigation is going to commit. We may initiate a transfer | 245 // cross-process navigation is going to commit. We may initiate a transfer |
247 // to a new process after this completes or times out. | 246 // to a new process after this completes or times out. |
248 void SwapOutOldPage(); | 247 void SwapOutOldPage(); |
249 | 248 |
250 private: | 249 private: |
251 friend class RenderViewHostManagerTest; | 250 friend class RenderFrameHostManagerTest; |
252 friend class TestWebContents; | 251 friend class TestWebContents; |
253 | 252 |
254 // Tracks information about a navigation while a cross-process transition is | 253 // Tracks information about a navigation while a cross-process transition is |
255 // in progress, in case we need to transfer it to a new RenderViewHost. | 254 // in progress, in case we need to transfer it to a new RenderViewHost. |
256 struct PendingNavigationParams { | 255 struct PendingNavigationParams { |
257 PendingNavigationParams(); | 256 PendingNavigationParams(); |
258 PendingNavigationParams(const GlobalRequestID& global_request_id, | 257 PendingNavigationParams(const GlobalRequestID& global_request_id, |
259 bool is_transfer, | 258 bool is_transfer, |
260 const std::vector<GURL>& transfer_url, | 259 const std::vector<GURL>& transfer_url, |
261 Referrer referrer, | 260 Referrer referrer, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 // pending_render_view_host_ for navigations to existing entries. | 391 // pending_render_view_host_ for navigations to existing entries. |
393 typedef base::hash_map<int32, RenderViewHostImpl*> RenderViewHostMap; | 392 typedef base::hash_map<int32, RenderViewHostImpl*> RenderViewHostMap; |
394 RenderViewHostMap swapped_out_hosts_; | 393 RenderViewHostMap swapped_out_hosts_; |
395 | 394 |
396 // The intersitial page currently shown if any, not own by this class | 395 // The intersitial page currently shown if any, not own by this class |
397 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 396 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
398 InterstitialPageImpl* interstitial_page_; | 397 InterstitialPageImpl* interstitial_page_; |
399 | 398 |
400 NotificationRegistrar registrar_; | 399 NotificationRegistrar registrar_; |
401 | 400 |
402 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 401 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
403 }; | 402 }; |
404 | 403 |
405 } // namespace content | 404 } // namespace content |
406 | 405 |
407 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_VIEW_HOST_MANAGER_H_ | 406 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |