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_FRAME_HOST_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace content { | 21 namespace content { |
22 class BrowserContext; | 22 class BrowserContext; |
23 class CrossProcessFrameConnector; | 23 class CrossProcessFrameConnector; |
24 class CrossSiteTransferringRequest; | 24 class CrossSiteTransferringRequest; |
25 class InterstitialPageImpl; | 25 class InterstitialPageImpl; |
26 class FrameTreeNode; | 26 class FrameTreeNode; |
27 class NavigationControllerImpl; | 27 class NavigationControllerImpl; |
28 class NavigationEntry; | 28 class NavigationEntry; |
29 class NavigationEntryImpl; | 29 class NavigationEntryImpl; |
30 class RenderFrameHostDelegate; | 30 class RenderFrameHostDelegate; |
| 31 class RenderFrameHost; |
31 class RenderFrameHostImpl; | 32 class RenderFrameHostImpl; |
32 class RenderFrameHostManagerTest; | 33 class RenderFrameHostManagerTest; |
33 class RenderFrameProxyHost; | 34 class RenderFrameProxyHost; |
34 class RenderViewHost; | 35 class RenderViewHost; |
35 class RenderViewHostImpl; | 36 class RenderViewHostImpl; |
36 class RenderWidgetHostDelegate; | 37 class RenderWidgetHostDelegate; |
37 class RenderWidgetHostView; | 38 class RenderWidgetHostView; |
38 class TestWebContents; | 39 class TestWebContents; |
39 class WebUIImpl; | 40 class WebUIImpl; |
40 | 41 |
(...skipping 17 matching lines...) Expand all Loading... |
58 // process is not shared, then the WebContentsImpl will act as though the | 59 // process is not shared, then the WebContentsImpl will act as though the |
59 // renderer is not running (i.e., it will render "sad tab"). This method is | 60 // renderer is not running (i.e., it will render "sad tab"). This method is |
60 // automatically called from LoadURL. |for_main_frame| indicates whether | 61 // automatically called from LoadURL. |for_main_frame| indicates whether |
61 // this RenderViewHost is used to render a top-level frame, so the | 62 // this RenderViewHost is used to render a top-level frame, so the |
62 // appropriate RenderWidgetHostView type is used. | 63 // appropriate RenderWidgetHostView type is used. |
63 virtual bool CreateRenderViewForRenderManager( | 64 virtual bool CreateRenderViewForRenderManager( |
64 RenderViewHost* render_view_host, | 65 RenderViewHost* render_view_host, |
65 int opener_route_id, | 66 int opener_route_id, |
66 int proxy_routing_id, | 67 int proxy_routing_id, |
67 bool for_main_frame) = 0; | 68 bool for_main_frame) = 0; |
| 69 virtual bool CreateRenderFrameForRenderManager( |
| 70 RenderFrameHost* render_frame_host, |
| 71 int parent_routing_id) = 0; |
68 virtual void BeforeUnloadFiredFromRenderManager( | 72 virtual void BeforeUnloadFiredFromRenderManager( |
69 bool proceed, const base::TimeTicks& proceed_time, | 73 bool proceed, const base::TimeTicks& proceed_time, |
70 bool* proceed_to_fire_unload) = 0; | 74 bool* proceed_to_fire_unload) = 0; |
71 virtual void RenderProcessGoneFromRenderManager( | 75 virtual void RenderProcessGoneFromRenderManager( |
72 RenderViewHost* render_view_host) = 0; | 76 RenderViewHost* render_view_host) = 0; |
73 virtual void UpdateRenderViewSizeForRenderManager() = 0; | 77 virtual void UpdateRenderViewSizeForRenderManager() = 0; |
74 virtual void CancelModalDialogsForRenderManager() = 0; | 78 virtual void CancelModalDialogsForRenderManager() = 0; |
75 virtual void NotifySwappedFromRenderManager( | 79 virtual void NotifySwappedFromRenderManager( |
76 RenderViewHost* old_host, RenderViewHost* new_host) = 0; | 80 RenderViewHost* old_host, RenderViewHost* new_host) = 0; |
77 virtual NavigationControllerImpl& | 81 virtual NavigationControllerImpl& |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // Called when a renderer sets its opener to null. | 244 // Called when a renderer sets its opener to null. |
241 void DidDisownOpener(RenderViewHost* render_view_host); | 245 void DidDisownOpener(RenderViewHost* render_view_host); |
242 | 246 |
243 // Helper method to create and initialize a RenderFrameHost. If |swapped_out| | 247 // Helper method to create and initialize a RenderFrameHost. If |swapped_out| |
244 // is true, it will be initially placed on the swapped out hosts list. | 248 // is true, it will be initially placed on the swapped out hosts list. |
245 // Otherwise, it will be used for a pending cross-site navigation. | 249 // Otherwise, it will be used for a pending cross-site navigation. |
246 // Returns the routing id of the *view* associated with the frame. | 250 // Returns the routing id of the *view* associated with the frame. |
247 int CreateRenderFrame(SiteInstance* instance, | 251 int CreateRenderFrame(SiteInstance* instance, |
248 int opener_route_id, | 252 int opener_route_id, |
249 bool swapped_out, | 253 bool swapped_out, |
| 254 bool for_main_frame, |
250 bool hidden); | 255 bool hidden); |
251 | 256 |
| 257 // Helper method to create and initialize a RenderFrameProxyHost. |
| 258 int CreateRenderFrameProxy(SiteInstance* instance, int opener_route_id); |
| 259 |
252 // Sets the passed passed interstitial as the currently showing interstitial. | 260 // Sets the passed passed interstitial as the currently showing interstitial. |
253 // |interstitial_page| should be non NULL (use the remove_interstitial_page | 261 // |interstitial_page| should be non NULL (use the remove_interstitial_page |
254 // method to unset the interstitial) and no interstitial page should be set | 262 // method to unset the interstitial) and no interstitial page should be set |
255 // when there is already a non NULL interstitial page set. | 263 // when there is already a non NULL interstitial page set. |
256 void set_interstitial_page(InterstitialPageImpl* interstitial_page) { | 264 void set_interstitial_page(InterstitialPageImpl* interstitial_page) { |
257 DCHECK(!interstitial_page_ && interstitial_page); | 265 DCHECK(!interstitial_page_ && interstitial_page); |
258 interstitial_page_ = interstitial_page; | 266 interstitial_page_ = interstitial_page; |
259 } | 267 } |
260 | 268 |
261 // Unsets the currently showing interstitial. | 269 // Unsets the currently showing interstitial. |
(...skipping 29 matching lines...) Expand all Loading... |
291 void SwapOutOldPage(); | 299 void SwapOutOldPage(); |
292 | 300 |
293 // Deletes a RenderFrameHost that was pending shutdown. | 301 // Deletes a RenderFrameHost that was pending shutdown. |
294 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id, | 302 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id, |
295 RenderFrameHostImpl* rfh); | 303 RenderFrameHostImpl* rfh); |
296 | 304 |
297 // Deletes any proxy hosts associated with this node. Used during destruction | 305 // Deletes any proxy hosts associated with this node. Used during destruction |
298 // of WebContentsImpl. | 306 // of WebContentsImpl. |
299 void ResetProxyHosts(); | 307 void ResetProxyHosts(); |
300 | 308 |
| 309 int GetRoutingIdForSiteInstance(SiteInstance* site_instance); |
| 310 |
301 private: | 311 private: |
302 friend class RenderFrameHostManagerTest; | 312 friend class RenderFrameHostManagerTest; |
303 friend class TestWebContents; | 313 friend class TestWebContents; |
304 | 314 |
| 315 FRIEND_TEST_ALL_PREFIXES(CrossProcessFrameTreeBrowserTest, |
| 316 VerifyProxyCreation); |
| 317 |
305 // Tracks information about a navigation while a cross-process transition is | 318 // Tracks information about a navigation while a cross-process transition is |
306 // in progress, in case we need to transfer it to a new RenderFrameHost. | 319 // in progress, in case we need to transfer it to a new RenderFrameHost. |
307 // When a request is being transferred, deleting the PendingNavigationParams, | 320 // When a request is being transferred, deleting the PendingNavigationParams, |
308 // and thus |cross_site_transferring_request|, will cancel the request being | 321 // and thus |cross_site_transferring_request|, will cancel the request being |
309 // transferred, unless its ReleaseRequest method has been called. | 322 // transferred, unless its ReleaseRequest method has been called. |
310 struct PendingNavigationParams { | 323 struct PendingNavigationParams { |
311 PendingNavigationParams( | 324 PendingNavigationParams( |
312 const GlobalRequestID& global_request_id, | 325 const GlobalRequestID& global_request_id, |
313 scoped_ptr<CrossSiteTransferringRequest> | 326 scoped_ptr<CrossSiteTransferringRequest> |
314 cross_site_transferring_request, | 327 cross_site_transferring_request, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 // with the given |proxy_routing_id|, which is used to route IPC messages when | 407 // with the given |proxy_routing_id|, which is used to route IPC messages when |
395 // in swapped out state. Returns early if the RenderViewHost has already been | 408 // in swapped out state. Returns early if the RenderViewHost has already been |
396 // initialized for another RenderFrameHost. | 409 // initialized for another RenderFrameHost. |
397 // TODO(creis): opener_route_id is currently for the RenderViewHost but should | 410 // TODO(creis): opener_route_id is currently for the RenderViewHost but should |
398 // be for the RenderFrame, since frames can have openers. | 411 // be for the RenderFrame, since frames can have openers. |
399 bool InitRenderView(RenderViewHost* render_view_host, | 412 bool InitRenderView(RenderViewHost* render_view_host, |
400 int opener_route_id, | 413 int opener_route_id, |
401 int proxy_routing_id, | 414 int proxy_routing_id, |
402 bool for_main_frame); | 415 bool for_main_frame); |
403 | 416 |
| 417 bool InitRenderFrame(RenderFrameHost* render_frame_host); |
| 418 |
404 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this | 419 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this |
405 // doesn't require the pending render_frame_host_ pointer to be non-NULL, | 420 // doesn't require the pending render_frame_host_ pointer to be non-NULL, |
406 // since there could be Web UI switching as well. Call this for every commit. | 421 // since there could be Web UI switching as well. Call this for every commit. |
407 void CommitPending(); | 422 void CommitPending(); |
408 | 423 |
409 // Shutdown all RenderFrameHosts in a SiteInstance. This is called to shutdown | 424 // Shutdown all RenderFrameHosts in a SiteInstance. This is called to shutdown |
410 // frames when all the frames in a SiteInstance are confirmed to be swapped | 425 // frames when all the frames in a SiteInstance are confirmed to be swapped |
411 // out. | 426 // out. |
412 void ShutdownRenderFrameHostsInSiteInstance(int32 site_instance_id); | 427 void ShutdownRenderFrameHostsInSiteInstance(int32 site_instance_id); |
413 | 428 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 NotificationRegistrar registrar_; | 508 NotificationRegistrar registrar_; |
494 | 509 |
495 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 510 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
496 | 511 |
497 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 512 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
498 }; | 513 }; |
499 | 514 |
500 } // namespace content | 515 } // namespace content |
501 | 516 |
502 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 517 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |