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