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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "content/browser/frame_host/render_frame_host_impl.h" |
15 #include "content/browser/renderer_host/render_view_host_delegate.h" | 16 #include "content/browser/renderer_host/render_view_host_delegate.h" |
16 #include "content/browser/site_instance_impl.h" | 17 #include "content/browser/site_instance_impl.h" |
17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
18 #include "content/public/browser/global_request_id.h" | 19 #include "content/public/browser/global_request_id.h" |
19 #include "content/public/common/referrer.h" | 20 #include "content/public/common/referrer.h" |
20 #include "ui/base/page_transition_types.h" | 21 #include "ui/base/page_transition_types.h" |
21 #include "url/origin.h" | 22 #include "url/origin.h" |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 class BrowserContext; | 25 class BrowserContext; |
25 class CrossProcessFrameConnector; | 26 class CrossProcessFrameConnector; |
26 class CrossSiteTransferringRequest; | 27 class CrossSiteTransferringRequest; |
27 class FrameNavigationEntry; | 28 class FrameNavigationEntry; |
28 class FrameTreeNode; | 29 class FrameTreeNode; |
29 class InterstitialPageImpl; | 30 class InterstitialPageImpl; |
30 class NavigationControllerImpl; | 31 class NavigationControllerImpl; |
31 class NavigationEntry; | 32 class NavigationEntry; |
32 class NavigationEntryImpl; | 33 class NavigationEntryImpl; |
33 class NavigationHandleImpl; | 34 class NavigationHandleImpl; |
34 class NavigationRequest; | 35 class NavigationRequest; |
35 class NavigatorTestWithBrowserSideNavigation; | 36 class NavigatorTestWithBrowserSideNavigation; |
36 class RenderFrameHost; | |
37 class RenderFrameHostDelegate; | 37 class RenderFrameHostDelegate; |
38 class RenderFrameHostImpl; | |
39 class RenderFrameHostManagerTest; | 38 class RenderFrameHostManagerTest; |
40 class RenderFrameProxyHost; | 39 class RenderFrameProxyHost; |
41 class RenderViewHost; | 40 class RenderViewHost; |
42 class RenderViewHostImpl; | 41 class RenderViewHostImpl; |
43 class RenderWidgetHostDelegate; | 42 class RenderWidgetHostDelegate; |
44 class RenderWidgetHostView; | 43 class RenderWidgetHostView; |
45 class TestWebContents; | 44 class TestWebContents; |
46 class WebUIImpl; | 45 class WebUIImpl; |
47 struct CommonNavigationParams; | 46 struct CommonNavigationParams; |
48 struct FrameReplicationState; | 47 struct FrameReplicationState; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 RenderFrameHost* new_host, | 140 RenderFrameHost* new_host, |
142 bool is_main_frame) = 0; | 141 bool is_main_frame) = 0; |
143 // TODO(nasko): This should be removed once extensions no longer use | 142 // TODO(nasko): This should be removed once extensions no longer use |
144 // NotificationService. See https://crbug.com/462682. | 143 // NotificationService. See https://crbug.com/462682. |
145 virtual void NotifyMainFrameSwappedFromRenderManager( | 144 virtual void NotifyMainFrameSwappedFromRenderManager( |
146 RenderViewHost* old_host, | 145 RenderViewHost* old_host, |
147 RenderViewHost* new_host) = 0; | 146 RenderViewHost* new_host) = 0; |
148 virtual NavigationControllerImpl& | 147 virtual NavigationControllerImpl& |
149 GetControllerForRenderManager() = 0; | 148 GetControllerForRenderManager() = 0; |
150 | 149 |
151 // Creates a WebUI object for the given URL if one applies. Ownership of the | |
152 // returned pointer will be passed to the caller. If no WebUI applies, | |
153 // returns NULL. | |
154 virtual scoped_ptr<WebUIImpl> CreateWebUIForRenderManager( | |
155 const GURL& url) = 0; | |
156 | |
157 // Returns the navigation entry of the current navigation, or NULL if there | 150 // Returns the navigation entry of the current navigation, or NULL if there |
158 // is none. | 151 // is none. |
159 virtual NavigationEntry* | 152 virtual NavigationEntry* |
160 GetLastCommittedNavigationEntryForRenderManager() = 0; | 153 GetLastCommittedNavigationEntryForRenderManager() = 0; |
161 | 154 |
162 // Returns true if the location bar should be focused by default rather than | 155 // Returns true if the location bar should be focused by default rather than |
163 // the page contents. The view calls this function when the tab is focused | 156 // the page contents. The view calls this function when the tab is focused |
164 // to see what it should do. | 157 // to see what it should do. |
165 virtual bool FocusLocationBarByDefault() = 0; | 158 virtual bool FocusLocationBarByDefault() = 0; |
166 | 159 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 246 |
254 // Returns the speculative RenderFrameHost, or null if there is no speculative | 247 // Returns the speculative RenderFrameHost, or null if there is no speculative |
255 // one. | 248 // one. |
256 RenderFrameHostImpl* speculative_frame_host() const { | 249 RenderFrameHostImpl* speculative_frame_host() const { |
257 return speculative_render_frame_host_.get(); | 250 return speculative_render_frame_host_.get(); |
258 } | 251 } |
259 | 252 |
260 // TODO(creis): Remove this when we no longer use RVH for navigation. | 253 // TODO(creis): Remove this when we no longer use RVH for navigation. |
261 RenderViewHostImpl* pending_render_view_host() const; | 254 RenderViewHostImpl* pending_render_view_host() const; |
262 | 255 |
263 // Returns the current committed Web UI or NULL if none applies. | 256 // Returns the current committed WebUI or NULL if none applies. |
264 WebUIImpl* web_ui() const { return web_ui_.get(); } | 257 WebUIImpl* web_ui() const { return render_frame_host_->web_ui(); } |
265 | 258 |
266 // Returns the Web UI for the pending navigation, or NULL of none applies. | 259 // Returns the WebUI for the pending navigation, or NULL of none applies. |
267 WebUIImpl* pending_web_ui() const { | 260 WebUIImpl* pending_web_ui() const { |
268 return pending_web_ui_.get() ? pending_web_ui_.get() : | 261 return pending_render_frame_host_ ? pending_render_frame_host_->web_ui() |
269 pending_and_current_web_ui_.get(); | 262 : render_frame_host_->pending_web_ui(); |
270 } | 263 } |
271 | 264 |
272 // PlzNavigate | 265 // PlzNavigate |
273 // Returns the speculative WebUI for the navigation (a newly created one or | 266 // Returns the speculative WebUI for the navigation (a newly created one or |
274 // the current one if it should be reused). If none is set returns nullptr. | 267 // the current one if it should be reused). If none is set returns nullptr. |
275 WebUIImpl* speculative_web_ui() const { | 268 WebUIImpl* speculative_web_ui() const { |
276 return should_reuse_web_ui_ ? web_ui_.get() : speculative_web_ui_.get(); | 269 return speculative_render_frame_host_ |
| 270 ? speculative_render_frame_host_->web_ui() |
| 271 : render_frame_host_->pending_web_ui(); |
277 } | 272 } |
278 | 273 |
279 // Called when we want to instruct the renderer to navigate to the given | 274 // Called when we want to instruct the renderer to navigate to the given |
280 // navigation entry. It may create a new RenderFrameHost or re-use an existing | 275 // navigation entry. It may create a new RenderFrameHost or re-use an existing |
281 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one | 276 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one |
282 // could not be created. |dest_url| takes precedence over the |frame_entry|'s | 277 // could not be created. |dest_url| takes precedence over the |frame_entry|'s |
283 // url (this is necessary because ReloadOriginalRequest navigates to a | 278 // url (this is necessary because ReloadOriginalRequest navigates to a |
284 // different URL than the last committed entry, without modifying it). | 279 // different URL than the last committed entry, without modifying it). |
285 RenderFrameHostImpl* Navigate(const GURL& dest_url, | 280 RenderFrameHostImpl* Navigate(const GURL& dest_url, |
286 const FrameNavigationEntry& frame_entry, | 281 const FrameNavigationEntry& frame_entry, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 324 |
330 // Called when this frame's opener is changed to the frame specified by | 325 // Called when this frame's opener is changed to the frame specified by |
331 // |opener_routing_id| in |source_site_instance|'s process. This change | 326 // |opener_routing_id| in |source_site_instance|'s process. This change |
332 // could come from either the current RenderFrameHost or one of the | 327 // could come from either the current RenderFrameHost or one of the |
333 // proxies (e.g., window.open that targets a RemoteFrame by name). The | 328 // proxies (e.g., window.open that targets a RemoteFrame by name). The |
334 // updated opener will be forwarded to any other RenderFrameProxies and | 329 // updated opener will be forwarded to any other RenderFrameProxies and |
335 // RenderFrames for this FrameTreeNode. | 330 // RenderFrames for this FrameTreeNode. |
336 void DidChangeOpener(int opener_routing_id, | 331 void DidChangeOpener(int opener_routing_id, |
337 SiteInstance* source_site_instance); | 332 SiteInstance* source_site_instance); |
338 | 333 |
339 // Sets the pending Web UI for the pending navigation, ensuring that the | 334 // Creates and initializes a RenderFrameHost. If |flags| has the |
340 // bindings are appropriate compared to |bindings|. | |
341 void SetPendingWebUI(const GURL& url, int bindings); | |
342 | |
343 // Creates and initializes a RenderFrameHost. The |web_ui| is an optional | |
344 // input parameter used to double check bindings when swapping back in a | |
345 // previously existing RenderFrameHost. If |flags| has the | |
346 // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will | 335 // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will |
347 // initially be placed on the swapped out hosts list. If |view_routing_id_ptr| | 336 // initially be placed on the swapped out hosts list. If |view_routing_id_ptr| |
348 // is not nullptr it will be set to the routing id of the view associated with | 337 // is not nullptr it will be set to the routing id of the view associated with |
349 // the frame. | 338 // the frame. |
350 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, | 339 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, |
351 WebUIImpl* web_ui, | |
352 int flags, | 340 int flags, |
353 int* view_routing_id_ptr); | 341 int* view_routing_id_ptr); |
354 | 342 |
355 // Helper method to create and initialize a RenderFrameProxyHost and return | 343 // Helper method to create and initialize a RenderFrameProxyHost and return |
356 // its routing id. | 344 // its routing id. |
357 int CreateRenderFrameProxy(SiteInstance* instance); | 345 int CreateRenderFrameProxy(SiteInstance* instance); |
358 | 346 |
359 // Creates proxies for a new child frame at FrameTreeNode |child| in all | 347 // Creates proxies for a new child frame at FrameTreeNode |child| in all |
360 // SiteInstances for which the current frame has proxies. This method is | 348 // SiteInstances for which the current frame has proxies. This method is |
361 // called on the parent of a new child frame before the child leaves the | 349 // called on the parent of a new child frame before the child leaves the |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 // SiteInstance's site and when we later call IsSameWebSite. If there is no | 532 // SiteInstance's site and when we later call IsSameWebSite. If there is no |
545 // current NavigationEntry, check the current SiteInstance's site, which might | 533 // current NavigationEntry, check the current SiteInstance's site, which might |
546 // already be committed to a Web UI URL (such as the NTP). | 534 // already be committed to a Web UI URL (such as the NTP). |
547 bool ShouldSwapBrowsingInstancesForNavigation( | 535 bool ShouldSwapBrowsingInstancesForNavigation( |
548 const GURL& current_effective_url, | 536 const GURL& current_effective_url, |
549 bool current_is_view_source_mode, | 537 bool current_is_view_source_mode, |
550 SiteInstance* new_site_instance, | 538 SiteInstance* new_site_instance, |
551 const GURL& new_effective_url, | 539 const GURL& new_effective_url, |
552 bool new_is_view_source_mode) const; | 540 bool new_is_view_source_mode) const; |
553 | 541 |
554 // Creates a new Web UI, ensuring that the bindings are appropriate compared | |
555 // to |bindings|. | |
556 scoped_ptr<WebUIImpl> CreateWebUI(const GURL& url, int bindings); | |
557 | |
558 // Returns true if it is safe to reuse the current WebUI when navigating from | |
559 // |current_entry| to |new_url|. | |
560 bool ShouldReuseWebUI( | |
561 const NavigationEntry* current_entry, | |
562 const GURL& new_url) const; | |
563 | |
564 // Returns the SiteInstance to use for the navigation. | 542 // Returns the SiteInstance to use for the navigation. |
565 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, | 543 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, |
566 SiteInstance* source_instance, | 544 SiteInstance* source_instance, |
567 SiteInstance* dest_instance, | 545 SiteInstance* dest_instance, |
568 SiteInstance* candidate_instance, | 546 SiteInstance* candidate_instance, |
569 ui::PageTransition transition, | 547 ui::PageTransition transition, |
570 bool dest_is_restore, | 548 bool dest_is_restore, |
571 bool dest_is_view_source_mode); | 549 bool dest_is_view_source_mode); |
572 | 550 |
573 // Returns a descriptor of the appropriate SiteInstance object for the given | 551 // Returns a descriptor of the appropriate SiteInstance object for the given |
(...skipping 25 matching lines...) Expand all Loading... |
599 // description, it is returned as is. | 577 // description, it is returned as is. |
600 SiteInstance* ConvertToSiteInstance(const SiteInstanceDescriptor& descriptor, | 578 SiteInstance* ConvertToSiteInstance(const SiteInstanceDescriptor& descriptor, |
601 SiteInstance* candidate_instance); | 579 SiteInstance* candidate_instance); |
602 | 580 |
603 // Determines the appropriate url to use as the current url for SiteInstance | 581 // Determines the appropriate url to use as the current url for SiteInstance |
604 // selection. | 582 // selection. |
605 const GURL& GetCurrentURLForSiteInstance( | 583 const GURL& GetCurrentURLForSiteInstance( |
606 SiteInstance* current_instance, | 584 SiteInstance* current_instance, |
607 NavigationEntry* current_entry); | 585 NavigationEntry* current_entry); |
608 | 586 |
| 587 // This is the private version of CreateRenderFrame that also allows the |
| 588 // caller to specify a URL and bindings for the potential setup of a WebUI. |
| 589 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameInternal( |
| 590 SiteInstance* instance, |
| 591 const GURL& url, |
| 592 int bindings, |
| 593 int flags, |
| 594 int* view_routing_id_ptr); |
| 595 |
609 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to | 596 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to |
610 // |pending_render_frame_host_| while respecting the opener route if needed | 597 // |pending_render_frame_host_| while respecting the opener route if needed |
611 // and stores it in pending_render_frame_host_. | 598 // and stores it in pending_render_frame_host_. |
612 void CreatePendingRenderFrameHost(SiteInstance* old_instance, | 599 void CreatePendingRenderFrameHost(SiteInstance* old_instance, |
613 SiteInstance* new_instance); | 600 SiteInstance* new_instance, |
| 601 const GURL& url, |
| 602 int bindings); |
614 | 603 |
615 // Ensure that we have created all needed proxies for a new RFH with | 604 // Ensure that we have created all needed proxies for a new RFH with |
616 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for | 605 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for |
617 // the new RFH's opener chain if we are staying in the same BrowsingInstance; | 606 // the new RFH's opener chain if we are staying in the same BrowsingInstance; |
618 // (2) Create proxies for the new RFH's SiteInstance in its own frame tree. | 607 // (2) Create proxies for the new RFH's SiteInstance in its own frame tree. |
619 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance, | 608 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance, |
620 SiteInstance* new_instance); | 609 SiteInstance* new_instance); |
621 | 610 |
622 // Traverse the opener chain and populate |opener_frame_trees| with | 611 // Traverse the opener chain and populate |opener_frame_trees| with |
623 // all FrameTrees accessible by following frame openers of nodes in the | 612 // all FrameTrees accessible by following frame openers of nodes in the |
(...skipping 13 matching lines...) Expand all Loading... |
637 // opener chain. Don't create proxies for the subtree rooted at | 626 // opener chain. Don't create proxies for the subtree rooted at |
638 // |skip_this_node|. | 627 // |skip_this_node|. |
639 void CreateOpenerProxiesForFrameTree(SiteInstance* instance, | 628 void CreateOpenerProxiesForFrameTree(SiteInstance* instance, |
640 FrameTreeNode* skip_this_node); | 629 FrameTreeNode* skip_this_node); |
641 | 630 |
642 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. | 631 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. |
643 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, | 632 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, |
644 int32 view_routing_id, | 633 int32 view_routing_id, |
645 int32 frame_routing_id, | 634 int32 frame_routing_id, |
646 int32 widget_routing_id, | 635 int32 widget_routing_id, |
647 int flags); | 636 int flags, |
| 637 const GURL& dest_url, |
| 638 int entry_bindings); |
648 | 639 |
649 // PlzNavigate | 640 // PlzNavigate |
650 // Creates and initializes a speculative RenderFrameHost and/or WebUI for an | 641 // Creates and initializes a speculative RenderFrameHost for an ongoing |
651 // ongoing navigation. They might be destroyed and re-created later if the | 642 // navigation. They might be destroyed and re-created later if the navigation |
652 // navigation is redirected to a different SiteInstance. | 643 // is redirected to a different SiteInstance. |
653 bool CreateSpeculativeRenderFrameHost(const GURL& url, | 644 bool CreateSpeculativeRenderFrameHost(const GURL& url, |
654 SiteInstance* old_instance, | 645 SiteInstance* old_instance, |
655 SiteInstance* new_instance, | 646 SiteInstance* new_instance, |
656 int bindings); | 647 int bindings); |
657 | 648 |
658 // Sets up the necessary state for a new RenderViewHost. Creates a | 649 // Sets up the necessary state for a new RenderViewHost. Creates a |
659 // RenderFrameProxy in the target renderer process with the given | 650 // RenderFrameProxy in the target renderer process with the given |
660 // |proxy_routing_id|, which is used to route IPC messages when in swapped | 651 // |proxy_routing_id|, which is used to route IPC messages when in swapped |
661 // out state. Returns early if the RenderViewHost has already been | 652 // out state. Returns early if the RenderViewHost has already been |
662 // initialized for another RenderFrameHost. | 653 // initialized for another RenderFrameHost. |
663 bool InitRenderView(RenderViewHostImpl* render_view_host, | 654 bool InitRenderView(RenderViewHostImpl* render_view_host, |
664 int proxy_routing_id); | 655 int proxy_routing_id, |
| 656 WebUIImpl* dest_web_ui); |
665 | 657 |
666 // Initialization for RenderFrameHost uses the same sequence as InitRenderView | 658 // Initialization for RenderFrameHost uses the same sequence as InitRenderView |
667 // above. | 659 // above. |
668 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); | 660 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); |
669 | 661 |
670 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this | 662 // Sets the pending RenderFrameHost to be the active one. Note that if the |
671 // doesn't require the pending render_frame_host_ pointer to be non-NULL, | 663 // current one is being reused this method might switch its WebUI if there is |
672 // since there could be Web UI switching as well. Call this for every commit. | 664 // a pending one. Call this for every commit. |
673 // If PlzNavigate is enabled the method will set the speculative (not pending) | 665 // If PlzNavigate is enabled the method will set the speculative (not pending) |
674 // RenderFrameHost to be the active one. | 666 // RenderFrameHost to be the active one. |
675 void CommitPending(); | 667 void CommitPending(); |
676 | 668 |
677 // Helper to call CommitPending() in all necessary cases. | 669 // Helper to call CommitPending() in all necessary cases. |
678 void CommitPendingIfNecessary(RenderFrameHostImpl* render_frame_host, | 670 void CommitPendingIfNecessary(RenderFrameHostImpl* render_frame_host, |
679 bool was_caused_by_user_gesture); | 671 bool was_caused_by_user_gesture); |
680 | 672 |
681 // Commits any pending sandbox flag updates when the renderer's frame | 673 // Commits any pending sandbox flag updates when the renderer's frame |
682 // navigates. | 674 // navigates. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 | 726 |
735 // Our delegate, not owned by us. Guaranteed non-NULL. | 727 // Our delegate, not owned by us. Guaranteed non-NULL. |
736 Delegate* delegate_; | 728 Delegate* delegate_; |
737 | 729 |
738 // Implemented by the owner of this class. These delegates are installed into | 730 // Implemented by the owner of this class. These delegates are installed into |
739 // all the RenderFrameHosts that we create. | 731 // all the RenderFrameHosts that we create. |
740 RenderFrameHostDelegate* render_frame_delegate_; | 732 RenderFrameHostDelegate* render_frame_delegate_; |
741 RenderViewHostDelegate* render_view_delegate_; | 733 RenderViewHostDelegate* render_view_delegate_; |
742 RenderWidgetHostDelegate* render_widget_delegate_; | 734 RenderWidgetHostDelegate* render_widget_delegate_; |
743 | 735 |
744 // Our RenderFrameHost and its associated Web UI (if any, will be NULL for | 736 // Our RenderFrameHost which is responsible for all communication with a child |
745 // non-WebUI pages). This object is responsible for all communication with | 737 // RenderFrame instance. |
746 // a child RenderFrame instance. | |
747 // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive. | 738 // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive. |
748 // Eventually, RenderViewHost will be replaced with a page context. | 739 // Eventually, RenderViewHost will be replaced with a page context. |
749 scoped_ptr<RenderFrameHostImpl> render_frame_host_; | 740 scoped_ptr<RenderFrameHostImpl> render_frame_host_; |
750 scoped_ptr<WebUIImpl> web_ui_; | |
751 | 741 |
752 // A RenderFrameHost used to load a cross-site page. This remains hidden | 742 // A RenderFrameHost used to load a cross-site page. This remains hidden |
753 // while a cross-site request is pending until it calls DidNavigate. It may | 743 // while a cross-site request is pending until it calls DidNavigate. |
754 // have an associated Web UI, in which case the Web UI pointer will be non- | 744 // Note: This member is not used in PlzNavigate. |
755 // NULL. | |
756 // | |
757 // The |pending_web_ui_| may be non-NULL even when the | |
758 // |pending_render_frame_host_| is NULL. This will happen when we're | |
759 // transitioning between two Web UI pages: the RFH won't be swapped, so the | |
760 // pending pointer will be unused, but there will be a pending Web UI | |
761 // associated with the navigation. | |
762 // Note: This is not used in PlzNavigate. | |
763 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; | 745 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; |
764 | 746 |
765 // If a pending request needs to be transferred to another process, this | 747 // If a pending request needs to be transferred to another process, this |
766 // owns the request until it's transferred to the new process, so it will be | 748 // owns the request until it's transferred to the new process, so it will be |
767 // cleaned up if the navigation is cancelled. Otherwise, this is NULL. | 749 // cleaned up if the navigation is cancelled. Otherwise, this is NULL. |
768 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request_; | 750 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request_; |
769 | 751 |
770 // This is used to temporarily store the NavigationHandle during | 752 // This is used to temporarily store the NavigationHandle during |
771 // transferring navigations. The handle needs to be stored because the old | 753 // transferring navigations. The handle needs to be stored because the old |
772 // RenderFrameHost may be discarded before a new RenderFrameHost is created | 754 // RenderFrameHost may be discarded before a new RenderFrameHost is created |
773 // for the navigation. | 755 // for the navigation. |
774 // PlzNavigate: this will never be set since there are no transferring | 756 // PlzNavigate: this will never be set since there are no transferring |
775 // navigations in PlzNavigate. | 757 // navigations in PlzNavigate. |
776 scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_; | 758 scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_; |
777 | 759 |
778 // If either of these is non-NULL, the pending navigation is to a chrome: | |
779 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is | |
780 // used for when they reference the same object. If either is non-NULL, the | |
781 // other should be NULL. | |
782 // Note: These are not used in PlzNavigate. | |
783 scoped_ptr<WebUIImpl> pending_web_ui_; | |
784 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; | |
785 | |
786 class RenderFrameProxyHostMap; | 760 class RenderFrameProxyHostMap; |
787 scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_; | 761 scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_; |
788 | 762 |
789 // A list of RenderFrameHosts waiting to shut down after swapping out. We use | 763 // A list of RenderFrameHosts waiting to shut down after swapping out. We use |
790 // a linked list since we expect frequent deletes and no indexed access, and | 764 // a linked list since we expect frequent deletes and no indexed access, and |
791 // because sets don't appear to support linked_ptrs. | 765 // because sets don't appear to support linked_ptrs. |
792 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList; | 766 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList; |
793 RFHPendingDeleteList pending_delete_hosts_; | 767 RFHPendingDeleteList pending_delete_hosts_; |
794 | 768 |
795 // The intersitial page currently shown if any, not own by this class | 769 // The intersitial page currently shown if any, not own by this class |
796 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 770 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
797 InterstitialPageImpl* interstitial_page_; | 771 InterstitialPageImpl* interstitial_page_; |
798 | 772 |
799 // PlzNavigate | 773 // PlzNavigate |
800 // These members store a speculative RenderFrameHost and WebUI. They are | 774 // Stores a speculative RenderFrameHost which is created early in a navigation |
801 // created early in a navigation so a renderer process can be started in | 775 // so a renderer process can be started in parallel, if needed. |
802 // parallel, if needed. This is purely a performance optimization and is not | 776 // This is purely a performance optimization and is not required for correct |
803 // required for correct behavior. The created RenderFrameHost might be | 777 // behavior. The speculative RenderFrameHost might be discarded later on if |
804 // discarded later on if the final URL's SiteInstance isn't compatible with | 778 // the final URL's SiteInstance isn't compatible with the one used to create |
805 // what was used to create it. | 779 // it. |
806 // Note: PlzNavigate only uses speculative RenderFrameHost and WebUI, not | 780 // Note: PlzNavigate only uses the speculative RenderFrameHost, not the |
807 // the pending ones. | 781 // pending one. |
808 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; | 782 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; |
809 scoped_ptr<WebUIImpl> speculative_web_ui_; | |
810 | |
811 // PlzNavigate | |
812 // If true at navigation commit time the current WebUI will be kept instead of | |
813 // creating a new one. | |
814 bool should_reuse_web_ui_; | |
815 | 783 |
816 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 784 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
817 | 785 |
818 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 786 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
819 }; | 787 }; |
820 | 788 |
821 } // namespace content | 789 } // namespace content |
822 | 790 |
823 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 791 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |