| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // SiteInstance. Returns nullptr if this WebContents isn't part of inner/outer | 231 // SiteInstance. Returns nullptr if this WebContents isn't part of inner/outer |
| 239 // relationship. | 232 // relationship. |
| 240 RenderFrameProxyHost* GetProxyToOuterDelegate(); | 233 RenderFrameProxyHost* GetProxyToOuterDelegate(); |
| 241 | 234 |
| 242 // Removes the FrameTreeNode in the outer WebContents that represents this | 235 // Removes the FrameTreeNode in the outer WebContents that represents this |
| 243 // FrameTreeNode. | 236 // FrameTreeNode. |
| 244 // TODO(lazyboy): This does not belong to RenderFrameHostManager, move it to | 237 // TODO(lazyboy): This does not belong to RenderFrameHostManager, move it to |
| 245 // somehwere else. | 238 // somehwere else. |
| 246 void RemoveOuterDelegateFrame(); | 239 void RemoveOuterDelegateFrame(); |
| 247 | 240 |
| 248 // Returns the pending RenderFrameHost, or NULL if there is no pending one. | 241 // Returns the pending RenderFrameHost, or null if there is no pending one. |
| 249 RenderFrameHostImpl* pending_frame_host() const { | 242 RenderFrameHostImpl* pending_frame_host() const { |
| 250 return pending_render_frame_host_.get(); | 243 return pending_render_frame_host_.get(); |
| 251 } | 244 } |
| 252 | 245 |
| 253 // Returns the speculative RenderFrameHost, or null if there is no speculative | 246 // Returns the speculative RenderFrameHost, or null if there is no speculative |
| 254 // one. | 247 // one. |
| 255 RenderFrameHostImpl* speculative_frame_host() const { | 248 RenderFrameHostImpl* speculative_frame_host() const { |
| 256 return speculative_render_frame_host_.get(); | 249 return speculative_render_frame_host_.get(); |
| 257 } | 250 } |
| 258 | 251 |
| 259 // TODO(creis): Remove this when we no longer use RVH for navigation. | 252 // TODO(creis): Remove this when we no longer use RVH for navigation. |
| 260 RenderViewHostImpl* pending_render_view_host() const; | 253 RenderViewHostImpl* pending_render_view_host() const; |
| 261 | 254 |
| 262 // Returns the current committed Web UI or NULL if none applies. | 255 // Returns the current committed WebUI or null if none applies. |
| 263 WebUIImpl* web_ui() const { return web_ui_.get(); } | 256 WebUIImpl* web_ui() const { return render_frame_host_->web_ui(); } |
| 264 | 257 |
| 265 // Returns the Web UI for the pending navigation, or NULL of none applies. | 258 // Returns the pending WebUI for the ongoing navigation: either a newly |
| 266 WebUIImpl* pending_web_ui() const { | 259 // created one, the current one (if it should be reused) of null if none |
| 267 return pending_web_ui_.get() ? pending_web_ui_.get() : | 260 // applies. |
| 268 pending_and_current_web_ui_.get(); | 261 // PlzNavigate: Returns the speculative WebUI for the ongoing navigation. |
| 269 } | 262 WebUIImpl* pending_web_ui() const; |
| 270 | |
| 271 // PlzNavigate | |
| 272 // Returns the speculative WebUI for the navigation (a newly created one or | |
| 273 // the current one if it should be reused). If none is set returns nullptr. | |
| 274 WebUIImpl* speculative_web_ui() const { | |
| 275 return should_reuse_web_ui_ ? web_ui_.get() : speculative_web_ui_.get(); | |
| 276 } | |
| 277 | 263 |
| 278 // Called when we want to instruct the renderer to navigate to the given | 264 // Called when we want to instruct the renderer to navigate to the given |
| 279 // navigation entry. It may create a new RenderFrameHost or re-use an existing | 265 // navigation entry. It may create a new RenderFrameHost or re-use an existing |
| 280 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one | 266 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one |
| 281 // could not be created. |dest_url| takes precedence over the |frame_entry|'s | 267 // could not be created. |dest_url| takes precedence over the |frame_entry|'s |
| 282 // url (this is necessary because ReloadOriginalRequest navigates to a | 268 // url (this is necessary because ReloadOriginalRequest navigates to a |
| 283 // different URL than the last committed entry, without modifying it). | 269 // different URL than the last committed entry, without modifying it). |
| 284 RenderFrameHostImpl* Navigate(const GURL& dest_url, | 270 RenderFrameHostImpl* Navigate(const GURL& dest_url, |
| 285 const FrameNavigationEntry& frame_entry, | 271 const FrameNavigationEntry& frame_entry, |
| 286 const NavigationEntryImpl& entry); | 272 const NavigationEntryImpl& entry); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 328 |
| 343 // Called when this frame's opener is changed to the frame specified by | 329 // Called when this frame's opener is changed to the frame specified by |
| 344 // |opener_routing_id| in |source_site_instance|'s process. This change | 330 // |opener_routing_id| in |source_site_instance|'s process. This change |
| 345 // could come from either the current RenderFrameHost or one of the | 331 // could come from either the current RenderFrameHost or one of the |
| 346 // proxies (e.g., window.open that targets a RemoteFrame by name). The | 332 // proxies (e.g., window.open that targets a RemoteFrame by name). The |
| 347 // updated opener will be forwarded to any other RenderFrameProxies and | 333 // updated opener will be forwarded to any other RenderFrameProxies and |
| 348 // RenderFrames for this FrameTreeNode. | 334 // RenderFrames for this FrameTreeNode. |
| 349 void DidChangeOpener(int opener_routing_id, | 335 void DidChangeOpener(int opener_routing_id, |
| 350 SiteInstance* source_site_instance); | 336 SiteInstance* source_site_instance); |
| 351 | 337 |
| 352 // Sets the pending Web UI for the pending navigation, ensuring that the | 338 // Creates and initializes a RenderFrameHost. If |flags| has the |
| 353 // bindings are appropriate compared to |bindings|. | |
| 354 void SetPendingWebUI(const GURL& url, int bindings); | |
| 355 | |
| 356 // Creates and initializes a RenderFrameHost. The |web_ui| is an optional | |
| 357 // input parameter used to double check bindings when swapping back in a | |
| 358 // previously existing RenderFrameHost. If |flags| has the | |
| 359 // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will | 339 // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will |
| 360 // initially be placed on the swapped out hosts list. If |view_routing_id_ptr| | 340 // initially be placed on the swapped out hosts list. If |view_routing_id_ptr| |
| 361 // is not nullptr it will be set to the routing id of the view associated with | 341 // is not nullptr it will be set to the routing id of the view associated with |
| 362 // the frame. | 342 // the frame. |
| 363 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, | 343 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, |
| 364 WebUIImpl* web_ui, | |
| 365 int flags, | 344 int flags, |
| 366 int* view_routing_id_ptr); | 345 int* view_routing_id_ptr); |
| 367 | 346 |
| 368 // Helper method to create and initialize a RenderFrameProxyHost and return | 347 // Helper method to create and initialize a RenderFrameProxyHost and return |
| 369 // its routing id. | 348 // its routing id. |
| 370 int CreateRenderFrameProxy(SiteInstance* instance); | 349 int CreateRenderFrameProxy(SiteInstance* instance); |
| 371 | 350 |
| 372 // Creates proxies for a new child frame at FrameTreeNode |child| in all | 351 // Creates proxies for a new child frame at FrameTreeNode |child| in all |
| 373 // SiteInstances for which the current frame has proxies. This method is | 352 // SiteInstances for which the current frame has proxies. This method is |
| 374 // called on the parent of a new child frame before the child leaves the | 353 // 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... |
| 557 // SiteInstance's site and when we later call IsSameWebSite. If there is no | 536 // SiteInstance's site and when we later call IsSameWebSite. If there is no |
| 558 // current NavigationEntry, check the current SiteInstance's site, which might | 537 // current NavigationEntry, check the current SiteInstance's site, which might |
| 559 // already be committed to a Web UI URL (such as the NTP). | 538 // already be committed to a Web UI URL (such as the NTP). |
| 560 bool ShouldSwapBrowsingInstancesForNavigation( | 539 bool ShouldSwapBrowsingInstancesForNavigation( |
| 561 const GURL& current_effective_url, | 540 const GURL& current_effective_url, |
| 562 bool current_is_view_source_mode, | 541 bool current_is_view_source_mode, |
| 563 SiteInstance* new_site_instance, | 542 SiteInstance* new_site_instance, |
| 564 const GURL& new_effective_url, | 543 const GURL& new_effective_url, |
| 565 bool new_is_view_source_mode) const; | 544 bool new_is_view_source_mode) const; |
| 566 | 545 |
| 567 // Creates a new Web UI, ensuring that the bindings are appropriate compared | |
| 568 // to |bindings|. | |
| 569 scoped_ptr<WebUIImpl> CreateWebUI(const GURL& url, int bindings); | |
| 570 | |
| 571 // Returns true if it is safe to reuse the current WebUI when navigating from | |
| 572 // |current_entry| to |new_url|. | |
| 573 bool ShouldReuseWebUI( | |
| 574 const NavigationEntry* current_entry, | |
| 575 const GURL& new_url) const; | |
| 576 | |
| 577 // Returns the SiteInstance to use for the navigation. | 546 // Returns the SiteInstance to use for the navigation. |
| 578 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, | 547 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, |
| 579 SiteInstance* source_instance, | 548 SiteInstance* source_instance, |
| 580 SiteInstance* dest_instance, | 549 SiteInstance* dest_instance, |
| 581 SiteInstance* candidate_instance, | 550 SiteInstance* candidate_instance, |
| 582 ui::PageTransition transition, | 551 ui::PageTransition transition, |
| 583 bool dest_is_restore, | 552 bool dest_is_restore, |
| 584 bool dest_is_view_source_mode); | 553 bool dest_is_view_source_mode); |
| 585 | 554 |
| 586 // Returns a descriptor of the appropriate SiteInstance object for the given | 555 // Returns a descriptor of the appropriate SiteInstance object for the given |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 FrameTreeNode* skip_this_node); | 622 FrameTreeNode* skip_this_node); |
| 654 | 623 |
| 655 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. | 624 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. |
| 656 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, | 625 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, |
| 657 int32 view_routing_id, | 626 int32 view_routing_id, |
| 658 int32 frame_routing_id, | 627 int32 frame_routing_id, |
| 659 int32 widget_routing_id, | 628 int32 widget_routing_id, |
| 660 int flags); | 629 int flags); |
| 661 | 630 |
| 662 // PlzNavigate | 631 // PlzNavigate |
| 663 // Creates and initializes a speculative RenderFrameHost and/or WebUI for an | 632 // Create and initialize a speculative RenderFrameHost for an ongoing |
| 664 // ongoing navigation. They might be destroyed and re-created later if the | 633 // navigation. It might be destroyed and re-created later if the navigation |
| 665 // navigation is redirected to a different SiteInstance. | 634 // is redirected to a different SiteInstance. |
| 666 bool CreateSpeculativeRenderFrameHost(const GURL& url, | 635 bool CreateSpeculativeRenderFrameHost(SiteInstance* old_instance, |
| 667 SiteInstance* old_instance, | 636 SiteInstance* new_instance); |
| 668 SiteInstance* new_instance, | |
| 669 int bindings); | |
| 670 | 637 |
| 671 // Sets up the necessary state for a new RenderViewHost. If |proxy| is not | 638 // Sets up the necessary state for a new RenderViewHost. If |proxy| is not |
| 672 // null, it creates a RenderFrameProxy in the target renderer process which is | 639 // null, it creates a RenderFrameProxy in the target renderer process which is |
| 673 // used to route IPC messages when in swapped out state. Returns early if the | 640 // used to route IPC messages when in swapped out state. Returns early if the |
| 674 // RenderViewHost has already been initialized for another RenderFrameHost. | 641 // RenderViewHost has already been initialized for another RenderFrameHost. |
| 675 bool InitRenderView(RenderViewHostImpl* render_view_host, | 642 bool InitRenderView(RenderViewHostImpl* render_view_host, |
| 676 RenderFrameProxyHost* proxy); | 643 RenderFrameProxyHost* proxy); |
| 677 | 644 |
| 678 // Initialization for RenderFrameHost uses the same sequence as InitRenderView | 645 // Initialization for RenderFrameHost uses the same sequence as InitRenderView |
| 679 // above. | 646 // above. |
| 680 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); | 647 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); |
| 681 | 648 |
| 682 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this | 649 // Sets the pending RenderFrameHost to be the active one. Note that if the |
| 683 // doesn't require the pending render_frame_host_ pointer to be non-NULL, | 650 // current one is being reused this method might switch its WebUI if there is |
| 684 // since there could be Web UI switching as well. Call this for every commit. | 651 // a pending one. Call this for every commit. |
| 685 // If PlzNavigate is enabled the method will set the speculative (not pending) | 652 // If PlzNavigate is enabled the method will set the speculative (not pending) |
| 686 // RenderFrameHost to be the active one. | 653 // RenderFrameHost to be the active one. |
| 687 void CommitPending(); | 654 void CommitPending(); |
| 688 | 655 |
| 689 // Helper to call CommitPending() in all necessary cases. | 656 // Helper to call CommitPending() in all necessary cases. |
| 690 void CommitPendingIfNecessary(RenderFrameHostImpl* render_frame_host, | 657 void CommitPendingIfNecessary(RenderFrameHostImpl* render_frame_host, |
| 691 bool was_caused_by_user_gesture); | 658 bool was_caused_by_user_gesture); |
| 692 | 659 |
| 693 // Commits any pending sandbox flag updates when the renderer's frame | 660 // Commits any pending sandbox flag updates when the renderer's frame |
| 694 // navigates. | 661 // navigates. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 ui::PageTransition transition, | 701 ui::PageTransition transition, |
| 735 bool dest_is_restore, | 702 bool dest_is_restore, |
| 736 bool dest_is_view_source_mode, | 703 bool dest_is_view_source_mode, |
| 737 const GlobalRequestID& transferred_request_id, | 704 const GlobalRequestID& transferred_request_id, |
| 738 int bindings); | 705 int bindings); |
| 739 | 706 |
| 740 // Called when a renderer process is starting to close. We should not | 707 // Called when a renderer process is starting to close. We should not |
| 741 // schedule new navigations in its swapped out RenderFrameHosts after this. | 708 // schedule new navigations in its swapped out RenderFrameHosts after this. |
| 742 void RendererProcessClosing(RenderProcessHost* render_process_host); | 709 void RendererProcessClosing(RenderProcessHost* render_process_host); |
| 743 | 710 |
| 711 // Checks that the current navigation case justifies a WebUI change that just |
| 712 // happened in the current RenderFrameHost. |
| 713 bool IsAcceptableWebUITransition(WebUI::TypeID previous_web_ui_type, |
| 714 const GURL& dest_url, |
| 715 bool dest_is_restore); |
| 716 |
| 744 // For use in creating RenderFrameHosts. | 717 // For use in creating RenderFrameHosts. |
| 745 FrameTreeNode* frame_tree_node_; | 718 FrameTreeNode* frame_tree_node_; |
| 746 | 719 |
| 747 // Our delegate, not owned by us. Guaranteed non-NULL. | 720 // Our delegate, not owned by us. Guaranteed non-NULL. |
| 748 Delegate* delegate_; | 721 Delegate* delegate_; |
| 749 | 722 |
| 750 // Implemented by the owner of this class. These delegates are installed into | 723 // Implemented by the owner of this class. These delegates are installed into |
| 751 // all the RenderFrameHosts that we create. | 724 // all the RenderFrameHosts that we create. |
| 752 RenderFrameHostDelegate* render_frame_delegate_; | 725 RenderFrameHostDelegate* render_frame_delegate_; |
| 753 RenderViewHostDelegate* render_view_delegate_; | 726 RenderViewHostDelegate* render_view_delegate_; |
| 754 RenderWidgetHostDelegate* render_widget_delegate_; | 727 RenderWidgetHostDelegate* render_widget_delegate_; |
| 755 | 728 |
| 756 // Our RenderFrameHost and its associated Web UI (if any, will be NULL for | 729 // Our RenderFrameHost which is responsible for all communication with a child |
| 757 // non-WebUI pages). This object is responsible for all communication with | 730 // RenderFrame instance. |
| 758 // a child RenderFrame instance. | |
| 759 // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive. | 731 // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive. |
| 760 // Eventually, RenderViewHost will be replaced with a page context. | 732 // Eventually, RenderViewHost will be replaced with a page context. |
| 761 scoped_ptr<RenderFrameHostImpl> render_frame_host_; | 733 scoped_ptr<RenderFrameHostImpl> render_frame_host_; |
| 762 scoped_ptr<WebUIImpl> web_ui_; | |
| 763 | 734 |
| 764 // A RenderFrameHost used to load a cross-site page. This remains hidden | 735 // A RenderFrameHost used to load a cross-site page. This remains hidden |
| 765 // while a cross-site request is pending until it calls DidNavigate. It may | 736 // while a cross-site request is pending until it calls DidNavigate. |
| 766 // have an associated Web UI, in which case the Web UI pointer will be non- | 737 // Note: This member is not used in PlzNavigate. |
| 767 // NULL. | |
| 768 // | |
| 769 // The |pending_web_ui_| may be non-NULL even when the | |
| 770 // |pending_render_frame_host_| is NULL. This will happen when we're | |
| 771 // transitioning between two Web UI pages: the RFH won't be swapped, so the | |
| 772 // pending pointer will be unused, but there will be a pending Web UI | |
| 773 // associated with the navigation. | |
| 774 // Note: This is not used in PlzNavigate. | |
| 775 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; | 738 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; |
| 776 | 739 |
| 777 // If a pending request needs to be transferred to another process, this | 740 // If a pending request needs to be transferred to another process, this |
| 778 // owns the request until it's transferred to the new process, so it will be | 741 // owns the request until it's transferred to the new process, so it will be |
| 779 // cleaned up if the navigation is cancelled. Otherwise, this is NULL. | 742 // cleaned up if the navigation is cancelled. Otherwise, this is NULL. |
| 780 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request_; | 743 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request_; |
| 781 | 744 |
| 782 // This is used to temporarily store the NavigationHandle during | 745 // This is used to temporarily store the NavigationHandle during |
| 783 // transferring navigations. The handle needs to be stored because the old | 746 // transferring navigations. The handle needs to be stored because the old |
| 784 // RenderFrameHost may be discarded before a new RenderFrameHost is created | 747 // RenderFrameHost may be discarded before a new RenderFrameHost is created |
| 785 // for the navigation. | 748 // for the navigation. |
| 786 // PlzNavigate: this will never be set since there are no transferring | 749 // PlzNavigate: this will never be set since there are no transferring |
| 787 // navigations in PlzNavigate. | 750 // navigations in PlzNavigate. |
| 788 scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_; | 751 scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_; |
| 789 | 752 |
| 790 // If either of these is non-NULL, the pending navigation is to a chrome: | |
| 791 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is | |
| 792 // used for when they reference the same object. If either is non-NULL, the | |
| 793 // other should be NULL. | |
| 794 // Note: These are not used in PlzNavigate. | |
| 795 scoped_ptr<WebUIImpl> pending_web_ui_; | |
| 796 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; | |
| 797 | |
| 798 class RenderFrameProxyHostMap; | 753 class RenderFrameProxyHostMap; |
| 799 scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_; | 754 scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_; |
| 800 | 755 |
| 801 // A list of RenderFrameHosts waiting to shut down after swapping out. We use | 756 // A list of RenderFrameHosts waiting to shut down after swapping out. We use |
| 802 // a linked list since we expect frequent deletes and no indexed access, and | 757 // a linked list since we expect frequent deletes and no indexed access, and |
| 803 // because sets don't appear to support linked_ptrs. | 758 // because sets don't appear to support linked_ptrs. |
| 804 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList; | 759 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList; |
| 805 RFHPendingDeleteList pending_delete_hosts_; | 760 RFHPendingDeleteList pending_delete_hosts_; |
| 806 | 761 |
| 807 // The intersitial page currently shown if any, not own by this class | 762 // The intersitial page currently shown if any, not own by this class |
| 808 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 763 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
| 809 InterstitialPageImpl* interstitial_page_; | 764 InterstitialPageImpl* interstitial_page_; |
| 810 | 765 |
| 811 // PlzNavigate | 766 // PlzNavigate |
| 812 // These members store a speculative RenderFrameHost and WebUI. They are | 767 // Stores a speculative RenderFrameHost which is created early in a navigation |
| 813 // created early in a navigation so a renderer process can be started in | 768 // so a renderer process can be started in parallel, if needed. |
| 814 // parallel, if needed. This is purely a performance optimization and is not | 769 // This is purely a performance optimization and is not required for correct |
| 815 // required for correct behavior. The created RenderFrameHost might be | 770 // behavior. The speculative RenderFrameHost might be discarded later on if |
| 816 // discarded later on if the final URL's SiteInstance isn't compatible with | 771 // the final URL's SiteInstance isn't compatible with the one used to create |
| 817 // what was used to create it. | 772 // it. |
| 818 // Note: PlzNavigate only uses speculative RenderFrameHost and WebUI, not | 773 // Note: PlzNavigate only uses the speculative RenderFrameHost, not the |
| 819 // the pending ones. | 774 // pending one. |
| 820 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; | 775 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; |
| 821 scoped_ptr<WebUIImpl> speculative_web_ui_; | |
| 822 | 776 |
| 823 // PlzNavigate | |
| 824 // If true at navigation commit time the current WebUI will be kept instead of | 777 // If true at navigation commit time the current WebUI will be kept instead of |
| 825 // creating a new one. | 778 // creating a new one. |
| 826 bool should_reuse_web_ui_; | 779 bool should_reuse_web_ui_; |
| 827 | 780 |
| 828 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 781 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
| 829 | 782 |
| 830 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 783 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
| 831 }; | 784 }; |
| 832 | 785 |
| 833 } // namespace content | 786 } // namespace content |
| 834 | 787 |
| 835 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 788 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
| OLD | NEW |