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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 338 |
344 // Called when this frame's opener is changed to the frame specified by | 339 // Called when this frame's opener is changed to the frame specified by |
345 // |opener_routing_id| in |source_site_instance|'s process. This change | 340 // |opener_routing_id| in |source_site_instance|'s process. This change |
346 // could come from either the current RenderFrameHost or one of the | 341 // could come from either the current RenderFrameHost or one of the |
347 // proxies (e.g., window.open that targets a RemoteFrame by name). The | 342 // proxies (e.g., window.open that targets a RemoteFrame by name). The |
348 // updated opener will be forwarded to any other RenderFrameProxies and | 343 // updated opener will be forwarded to any other RenderFrameProxies and |
349 // RenderFrames for this FrameTreeNode. | 344 // RenderFrames for this FrameTreeNode. |
350 void DidChangeOpener(int opener_routing_id, | 345 void DidChangeOpener(int opener_routing_id, |
351 SiteInstance* source_site_instance); | 346 SiteInstance* source_site_instance); |
352 | 347 |
353 // Sets the pending Web UI for the pending navigation, ensuring that the | 348 // Creates and initializes a RenderFrameHost. If |flags| has the |
354 // bindings are appropriate compared to |bindings|. | |
355 void SetPendingWebUI(const GURL& url, int bindings); | |
356 | |
357 // Creates and initializes a RenderFrameHost. The |web_ui| is an optional | |
358 // input parameter used to double check bindings when swapping back in a | |
359 // previously existing RenderFrameHost. If |flags| has the | |
360 // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will | 349 // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will |
361 // initially be placed on the swapped out hosts list. If |view_routing_id_ptr| | 350 // initially be placed on the swapped out hosts list. If |view_routing_id_ptr| |
362 // is not nullptr it will be set to the routing id of the view associated with | 351 // is not nullptr it will be set to the routing id of the view associated with |
363 // the frame. | 352 // the frame. |
364 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, | 353 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, |
365 WebUIImpl* web_ui, | |
366 int flags, | 354 int flags, |
367 int* view_routing_id_ptr); | 355 int* view_routing_id_ptr); |
368 | 356 |
369 // Helper method to create and initialize a RenderFrameProxyHost and return | 357 // Helper method to create and initialize a RenderFrameProxyHost and return |
370 // its routing id. | 358 // its routing id. |
371 int CreateRenderFrameProxy(SiteInstance* instance); | 359 int CreateRenderFrameProxy(SiteInstance* instance); |
372 | 360 |
373 // Creates proxies for a new child frame at FrameTreeNode |child| in all | 361 // Creates proxies for a new child frame at FrameTreeNode |child| in all |
374 // SiteInstances for which the current frame has proxies. This method is | 362 // SiteInstances for which the current frame has proxies. This method is |
375 // called on the parent of a new child frame before the child leaves the | 363 // 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... |
558 // SiteInstance's site and when we later call IsSameWebSite. If there is no | 546 // SiteInstance's site and when we later call IsSameWebSite. If there is no |
559 // current NavigationEntry, check the current SiteInstance's site, which might | 547 // current NavigationEntry, check the current SiteInstance's site, which might |
560 // already be committed to a Web UI URL (such as the NTP). | 548 // already be committed to a Web UI URL (such as the NTP). |
561 bool ShouldSwapBrowsingInstancesForNavigation( | 549 bool ShouldSwapBrowsingInstancesForNavigation( |
562 const GURL& current_effective_url, | 550 const GURL& current_effective_url, |
563 bool current_is_view_source_mode, | 551 bool current_is_view_source_mode, |
564 SiteInstance* new_site_instance, | 552 SiteInstance* new_site_instance, |
565 const GURL& new_effective_url, | 553 const GURL& new_effective_url, |
566 bool new_is_view_source_mode) const; | 554 bool new_is_view_source_mode) const; |
567 | 555 |
568 // Creates a new Web UI, ensuring that the bindings are appropriate compared | |
569 // to |bindings|. | |
570 scoped_ptr<WebUIImpl> CreateWebUI(const GURL& url, int bindings); | |
571 | |
572 // Returns true if it is safe to reuse the current WebUI when navigating from | |
573 // |current_entry| to |new_url|. | |
574 bool ShouldReuseWebUI( | |
575 const NavigationEntry* current_entry, | |
576 const GURL& new_url) const; | |
577 | |
578 // Returns the SiteInstance to use for the navigation. | 556 // Returns the SiteInstance to use for the navigation. |
579 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, | 557 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, |
580 SiteInstance* source_instance, | 558 SiteInstance* source_instance, |
581 SiteInstance* dest_instance, | 559 SiteInstance* dest_instance, |
582 SiteInstance* candidate_instance, | 560 SiteInstance* candidate_instance, |
583 ui::PageTransition transition, | 561 ui::PageTransition transition, |
584 bool dest_is_restore, | 562 bool dest_is_restore, |
585 bool dest_is_view_source_mode); | 563 bool dest_is_view_source_mode); |
586 | 564 |
587 // Returns a descriptor of the appropriate SiteInstance object for the given | 565 // Returns a descriptor of the appropriate SiteInstance object for the given |
(...skipping 25 matching lines...) Expand all Loading... |
613 // description, it is returned as is. | 591 // description, it is returned as is. |
614 SiteInstance* ConvertToSiteInstance(const SiteInstanceDescriptor& descriptor, | 592 SiteInstance* ConvertToSiteInstance(const SiteInstanceDescriptor& descriptor, |
615 SiteInstance* candidate_instance); | 593 SiteInstance* candidate_instance); |
616 | 594 |
617 // Determines the appropriate url to use as the current url for SiteInstance | 595 // Determines the appropriate url to use as the current url for SiteInstance |
618 // selection. | 596 // selection. |
619 const GURL& GetCurrentURLForSiteInstance( | 597 const GURL& GetCurrentURLForSiteInstance( |
620 SiteInstance* current_instance, | 598 SiteInstance* current_instance, |
621 NavigationEntry* current_entry); | 599 NavigationEntry* current_entry); |
622 | 600 |
| 601 // This is the private version of CreateRenderFrame that also allows the |
| 602 // caller to specify a URL and bindings for the potential setup of a WebUI. |
| 603 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameInternal( |
| 604 SiteInstance* instance, |
| 605 const GURL& url, |
| 606 int bindings, |
| 607 int flags, |
| 608 int* view_routing_id_ptr); |
| 609 |
623 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to | 610 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to |
624 // |pending_render_frame_host_| while respecting the opener route if needed | 611 // |pending_render_frame_host_| while respecting the opener route if needed |
625 // and stores it in pending_render_frame_host_. | 612 // and stores it in pending_render_frame_host_. |
626 void CreatePendingRenderFrameHost(SiteInstance* old_instance, | 613 void CreatePendingRenderFrameHost(SiteInstance* old_instance, |
627 SiteInstance* new_instance); | 614 SiteInstance* new_instance, |
| 615 const GURL& url, |
| 616 int bindings); |
628 | 617 |
629 // Ensure that we have created all needed proxies for a new RFH with | 618 // Ensure that we have created all needed proxies for a new RFH with |
630 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for | 619 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for |
631 // the new RFH's opener chain if we are staying in the same BrowsingInstance; | 620 // the new RFH's opener chain if we are staying in the same BrowsingInstance; |
632 // (2) Create proxies for the new RFH's SiteInstance in its own frame tree. | 621 // (2) Create proxies for the new RFH's SiteInstance in its own frame tree. |
633 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance, | 622 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance, |
634 SiteInstance* new_instance); | 623 SiteInstance* new_instance); |
635 | 624 |
636 // Traverse the opener chain and populate |opener_frame_trees| with | 625 // Traverse the opener chain and populate |opener_frame_trees| with |
637 // all FrameTrees accessible by following frame openers of nodes in the | 626 // all FrameTrees accessible by following frame openers of nodes in the |
(...skipping 13 matching lines...) Expand all Loading... |
651 // opener chain. Don't create proxies for the subtree rooted at | 640 // opener chain. Don't create proxies for the subtree rooted at |
652 // |skip_this_node|. | 641 // |skip_this_node|. |
653 void CreateOpenerProxiesForFrameTree(SiteInstance* instance, | 642 void CreateOpenerProxiesForFrameTree(SiteInstance* instance, |
654 FrameTreeNode* skip_this_node); | 643 FrameTreeNode* skip_this_node); |
655 | 644 |
656 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. | 645 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. |
657 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, | 646 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, |
658 int32 view_routing_id, | 647 int32 view_routing_id, |
659 int32 frame_routing_id, | 648 int32 frame_routing_id, |
660 int32 widget_routing_id, | 649 int32 widget_routing_id, |
661 int flags); | 650 int flags, |
| 651 const GURL& dest_url, |
| 652 int entry_bindings); |
662 | 653 |
663 // PlzNavigate | 654 // PlzNavigate |
664 // Creates and initializes a speculative RenderFrameHost and/or WebUI for an | 655 // Creates and initializes a speculative RenderFrameHost for an ongoing |
665 // ongoing navigation. They might be destroyed and re-created later if the | 656 // navigation. They might be destroyed and re-created later if the navigation |
666 // navigation is redirected to a different SiteInstance. | 657 // is redirected to a different SiteInstance. |
667 bool CreateSpeculativeRenderFrameHost(const GURL& url, | 658 bool CreateSpeculativeRenderFrameHost(const GURL& url, |
668 SiteInstance* old_instance, | 659 SiteInstance* old_instance, |
669 SiteInstance* new_instance, | 660 SiteInstance* new_instance, |
670 int bindings); | 661 int bindings); |
671 | 662 |
672 // Sets up the necessary state for a new RenderViewHost. Creates a | 663 // Sets up the necessary state for a new RenderViewHost. Creates a |
673 // RenderFrameProxy in the target renderer process with the given | 664 // RenderFrameProxy in the target renderer process with the given |
674 // |proxy_routing_id|, which is used to route IPC messages when in swapped | 665 // |proxy_routing_id|, which is used to route IPC messages when in swapped |
675 // out state. Returns early if the RenderViewHost has already been | 666 // out state. Returns early if the RenderViewHost has already been |
676 // initialized for another RenderFrameHost. | 667 // initialized for another RenderFrameHost. |
677 bool InitRenderView(RenderViewHostImpl* render_view_host, | 668 bool InitRenderView(RenderViewHostImpl* render_view_host, |
678 int proxy_routing_id); | 669 int proxy_routing_id, |
| 670 WebUIImpl* dest_web_ui); |
679 | 671 |
680 // Initialization for RenderFrameHost uses the same sequence as InitRenderView | 672 // Initialization for RenderFrameHost uses the same sequence as InitRenderView |
681 // above. | 673 // above. |
682 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); | 674 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); |
683 | 675 |
684 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this | 676 // Sets the pending RenderFrameHost to be the active one. Note that if the |
685 // doesn't require the pending render_frame_host_ pointer to be non-NULL, | 677 // current one is being reused this method might switch its WebUI if there is |
686 // since there could be Web UI switching as well. Call this for every commit. | 678 // a pending one. Call this for every commit. |
687 // If PlzNavigate is enabled the method will set the speculative (not pending) | 679 // If PlzNavigate is enabled the method will set the speculative (not pending) |
688 // RenderFrameHost to be the active one. | 680 // RenderFrameHost to be the active one. |
689 void CommitPending(); | 681 void CommitPending(); |
690 | 682 |
691 // Helper to call CommitPending() in all necessary cases. | 683 // Helper to call CommitPending() in all necessary cases. |
692 void CommitPendingIfNecessary(RenderFrameHostImpl* render_frame_host, | 684 void CommitPendingIfNecessary(RenderFrameHostImpl* render_frame_host, |
693 bool was_caused_by_user_gesture); | 685 bool was_caused_by_user_gesture); |
694 | 686 |
695 // Commits any pending sandbox flag updates when the renderer's frame | 687 // Commits any pending sandbox flag updates when the renderer's frame |
696 // navigates. | 688 // navigates. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 | 740 |
749 // Our delegate, not owned by us. Guaranteed non-NULL. | 741 // Our delegate, not owned by us. Guaranteed non-NULL. |
750 Delegate* delegate_; | 742 Delegate* delegate_; |
751 | 743 |
752 // Implemented by the owner of this class. These delegates are installed into | 744 // Implemented by the owner of this class. These delegates are installed into |
753 // all the RenderFrameHosts that we create. | 745 // all the RenderFrameHosts that we create. |
754 RenderFrameHostDelegate* render_frame_delegate_; | 746 RenderFrameHostDelegate* render_frame_delegate_; |
755 RenderViewHostDelegate* render_view_delegate_; | 747 RenderViewHostDelegate* render_view_delegate_; |
756 RenderWidgetHostDelegate* render_widget_delegate_; | 748 RenderWidgetHostDelegate* render_widget_delegate_; |
757 | 749 |
758 // Our RenderFrameHost and its associated Web UI (if any, will be NULL for | 750 // Our RenderFrameHost which is responsible for all communication with a child |
759 // non-WebUI pages). This object is responsible for all communication with | 751 // RenderFrame instance. |
760 // a child RenderFrame instance. | |
761 // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive. | 752 // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive. |
762 // Eventually, RenderViewHost will be replaced with a page context. | 753 // Eventually, RenderViewHost will be replaced with a page context. |
763 scoped_ptr<RenderFrameHostImpl> render_frame_host_; | 754 scoped_ptr<RenderFrameHostImpl> render_frame_host_; |
764 scoped_ptr<WebUIImpl> web_ui_; | |
765 | 755 |
766 // A RenderFrameHost used to load a cross-site page. This remains hidden | 756 // A RenderFrameHost used to load a cross-site page. This remains hidden |
767 // while a cross-site request is pending until it calls DidNavigate. It may | 757 // while a cross-site request is pending until it calls DidNavigate. |
768 // have an associated Web UI, in which case the Web UI pointer will be non- | 758 // Note: This member is not used in PlzNavigate. |
769 // NULL. | |
770 // | |
771 // The |pending_web_ui_| may be non-NULL even when the | |
772 // |pending_render_frame_host_| is NULL. This will happen when we're | |
773 // transitioning between two Web UI pages: the RFH won't be swapped, so the | |
774 // pending pointer will be unused, but there will be a pending Web UI | |
775 // associated with the navigation. | |
776 // Note: This is not used in PlzNavigate. | |
777 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; | 759 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; |
778 | 760 |
779 // If a pending request needs to be transferred to another process, this | 761 // If a pending request needs to be transferred to another process, this |
780 // owns the request until it's transferred to the new process, so it will be | 762 // owns the request until it's transferred to the new process, so it will be |
781 // cleaned up if the navigation is cancelled. Otherwise, this is NULL. | 763 // cleaned up if the navigation is cancelled. Otherwise, this is NULL. |
782 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request_; | 764 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request_; |
783 | 765 |
784 // This is used to temporarily store the NavigationHandle during | 766 // This is used to temporarily store the NavigationHandle during |
785 // transferring navigations. The handle needs to be stored because the old | 767 // transferring navigations. The handle needs to be stored because the old |
786 // RenderFrameHost may be discarded before a new RenderFrameHost is created | 768 // RenderFrameHost may be discarded before a new RenderFrameHost is created |
787 // for the navigation. | 769 // for the navigation. |
788 // PlzNavigate: this will never be set since there are no transferring | 770 // PlzNavigate: this will never be set since there are no transferring |
789 // navigations in PlzNavigate. | 771 // navigations in PlzNavigate. |
790 scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_; | 772 scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_; |
791 | 773 |
792 // If either of these is non-NULL, the pending navigation is to a chrome: | |
793 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is | |
794 // used for when they reference the same object. If either is non-NULL, the | |
795 // other should be NULL. | |
796 // Note: These are not used in PlzNavigate. | |
797 scoped_ptr<WebUIImpl> pending_web_ui_; | |
798 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; | |
799 | |
800 class RenderFrameProxyHostMap; | 774 class RenderFrameProxyHostMap; |
801 scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_; | 775 scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_; |
802 | 776 |
803 // A list of RenderFrameHosts waiting to shut down after swapping out. We use | 777 // A list of RenderFrameHosts waiting to shut down after swapping out. We use |
804 // a linked list since we expect frequent deletes and no indexed access, and | 778 // a linked list since we expect frequent deletes and no indexed access, and |
805 // because sets don't appear to support linked_ptrs. | 779 // because sets don't appear to support linked_ptrs. |
806 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList; | 780 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList; |
807 RFHPendingDeleteList pending_delete_hosts_; | 781 RFHPendingDeleteList pending_delete_hosts_; |
808 | 782 |
809 // The intersitial page currently shown if any, not own by this class | 783 // The intersitial page currently shown if any, not own by this class |
810 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 784 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
811 InterstitialPageImpl* interstitial_page_; | 785 InterstitialPageImpl* interstitial_page_; |
812 | 786 |
813 // PlzNavigate | 787 // PlzNavigate |
814 // These members store a speculative RenderFrameHost and WebUI. They are | 788 // Stores a speculative RenderFrameHost which is created early in a navigation |
815 // created early in a navigation so a renderer process can be started in | 789 // so a renderer process can be started in parallel, if needed. |
816 // parallel, if needed. This is purely a performance optimization and is not | 790 // This is purely a performance optimization and is not required for correct |
817 // required for correct behavior. The created RenderFrameHost might be | 791 // behavior. The speculative RenderFrameHost might be discarded later on if |
818 // discarded later on if the final URL's SiteInstance isn't compatible with | 792 // the final URL's SiteInstance isn't compatible with the one used to create |
819 // what was used to create it. | 793 // it. |
820 // Note: PlzNavigate only uses speculative RenderFrameHost and WebUI, not | 794 // Note: PlzNavigate only uses the speculative RenderFrameHost, not the |
821 // the pending ones. | 795 // pending one. |
822 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; | 796 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; |
823 scoped_ptr<WebUIImpl> speculative_web_ui_; | |
824 | |
825 // PlzNavigate | |
826 // If true at navigation commit time the current WebUI will be kept instead of | |
827 // creating a new one. | |
828 bool should_reuse_web_ui_; | |
829 | 797 |
830 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 798 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
831 | 799 |
832 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 800 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
833 }; | 801 }; |
834 | 802 |
835 } // namespace content | 803 } // namespace content |
836 | 804 |
837 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 805 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |