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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // Returns the speculative RenderFrameHost, or null if there is no speculative | 248 // Returns the speculative RenderFrameHost, or null if there is no speculative |
256 // one. | 249 // one. |
257 RenderFrameHostImpl* speculative_frame_host() const { | 250 RenderFrameHostImpl* speculative_frame_host() const { |
258 return speculative_render_frame_host_.get(); | 251 return speculative_render_frame_host_.get(); |
259 } | 252 } |
260 | 253 |
261 // TODO(creis): Remove this when we no longer use RVH for navigation. | 254 // TODO(creis): Remove this when we no longer use RVH for navigation. |
262 RenderViewHostImpl* pending_render_view_host() const; | 255 RenderViewHostImpl* pending_render_view_host() const; |
263 | 256 |
264 // Returns the current committed Web UI or NULL if none applies. | 257 // Returns the current committed Web UI or NULL if none applies. |
265 WebUIImpl* web_ui() const { return web_ui_.get(); } | 258 WebUIImpl* web_ui() const { return render_frame_host_->web_ui(); } |
266 | 259 |
267 // Returns the Web UI for the pending navigation, or NULL of none applies. | 260 // Returns the Web UI for the pending navigation, or NULL of none applies. |
268 WebUIImpl* pending_web_ui() const { | 261 WebUIImpl* pending_web_ui() const { |
269 return pending_web_ui_.get() ? pending_web_ui_.get() : | 262 return pending_render_frame_host_ ? pending_render_frame_host_->web_ui() |
270 pending_and_current_web_ui_.get(); | 263 : render_frame_host_->pending_web_ui(); |
271 } | 264 } |
272 | 265 |
273 // PlzNavigate | 266 // PlzNavigate |
274 // Returns the speculative WebUI for the navigation (a newly created one or | 267 // Returns the speculative WebUI for the navigation (a newly created one or |
275 // the current one if it should be reused). If none is set returns nullptr. | 268 // the current one if it should be reused). If none is set returns nullptr. |
276 WebUIImpl* speculative_web_ui() const { | 269 WebUIImpl* speculative_web_ui() const { |
277 return should_reuse_web_ui_ ? web_ui_.get() : speculative_web_ui_.get(); | 270 return speculative_render_frame_host_ |
| 271 ? speculative_render_frame_host_->web_ui() |
| 272 : render_frame_host_->pending_web_ui(); |
278 } | 273 } |
279 | 274 |
280 // Called when we want to instruct the renderer to navigate to the given | 275 // Called when we want to instruct the renderer to navigate to the given |
281 // navigation entry. It may create a new RenderFrameHost or re-use an existing | 276 // navigation entry. It may create a new RenderFrameHost or re-use an existing |
282 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one | 277 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one |
283 // could not be created. |dest_url| takes precedence over the |frame_entry|'s | 278 // could not be created. |dest_url| takes precedence over the |frame_entry|'s |
284 // url (this is necessary because ReloadOriginalRequest navigates to a | 279 // url (this is necessary because ReloadOriginalRequest navigates to a |
285 // different URL than the last committed entry, without modifying it). | 280 // different URL than the last committed entry, without modifying it). |
286 RenderFrameHostImpl* Navigate(const GURL& dest_url, | 281 RenderFrameHostImpl* Navigate(const GURL& dest_url, |
287 const FrameNavigationEntry& frame_entry, | 282 const FrameNavigationEntry& frame_entry, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 325 |
331 // Called when this frame's opener is changed to the frame specified by | 326 // 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 | 327 // |opener_routing_id| in |source_site_instance|'s process. This change |
333 // could come from either the current RenderFrameHost or one of the | 328 // could come from either the current RenderFrameHost or one of the |
334 // proxies (e.g., window.open that targets a RemoteFrame by name). The | 329 // proxies (e.g., window.open that targets a RemoteFrame by name). The |
335 // updated opener will be forwarded to any other RenderFrameProxies and | 330 // updated opener will be forwarded to any other RenderFrameProxies and |
336 // RenderFrames for this FrameTreeNode. | 331 // RenderFrames for this FrameTreeNode. |
337 void DidChangeOpener(int opener_routing_id, | 332 void DidChangeOpener(int opener_routing_id, |
338 SiteInstance* source_site_instance); | 333 SiteInstance* source_site_instance); |
339 | 334 |
340 // Sets the pending Web UI for the pending navigation, ensuring that the | 335 // Creates and initializes a RenderFrameHost. If |flags| has the |
341 // bindings are appropriate compared to |bindings|. | |
342 void SetPendingWebUI(const GURL& url, int bindings); | |
343 | |
344 // Creates and initializes a RenderFrameHost. The |web_ui| is an optional | |
345 // input parameter used to double check bindings when swapping back in a | |
346 // previously existing RenderFrameHost. If |flags| has the | |
347 // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will | 336 // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will |
348 // initially be placed on the swapped out hosts list. If |view_routing_id_ptr| | 337 // initially be placed on the swapped out hosts list. If |view_routing_id_ptr| |
349 // is not nullptr it will be set to the routing id of the view associated with | 338 // is not nullptr it will be set to the routing id of the view associated with |
350 // the frame. | 339 // the frame. |
351 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, | 340 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, |
352 WebUIImpl* web_ui, | |
353 int flags, | 341 int flags, |
354 int* view_routing_id_ptr); | 342 int* view_routing_id_ptr); |
355 | 343 |
356 // Helper method to create and initialize a RenderFrameProxyHost and return | 344 // Helper method to create and initialize a RenderFrameProxyHost and return |
357 // its routing id. | 345 // its routing id. |
358 int CreateRenderFrameProxy(SiteInstance* instance); | 346 int CreateRenderFrameProxy(SiteInstance* instance); |
359 | 347 |
360 // Creates proxies for a new child frame at FrameTreeNode |child| in all | 348 // Creates proxies for a new child frame at FrameTreeNode |child| in all |
361 // SiteInstances for which the current frame has proxies. This method is | 349 // SiteInstances for which the current frame has proxies. This method is |
362 // called on the parent of a new child frame before the child leaves the | 350 // 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... |
545 // SiteInstance's site and when we later call IsSameWebSite. If there is no | 533 // SiteInstance's site and when we later call IsSameWebSite. If there is no |
546 // current NavigationEntry, check the current SiteInstance's site, which might | 534 // current NavigationEntry, check the current SiteInstance's site, which might |
547 // already be committed to a Web UI URL (such as the NTP). | 535 // already be committed to a Web UI URL (such as the NTP). |
548 bool ShouldSwapBrowsingInstancesForNavigation( | 536 bool ShouldSwapBrowsingInstancesForNavigation( |
549 const GURL& current_effective_url, | 537 const GURL& current_effective_url, |
550 bool current_is_view_source_mode, | 538 bool current_is_view_source_mode, |
551 SiteInstance* new_site_instance, | 539 SiteInstance* new_site_instance, |
552 const GURL& new_effective_url, | 540 const GURL& new_effective_url, |
553 bool new_is_view_source_mode) const; | 541 bool new_is_view_source_mode) const; |
554 | 542 |
555 // Creates a new Web UI, ensuring that the bindings are appropriate compared | |
556 // to |bindings|. | |
557 scoped_ptr<WebUIImpl> CreateWebUI(const GURL& url, int bindings); | |
558 | |
559 // Returns true if it is safe to reuse the current WebUI when navigating from | |
560 // |current_entry| to |new_url|. | |
561 bool ShouldReuseWebUI( | |
562 const NavigationEntry* current_entry, | |
563 const GURL& new_url) const; | |
564 | |
565 // Returns the SiteInstance to use for the navigation. | 543 // Returns the SiteInstance to use for the navigation. |
566 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, | 544 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, |
567 SiteInstance* source_instance, | 545 SiteInstance* source_instance, |
568 SiteInstance* dest_instance, | 546 SiteInstance* dest_instance, |
569 SiteInstance* candidate_instance, | 547 SiteInstance* candidate_instance, |
570 ui::PageTransition transition, | 548 ui::PageTransition transition, |
571 bool dest_is_restore, | 549 bool dest_is_restore, |
572 bool dest_is_view_source_mode); | 550 bool dest_is_view_source_mode); |
573 | 551 |
574 // Returns a descriptor of the appropriate SiteInstance object for the given | 552 // Returns a descriptor of the appropriate SiteInstance object for the given |
(...skipping 25 matching lines...) Expand all Loading... |
600 // description, it is returned as is. | 578 // description, it is returned as is. |
601 SiteInstance* ConvertToSiteInstance(const SiteInstanceDescriptor& descriptor, | 579 SiteInstance* ConvertToSiteInstance(const SiteInstanceDescriptor& descriptor, |
602 SiteInstance* candidate_instance); | 580 SiteInstance* candidate_instance); |
603 | 581 |
604 // Determines the appropriate url to use as the current url for SiteInstance | 582 // Determines the appropriate url to use as the current url for SiteInstance |
605 // selection. | 583 // selection. |
606 const GURL& GetCurrentURLForSiteInstance( | 584 const GURL& GetCurrentURLForSiteInstance( |
607 SiteInstance* current_instance, | 585 SiteInstance* current_instance, |
608 NavigationEntry* current_entry); | 586 NavigationEntry* current_entry); |
609 | 587 |
| 588 // This is the private internal version of CreateRenderFrame that also allows |
| 589 // the caller to specify a URL and bindings for the potential setup of a |
| 590 // WebUI. |
| 591 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameInternal( |
| 592 SiteInstance* instance, |
| 593 const GURL& url, |
| 594 int past_bindings, |
| 595 int flags, |
| 596 int* view_routing_id_ptr); |
| 597 |
610 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to | 598 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to |
611 // |pending_render_frame_host_| while respecting the opener route if needed | 599 // |pending_render_frame_host_| while respecting the opener route if needed |
612 // and stores it in pending_render_frame_host_. | 600 // and stores it in pending_render_frame_host_. |
613 void CreatePendingRenderFrameHost(SiteInstance* old_instance, | 601 void CreatePendingRenderFrameHost(SiteInstance* old_instance, |
614 SiteInstance* new_instance); | 602 SiteInstance* new_instance, |
| 603 const GURL& url, |
| 604 int bindings); |
615 | 605 |
616 // Ensure that we have created all needed proxies for a new RFH with | 606 // Ensure that we have created all needed proxies for a new RFH with |
617 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for | 607 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for |
618 // the new RFH's opener chain if we are staying in the same BrowsingInstance; | 608 // the new RFH's opener chain if we are staying in the same BrowsingInstance; |
619 // (2) Create proxies for the new RFH's SiteInstance in its own frame tree. | 609 // (2) Create proxies for the new RFH's SiteInstance in its own frame tree. |
620 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance, | 610 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance, |
621 SiteInstance* new_instance); | 611 SiteInstance* new_instance); |
622 | 612 |
623 // Traverse the opener chain and populate |opener_frame_trees| with | 613 // Traverse the opener chain and populate |opener_frame_trees| with |
624 // all FrameTrees accessible by following frame openers of nodes in the | 614 // all FrameTrees accessible by following frame openers of nodes in the |
(...skipping 17 matching lines...) Expand all Loading... |
642 | 632 |
643 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. | 633 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. |
644 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, | 634 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, |
645 int32 view_routing_id, | 635 int32 view_routing_id, |
646 int32 frame_routing_id, | 636 int32 frame_routing_id, |
647 int32 widget_routing_id, | 637 int32 widget_routing_id, |
648 int32 surface_id, | 638 int32 surface_id, |
649 int flags); | 639 int flags); |
650 | 640 |
651 // PlzNavigate | 641 // PlzNavigate |
652 // Creates and initializes a speculative RenderFrameHost and/or WebUI for an | 642 // Creates and initializes a speculative RenderFrameHost for an ongoing |
653 // ongoing navigation. They might be destroyed and re-created later if the | 643 // navigation. They might be destroyed and re-created later if the navigation |
654 // navigation is redirected to a different SiteInstance. | 644 // is redirected to a different SiteInstance. |
655 bool CreateSpeculativeRenderFrameHost(const GURL& url, | 645 bool CreateSpeculativeRenderFrameHost(const GURL& url, |
656 SiteInstance* old_instance, | 646 SiteInstance* old_instance, |
657 SiteInstance* new_instance, | 647 SiteInstance* new_instance, |
658 int bindings); | 648 int bindings); |
659 | 649 |
660 // Sets up the necessary state for a new RenderViewHost. Creates a | 650 // Sets up the necessary state for a new RenderViewHost. Creates a |
661 // RenderFrameProxy in the target renderer process with the given | 651 // RenderFrameProxy in the target renderer process with the given |
662 // |proxy_routing_id|, which is used to route IPC messages when in swapped | 652 // |proxy_routing_id|, which is used to route IPC messages when in swapped |
663 // out state. Returns early if the RenderViewHost has already been | 653 // out state. Returns early if the RenderViewHost has already been |
664 // initialized for another RenderFrameHost. | 654 // initialized for another RenderFrameHost. |
665 bool InitRenderView(RenderViewHostImpl* render_view_host, | 655 bool InitRenderView(RenderViewHostImpl* render_view_host, |
666 int proxy_routing_id); | 656 int proxy_routing_id); |
667 | 657 |
668 // Initialization for RenderFrameHost uses the same sequence as InitRenderView | 658 // Initialization for RenderFrameHost uses the same sequence as InitRenderView |
669 // above. | 659 // above. |
670 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); | 660 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); |
671 | 661 |
672 // 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 |
673 // 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 |
674 // since there could be Web UI switching as well. Call this for every commit. | 664 // a pending one. Call this for every commit. |
675 // 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) |
676 // RenderFrameHost to be the active one. | 666 // RenderFrameHost to be the active one. |
677 void CommitPending(); | 667 void CommitPending(); |
678 | 668 |
679 // Helper to call CommitPending() in all necessary cases. | 669 // Helper to call CommitPending() in all necessary cases. |
680 void CommitPendingIfNecessary(RenderFrameHostImpl* render_frame_host, | 670 void CommitPendingIfNecessary(RenderFrameHostImpl* render_frame_host, |
681 bool was_caused_by_user_gesture); | 671 bool was_caused_by_user_gesture); |
682 | 672 |
683 // Commits any pending sandbox flag updates when the renderer's frame | 673 // Commits any pending sandbox flag updates when the renderer's frame |
684 // navigates. | 674 // navigates. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 | 726 |
737 // Our delegate, not owned by us. Guaranteed non-NULL. | 727 // Our delegate, not owned by us. Guaranteed non-NULL. |
738 Delegate* delegate_; | 728 Delegate* delegate_; |
739 | 729 |
740 // 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 |
741 // all the RenderFrameHosts that we create. | 731 // all the RenderFrameHosts that we create. |
742 RenderFrameHostDelegate* render_frame_delegate_; | 732 RenderFrameHostDelegate* render_frame_delegate_; |
743 RenderViewHostDelegate* render_view_delegate_; | 733 RenderViewHostDelegate* render_view_delegate_; |
744 RenderWidgetHostDelegate* render_widget_delegate_; | 734 RenderWidgetHostDelegate* render_widget_delegate_; |
745 | 735 |
746 // 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 |
747 // non-WebUI pages). This object is responsible for all communication with | 737 // RenderFrame instance. |
748 // a child RenderFrame instance. | |
749 // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive. | 738 // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive. |
750 // Eventually, RenderViewHost will be replaced with a page context. | 739 // Eventually, RenderViewHost will be replaced with a page context. |
751 scoped_ptr<RenderFrameHostImpl> render_frame_host_; | 740 scoped_ptr<RenderFrameHostImpl> render_frame_host_; |
752 scoped_ptr<WebUIImpl> web_ui_; | |
753 | 741 |
754 // 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 |
755 // 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. |
756 // have an associated Web UI, in which case the Web UI pointer will be non- | 744 // Note: This member is not used in PlzNavigate. |
757 // NULL. | |
758 // | |
759 // The |pending_web_ui_| may be non-NULL even when the | |
760 // |pending_render_frame_host_| is NULL. This will happen when we're | |
761 // transitioning between two Web UI pages: the RFH won't be swapped, so the | |
762 // pending pointer will be unused, but there will be a pending Web UI | |
763 // associated with the navigation. | |
764 // Note: This is not used in PlzNavigate. | |
765 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; | 745 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; |
766 | 746 |
767 // 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 |
768 // 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 |
769 // cleaned up if the navigation is cancelled. Otherwise, this is NULL. | 749 // cleaned up if the navigation is cancelled. Otherwise, this is NULL. |
770 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request_; | 750 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request_; |
771 | 751 |
772 // This is used to temporarily store the NavigationHandle during | 752 // This is used to temporarily store the NavigationHandle during |
773 // transferring navigations. The handle needs to be stored because the old | 753 // transferring navigations. The handle needs to be stored because the old |
774 // RenderFrameHost may be discarded before a new RenderFrameHost is created | 754 // RenderFrameHost may be discarded before a new RenderFrameHost is created |
775 // for the navigation. | 755 // for the navigation. |
776 // PlzNavigate: this will never be set since there are no transferring | 756 // PlzNavigate: this will never be set since there are no transferring |
777 // navigations in PlzNavigate. | 757 // navigations in PlzNavigate. |
778 scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_; | 758 scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_; |
779 | 759 |
780 // If either of these is non-NULL, the pending navigation is to a chrome: | |
781 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is | |
782 // used for when they reference the same object. If either is non-NULL, the | |
783 // other should be NULL. | |
784 // Note: These are not used in PlzNavigate. | |
785 scoped_ptr<WebUIImpl> pending_web_ui_; | |
786 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; | |
787 | |
788 class RenderFrameProxyHostMap; | 760 class RenderFrameProxyHostMap; |
789 scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_; | 761 scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_; |
790 | 762 |
791 // 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 |
792 // 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 |
793 // because sets don't appear to support linked_ptrs. | 765 // because sets don't appear to support linked_ptrs. |
794 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList; | 766 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList; |
795 RFHPendingDeleteList pending_delete_hosts_; | 767 RFHPendingDeleteList pending_delete_hosts_; |
796 | 768 |
797 // 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 |
798 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 770 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
799 InterstitialPageImpl* interstitial_page_; | 771 InterstitialPageImpl* interstitial_page_; |
800 | 772 |
801 // PlzNavigate | 773 // PlzNavigate |
802 // These members store a speculative RenderFrameHost and WebUI. They are | 774 // Stores a speculative RenderFrameHost which is created early in a navigation |
803 // 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. |
804 // 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 |
805 // required for correct behavior. The created RenderFrameHost might be | 777 // behavior. The speculative RenderFrameHost might be discarded later on if |
806 // 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 |
807 // what was used to create it. | 779 // it. |
808 // Note: PlzNavigate only uses speculative RenderFrameHost and WebUI, not | 780 // Note: PlzNavigate only uses the speculative RenderFrameHost, not the |
809 // the pending ones. | 781 // pending one. |
810 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; | 782 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; |
811 scoped_ptr<WebUIImpl> speculative_web_ui_; | |
812 | |
813 // PlzNavigate | |
814 // If true at navigation commit time the current WebUI will be kept instead of | |
815 // creating a new one. | |
816 bool should_reuse_web_ui_; | |
817 | 783 |
818 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 784 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
819 | 785 |
820 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 786 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
821 }; | 787 }; |
822 | 788 |
823 } // namespace content | 789 } // namespace content |
824 | 790 |
825 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 791 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |