| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // You must call Init() before using this class. | 187 // You must call Init() before using this class. |
| 188 RenderFrameHostManager( | 188 RenderFrameHostManager( |
| 189 FrameTreeNode* frame_tree_node, | 189 FrameTreeNode* frame_tree_node, |
| 190 RenderFrameHostDelegate* render_frame_delegate, | 190 RenderFrameHostDelegate* render_frame_delegate, |
| 191 RenderViewHostDelegate* render_view_delegate, | 191 RenderViewHostDelegate* render_view_delegate, |
| 192 RenderWidgetHostDelegate* render_widget_delegate, | 192 RenderWidgetHostDelegate* render_widget_delegate, |
| 193 Delegate* delegate); | 193 Delegate* delegate); |
| 194 ~RenderFrameHostManager(); | 194 ~RenderFrameHostManager(); |
| 195 | 195 |
| 196 // For arguments, see WebContentsImpl constructor. | 196 // For arguments, see WebContentsImpl constructor. |
| 197 void Init(SiteInstance* site_instance, | 197 void Init(SiteInstanceImpl* site_instance, |
| 198 int32_t view_routing_id, | 198 int32_t view_routing_id, |
| 199 int32_t frame_routing_id, | 199 int32_t frame_routing_id, |
| 200 int32_t widget_routing_id); | 200 int32_t widget_routing_id); |
| 201 | 201 |
| 202 // Returns the currently active RenderFrameHost. | 202 // Returns the currently active RenderFrameHost. |
| 203 // | 203 // |
| 204 // This will be non-NULL between Init() and Shutdown(). You may want to NULL | 204 // This will be non-NULL between Init() and Shutdown(). You may want to NULL |
| 205 // check it in many cases, however. Windows can send us messages during the | 205 // check it in many cases, however. Windows can send us messages during the |
| 206 // destruction process after it has been shut down. | 206 // destruction process after it has been shut down. |
| 207 RenderFrameHostImpl* current_frame_host() const { | 207 RenderFrameHostImpl* current_frame_host() const { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 void DidNavigateFrame(RenderFrameHostImpl* render_frame_host, | 326 void DidNavigateFrame(RenderFrameHostImpl* render_frame_host, |
| 327 bool was_caused_by_user_gesture); | 327 bool was_caused_by_user_gesture); |
| 328 | 328 |
| 329 // 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 |
| 330 // |opener_routing_id| in |source_site_instance|'s process. This change | 330 // |opener_routing_id| in |source_site_instance|'s process. This change |
| 331 // could come from either the current RenderFrameHost or one of the | 331 // could come from either the current RenderFrameHost or one of the |
| 332 // 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 |
| 333 // updated opener will be forwarded to any other RenderFrameProxies and | 333 // updated opener will be forwarded to any other RenderFrameProxies and |
| 334 // RenderFrames for this FrameTreeNode. | 334 // RenderFrames for this FrameTreeNode. |
| 335 void DidChangeOpener(int opener_routing_id, | 335 void DidChangeOpener(int opener_routing_id, |
| 336 SiteInstance* source_site_instance); | 336 SiteInstanceImpl* source_site_instance); |
| 337 | 337 |
| 338 // Creates and initializes a RenderFrameHost. If |view_routing_id_ptr| | 338 // Creates and initializes a RenderFrameHost. If |view_routing_id_ptr| |
| 339 // is not nullptr it will be set to the routing id of the view associated with | 339 // is not nullptr it will be set to the routing id of the view associated with |
| 340 // the frame. | 340 // the frame. |
| 341 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, | 341 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstanceImpl* instance, |
| 342 bool hidden, | 342 bool hidden, |
| 343 int* view_routing_id_ptr); | 343 int* view_routing_id_ptr); |
| 344 | 344 |
| 345 // Helper method to create and initialize a RenderFrameProxyHost and return | 345 // Helper method to create and initialize a RenderFrameProxyHost and return |
| 346 // its routing id. | 346 // its routing id. |
| 347 int CreateRenderFrameProxy(SiteInstance* instance); | 347 int CreateRenderFrameProxy(SiteInstanceImpl* instance); |
| 348 | 348 |
| 349 // Creates proxies for a new child frame at FrameTreeNode |child| in all | 349 // Creates proxies for a new child frame at FrameTreeNode |child| in all |
| 350 // SiteInstances for which the current frame has proxies. This method is | 350 // SiteInstances for which the current frame has proxies. This method is |
| 351 // called on the parent of a new child frame before the child leaves the | 351 // called on the parent of a new child frame before the child leaves the |
| 352 // SiteInstance. | 352 // SiteInstance. |
| 353 void CreateProxiesForChildFrame(FrameTreeNode* child); | 353 void CreateProxiesForChildFrame(FrameTreeNode* child); |
| 354 | 354 |
| 355 // Sets the passed passed interstitial as the currently showing interstitial. | 355 // Sets the passed passed interstitial as the currently showing interstitial. |
| 356 // |interstitial_page| should be non NULL (use the remove_interstitial_page | 356 // |interstitial_page| should be non NULL (use the remove_interstitial_page |
| 357 // method to unset the interstitial) and no interstitial page should be set | 357 // method to unset the interstitial) and no interstitial page should be set |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // Deletes any proxy hosts associated with this node. Used during destruction | 398 // Deletes any proxy hosts associated with this node. Used during destruction |
| 399 // of WebContentsImpl. | 399 // of WebContentsImpl. |
| 400 void ResetProxyHosts(); | 400 void ResetProxyHosts(); |
| 401 | 401 |
| 402 void ClearRFHsPendingShutdown(); | 402 void ClearRFHsPendingShutdown(); |
| 403 void ClearWebUIInstances(); | 403 void ClearWebUIInstances(); |
| 404 | 404 |
| 405 // Returns the routing id for a RenderFrameHost or RenderFrameProxyHost | 405 // Returns the routing id for a RenderFrameHost or RenderFrameProxyHost |
| 406 // that has the given SiteInstance and is associated with this | 406 // that has the given SiteInstance and is associated with this |
| 407 // RenderFrameHostManager. Returns MSG_ROUTING_NONE if none is found. | 407 // RenderFrameHostManager. Returns MSG_ROUTING_NONE if none is found. |
| 408 int GetRoutingIdForSiteInstance(SiteInstance* site_instance); | 408 int GetRoutingIdForSiteInstance(SiteInstanceImpl* site_instance); |
| 409 | 409 |
| 410 // PlzNavigate | 410 // PlzNavigate |
| 411 // Notifies the RenderFrameHostManager that a new NavigationRequest has been | 411 // Notifies the RenderFrameHostManager that a new NavigationRequest has been |
| 412 // created and set in the FrameTreeNode so that it can speculatively create a | 412 // created and set in the FrameTreeNode so that it can speculatively create a |
| 413 // new RenderFrameHost (and potentially a new process) if needed. | 413 // new RenderFrameHost (and potentially a new process) if needed. |
| 414 void DidCreateNavigationRequest(const NavigationRequest& request); | 414 void DidCreateNavigationRequest(const NavigationRequest& request); |
| 415 | 415 |
| 416 // PlzNavigate | 416 // PlzNavigate |
| 417 // Called (possibly several times) during a navigation to select or create an | 417 // Called (possibly several times) during a navigation to select or create an |
| 418 // appropriate RenderFrameHost for the provided URL. The returned pointer will | 418 // appropriate RenderFrameHost for the provided URL. The returned pointer will |
| (...skipping 24 matching lines...) Expand all Loading... |
| 443 // Sends updated enforcement of strict mixed content checking to all | 443 // Sends updated enforcement of strict mixed content checking to all |
| 444 // frame proxies when the frame changes its setting. | 444 // frame proxies when the frame changes its setting. |
| 445 void OnEnforceStrictMixedContentChecking(bool should_enforce); | 445 void OnEnforceStrictMixedContentChecking(bool should_enforce); |
| 446 | 446 |
| 447 // Send updated origin to all frame proxies when the frame navigates to a new | 447 // Send updated origin to all frame proxies when the frame navigates to a new |
| 448 // origin. | 448 // origin. |
| 449 void OnDidUpdateOrigin(const url::Origin& origin, | 449 void OnDidUpdateOrigin(const url::Origin& origin, |
| 450 bool is_potentially_trustworthy_unique_origin); | 450 bool is_potentially_trustworthy_unique_origin); |
| 451 | 451 |
| 452 void EnsureRenderViewInitialized(RenderViewHostImpl* render_view_host, | 452 void EnsureRenderViewInitialized(RenderViewHostImpl* render_view_host, |
| 453 SiteInstance* instance); | 453 SiteInstanceImpl* instance); |
| 454 | 454 |
| 455 // Creates swapped out RenderViews and RenderFrameProxies for this frame's | 455 // Creates swapped out RenderViews and RenderFrameProxies for this frame's |
| 456 // FrameTree and for its opener chain in the given SiteInstance. This allows | 456 // FrameTree and for its opener chain in the given SiteInstance. This allows |
| 457 // other tabs to send cross-process JavaScript calls to their opener(s) and | 457 // other tabs to send cross-process JavaScript calls to their opener(s) and |
| 458 // to any other frames in the opener's FrameTree (e.g., supporting calls like | 458 // to any other frames in the opener's FrameTree (e.g., supporting calls like |
| 459 // window.opener.opener.frames[x][y]). Does not create proxies for the | 459 // window.opener.opener.frames[x][y]). Does not create proxies for the |
| 460 // subtree rooted at |skip_this_node| (e.g., if a node is being navigated, it | 460 // subtree rooted at |skip_this_node| (e.g., if a node is being navigated, it |
| 461 // can be passed here to prevent proxies from being created for it, in | 461 // can be passed here to prevent proxies from being created for it, in |
| 462 // case it is in the same FrameTree as another node on its opener chain). | 462 // case it is in the same FrameTree as another node on its opener chain). |
| 463 void CreateOpenerProxies(SiteInstance* instance, | 463 void CreateOpenerProxies(SiteInstanceImpl* instance, |
| 464 FrameTreeNode* skip_this_node); | 464 FrameTreeNode* skip_this_node); |
| 465 | 465 |
| 466 // Ensure that this frame has proxies in all SiteInstances that can discover | 466 // Ensure that this frame has proxies in all SiteInstances that can discover |
| 467 // this frame by name (e.g., via window.open("", "frame_name")). See | 467 // this frame by name (e.g., via window.open("", "frame_name")). See |
| 468 // https://crbug.com/511474. | 468 // https://crbug.com/511474. |
| 469 void CreateProxiesForNewNamedFrame(); | 469 void CreateProxiesForNewNamedFrame(); |
| 470 | 470 |
| 471 // Returns a routing ID for the current FrameTreeNode's opener node in the | 471 // Returns a routing ID for the current FrameTreeNode's opener node in the |
| 472 // given SiteInstance. May return a routing ID of either a RenderFrameHost | 472 // given SiteInstance. May return a routing ID of either a RenderFrameHost |
| 473 // (if opener's current or pending RFH has SiteInstance |instance|) or a | 473 // (if opener's current or pending RFH has SiteInstance |instance|) or a |
| 474 // RenderFrameProxyHost. Returns MSG_ROUTING_NONE if there is no opener, or | 474 // RenderFrameProxyHost. Returns MSG_ROUTING_NONE if there is no opener, or |
| 475 // if the opener node doesn't have a proxy for |instance|. | 475 // if the opener node doesn't have a proxy for |instance|. |
| 476 int GetOpenerRoutingID(SiteInstance* instance); | 476 int GetOpenerRoutingID(SiteInstanceImpl* instance); |
| 477 | 477 |
| 478 // Called on the RFHM of the inner WebContents to create a | 478 // Called on the RFHM of the inner WebContents to create a |
| 479 // RenderFrameProxyHost in its outer WebContents's SiteInstance, | 479 // RenderFrameProxyHost in its outer WebContents's SiteInstance, |
| 480 // |outer_contents_site_instance|. The frame in outer WebContents that is | 480 // |outer_contents_site_instance|. The frame in outer WebContents that is |
| 481 // hosting the inner WebContents is |render_frame_host|, and the frame will | 481 // hosting the inner WebContents is |render_frame_host|, and the frame will |
| 482 // be swapped out with the proxy. | 482 // be swapped out with the proxy. |
| 483 void CreateOuterDelegateProxy(SiteInstance* outer_contents_site_instance, | 483 void CreateOuterDelegateProxy(SiteInstanceImpl* outer_contents_site_instance, |
| 484 RenderFrameHostImpl* render_frame_host); | 484 RenderFrameHostImpl* render_frame_host); |
| 485 | 485 |
| 486 // Sets the child RenderWidgetHostView for this frame, which must be part of | 486 // Sets the child RenderWidgetHostView for this frame, which must be part of |
| 487 // an inner WebContents. | 487 // an inner WebContents. |
| 488 void SetRWHViewForInnerContents(RenderWidgetHostView* child_rwhv); | 488 void SetRWHViewForInnerContents(RenderWidgetHostView* child_rwhv); |
| 489 | 489 |
| 490 // Returns the number of RenderFrameProxyHosts for this frame. | 490 // Returns the number of RenderFrameProxyHosts for this frame. |
| 491 int GetProxyCount(); | 491 int GetProxyCount(); |
| 492 | 492 |
| 493 // Sends an IPC message to every process in the FrameTree. This should only be | 493 // Sends an IPC message to every process in the FrameTree. This should only be |
| (...skipping 30 matching lines...) Expand all Loading... |
| 524 RELATED, | 524 RELATED, |
| 525 // The default subframe SiteInstance for the current browsing instance. | 525 // The default subframe SiteInstance for the current browsing instance. |
| 526 RELATED_DEFAULT_SUBFRAME, | 526 RELATED_DEFAULT_SUBFRAME, |
| 527 }; | 527 }; |
| 528 | 528 |
| 529 // Stores information regarding a SiteInstance targeted at a specific URL to | 529 // Stores information regarding a SiteInstance targeted at a specific URL to |
| 530 // allow for comparisons without having to actually create new instances. It | 530 // allow for comparisons without having to actually create new instances. It |
| 531 // can point to an existing one or store the details needed to create a new | 531 // can point to an existing one or store the details needed to create a new |
| 532 // one. | 532 // one. |
| 533 struct CONTENT_EXPORT SiteInstanceDescriptor { | 533 struct CONTENT_EXPORT SiteInstanceDescriptor { |
| 534 explicit SiteInstanceDescriptor(content::SiteInstance* site_instance) | 534 explicit SiteInstanceDescriptor(content::SiteInstanceImpl* site_instance) |
| 535 : existing_site_instance(site_instance), | 535 : existing_site_instance(site_instance), |
| 536 relation(SiteInstanceRelation::UNRELATED) {} | 536 relation(SiteInstanceRelation::UNRELATED) {} |
| 537 | 537 |
| 538 SiteInstanceDescriptor(BrowserContext* browser_context, | 538 SiteInstanceDescriptor(BrowserContext* browser_context, |
| 539 GURL dest_url, | 539 GURL dest_url, |
| 540 SiteInstanceRelation relation_to_current); | 540 SiteInstanceRelation relation_to_current); |
| 541 | 541 |
| 542 // Set with an existing SiteInstance to be reused. | 542 // Set with an existing SiteInstance to be reused. |
| 543 content::SiteInstance* existing_site_instance; | 543 content::SiteInstanceImpl* existing_site_instance; |
| 544 | 544 |
| 545 // In case |existing_site_instance| is null, specify a new site URL. | 545 // In case |existing_site_instance| is null, specify a new site URL. |
| 546 GURL new_site_url; | 546 GURL new_site_url; |
| 547 | 547 |
| 548 // In case |existing_site_instance| is null, specify how the new site is | 548 // In case |existing_site_instance| is null, specify how the new site is |
| 549 // related to the current BrowsingInstance. | 549 // related to the current BrowsingInstance. |
| 550 SiteInstanceRelation relation; | 550 SiteInstanceRelation relation; |
| 551 }; | 551 }; |
| 552 | 552 |
| 553 // Create a RenderFrameProxyHost owned by this object. | 553 // Create a RenderFrameProxyHost owned by this object. |
| 554 RenderFrameProxyHost* CreateRenderFrameProxyHost(SiteInstance* site_instance, | 554 RenderFrameProxyHost* CreateRenderFrameProxyHost( |
| 555 RenderViewHostImpl* rvh); | 555 SiteInstanceImpl* site_instance, |
| 556 RenderViewHostImpl* rvh); |
| 556 // Delete a RenderFrameProxyHost owned by this object. | 557 // Delete a RenderFrameProxyHost owned by this object. |
| 557 void DeleteRenderFrameProxyHost(SiteInstance* site_instance); | 558 void DeleteRenderFrameProxyHost(SiteInstanceImpl* site_instance); |
| 558 | 559 |
| 559 // Returns whether this tab should transition to a new renderer for | 560 // Returns whether this tab should transition to a new renderer for |
| 560 // cross-site URLs. Enabled unless we see the --process-per-tab command line | 561 // cross-site URLs. Enabled unless we see the --process-per-tab command line |
| 561 // switch. Can be overridden in unit tests. | 562 // switch. Can be overridden in unit tests. |
| 562 bool ShouldTransitionCrossSite(); | 563 bool ShouldTransitionCrossSite(); |
| 563 | 564 |
| 564 // Returns true if for the navigation from |current_effective_url| to | 565 // Returns true if for the navigation from |current_effective_url| to |
| 565 // |new_effective_url|, a new SiteInstance and BrowsingInstance should be | 566 // |new_effective_url|, a new SiteInstance and BrowsingInstance should be |
| 566 // created (even if we are in a process model that doesn't usually swap). | 567 // created (even if we are in a process model that doesn't usually swap). |
| 567 // This forces a process swap and severs script connections with existing | 568 // This forces a process swap and severs script connections with existing |
| 568 // tabs. Cases where this can happen include transitions between WebUI and | 569 // tabs. Cases where this can happen include transitions between WebUI and |
| 569 // regular web pages. |new_site_instance| may be null. | 570 // regular web pages. |new_site_instance| may be null. |
| 570 // If there is no current NavigationEntry, then |current_is_view_source_mode| | 571 // If there is no current NavigationEntry, then |current_is_view_source_mode| |
| 571 // should be the same as |new_is_view_source_mode|. | 572 // should be the same as |new_is_view_source_mode|. |
| 572 // | 573 // |
| 573 // We use the effective URL here, since that's what is used in the | 574 // We use the effective URL here, since that's what is used in the |
| 574 // SiteInstance's site and when we later call IsSameWebSite. If there is no | 575 // SiteInstance's site and when we later call IsSameWebSite. If there is no |
| 575 // current NavigationEntry, check the current SiteInstance's site, which might | 576 // current NavigationEntry, check the current SiteInstance's site, which might |
| 576 // already be committed to a Web UI URL (such as the NTP). | 577 // already be committed to a Web UI URL (such as the NTP). |
| 577 bool ShouldSwapBrowsingInstancesForNavigation( | 578 bool ShouldSwapBrowsingInstancesForNavigation( |
| 578 const GURL& current_effective_url, | 579 const GURL& current_effective_url, |
| 579 bool current_is_view_source_mode, | 580 bool current_is_view_source_mode, |
| 580 SiteInstance* new_site_instance, | 581 SiteInstanceImpl* new_site_instance, |
| 581 const GURL& new_effective_url, | 582 const GURL& new_effective_url, |
| 582 bool new_is_view_source_mode) const; | 583 bool new_is_view_source_mode) const; |
| 583 | 584 |
| 584 // Returns the SiteInstance to use for the navigation. | 585 // Returns the SiteInstance to use for the navigation. |
| 585 scoped_refptr<SiteInstance> GetSiteInstanceForNavigation( | 586 scoped_refptr<SiteInstanceImpl> GetSiteInstanceForNavigation( |
| 586 const GURL& dest_url, | 587 const GURL& dest_url, |
| 587 SiteInstance* source_instance, | 588 SiteInstanceImpl* source_instance, |
| 588 SiteInstance* dest_instance, | 589 SiteInstanceImpl* dest_instance, |
| 589 SiteInstance* candidate_instance, | 590 SiteInstanceImpl* candidate_instance, |
| 590 ui::PageTransition transition, | 591 ui::PageTransition transition, |
| 591 bool dest_is_restore, | 592 bool dest_is_restore, |
| 592 bool dest_is_view_source_mode); | 593 bool dest_is_view_source_mode); |
| 593 | 594 |
| 594 // Returns a descriptor of the appropriate SiteInstance object for the given | 595 // Returns a descriptor of the appropriate SiteInstance object for the given |
| 595 // |dest_url|, possibly reusing the current, source or destination | 596 // |dest_url|, possibly reusing the current, source or destination |
| 596 // SiteInstance. The actual SiteInstance can then be obtained calling | 597 // SiteInstance. The actual SiteInstance can then be obtained calling |
| 597 // ConvertToSiteInstance with the descriptor. | 598 // ConvertToSiteInstance with the descriptor. |
| 598 // | 599 // |
| 599 // |source_instance| is the SiteInstance of the frame that initiated the | 600 // |source_instance| is the SiteInstance of the frame that initiated the |
| 600 // navigation. |current_instance| is the SiteInstance of the frame that is | 601 // navigation. |current_instance| is the SiteInstance of the frame that is |
| 601 // currently navigating. |dest_instance| is a predetermined SiteInstance that | 602 // currently navigating. |dest_instance| is a predetermined SiteInstance that |
| 602 // will be used if not null. | 603 // will be used if not null. |
| 603 // For example, if you have a parent frame A, which has a child frame B, and | 604 // For example, if you have a parent frame A, which has a child frame B, and |
| 604 // A is trying to change the src attribute of B, this will cause a navigation | 605 // A is trying to change the src attribute of B, this will cause a navigation |
| 605 // where the source SiteInstance is A and B is the current SiteInstance. | 606 // where the source SiteInstance is A and B is the current SiteInstance. |
| 606 // | 607 // |
| 607 // This is a helper function for GetSiteInstanceForNavigation. | 608 // This is a helper function for GetSiteInstanceForNavigation. |
| 608 SiteInstanceDescriptor DetermineSiteInstanceForURL( | 609 SiteInstanceDescriptor DetermineSiteInstanceForURL( |
| 609 const GURL& dest_url, | 610 const GURL& dest_url, |
| 610 SiteInstance* source_instance, | 611 SiteInstanceImpl* source_instance, |
| 611 SiteInstance* current_instance, | 612 SiteInstanceImpl* current_instance, |
| 612 SiteInstance* dest_instance, | 613 SiteInstanceImpl* dest_instance, |
| 613 ui::PageTransition transition, | 614 ui::PageTransition transition, |
| 614 bool dest_is_restore, | 615 bool dest_is_restore, |
| 615 bool dest_is_view_source_mode, | 616 bool dest_is_view_source_mode, |
| 616 bool force_browsing_instance_swap); | 617 bool force_browsing_instance_swap); |
| 617 | 618 |
| 618 // Converts a SiteInstanceDescriptor to the actual SiteInstance it describes. | 619 // Converts a SiteInstanceDescriptor to the actual SiteInstance it describes. |
| 619 // If a |candidate_instance| is provided (is not nullptr) and it matches the | 620 // If a |candidate_instance| is provided (is not nullptr) and it matches the |
| 620 // description, it is returned as is. | 621 // description, it is returned as is. |
| 621 scoped_refptr<SiteInstance> ConvertToSiteInstance( | 622 scoped_refptr<SiteInstanceImpl> ConvertToSiteInstance( |
| 622 const SiteInstanceDescriptor& descriptor, | 623 const SiteInstanceDescriptor& descriptor, |
| 623 SiteInstance* candidate_instance); | 624 SiteInstanceImpl* candidate_instance); |
| 624 | 625 |
| 625 // Returns true if |candidate| is currently on the same web site as dest_url. | 626 // Returns true if |candidate| is currently on the same web site as dest_url. |
| 626 bool IsCurrentlySameSite(RenderFrameHostImpl* candidate, | 627 bool IsCurrentlySameSite(RenderFrameHostImpl* candidate, |
| 627 const GURL& dest_url); | 628 const GURL& dest_url); |
| 628 | 629 |
| 629 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to | 630 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to |
| 630 // |pending_render_frame_host_| while respecting the opener route if needed | 631 // |pending_render_frame_host_| while respecting the opener route if needed |
| 631 // and stores it in pending_render_frame_host_. | 632 // and stores it in pending_render_frame_host_. |
| 632 void CreatePendingRenderFrameHost(SiteInstance* old_instance, | 633 void CreatePendingRenderFrameHost(SiteInstanceImpl* old_instance, |
| 633 SiteInstance* new_instance); | 634 SiteInstanceImpl* new_instance); |
| 634 | 635 |
| 635 // Ensure that we have created all needed proxies for a new RFH with | 636 // Ensure that we have created all needed proxies for a new RFH with |
| 636 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for | 637 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for |
| 637 // the new RFH's opener chain if we are staying in the same BrowsingInstance; | 638 // the new RFH's opener chain if we are staying in the same BrowsingInstance; |
| 638 // (2) Create proxies for the new RFH's SiteInstance in its own frame tree. | 639 // (2) Create proxies for the new RFH's SiteInstance in its own frame tree. |
| 639 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance, | 640 void CreateProxiesForNewRenderFrameHost(SiteInstanceImpl* old_instance, |
| 640 SiteInstance* new_instance); | 641 SiteInstanceImpl* new_instance); |
| 641 | 642 |
| 642 // Traverse the opener chain and populate |opener_frame_trees| with | 643 // Traverse the opener chain and populate |opener_frame_trees| with |
| 643 // all FrameTrees accessible by following frame openers of nodes in the | 644 // all FrameTrees accessible by following frame openers of nodes in the |
| 644 // given node's FrameTree. |opener_frame_trees| is ordered so that openers | 645 // given node's FrameTree. |opener_frame_trees| is ordered so that openers |
| 645 // of smaller-indexed entries point to larger-indexed entries (i.e., this | 646 // of smaller-indexed entries point to larger-indexed entries (i.e., this |
| 646 // node's FrameTree is at index 0, its opener's FrameTree is at index 1, | 647 // node's FrameTree is at index 0, its opener's FrameTree is at index 1, |
| 647 // etc). If the traversal encounters a node with an opener pointing to a | 648 // etc). If the traversal encounters a node with an opener pointing to a |
| 648 // FrameTree that has already been traversed (such as when there's a cycle), | 649 // FrameTree that has already been traversed (such as when there's a cycle), |
| 649 // the node is added to |nodes_with_back_links|. | 650 // the node is added to |nodes_with_back_links|. |
| 650 void CollectOpenerFrameTrees( | 651 void CollectOpenerFrameTrees( |
| 651 std::vector<FrameTree*>* opener_frame_trees, | 652 std::vector<FrameTree*>* opener_frame_trees, |
| 652 base::hash_set<FrameTreeNode*>* nodes_with_back_links); | 653 base::hash_set<FrameTreeNode*>* nodes_with_back_links); |
| 653 | 654 |
| 654 // Create swapped out RenderViews and RenderFrameProxies in the given | 655 // Create swapped out RenderViews and RenderFrameProxies in the given |
| 655 // SiteInstance for the current node's FrameTree. Used as a helper function | 656 // SiteInstance for the current node's FrameTree. Used as a helper function |
| 656 // in CreateOpenerProxies for creating proxies in each FrameTree on the | 657 // in CreateOpenerProxies for creating proxies in each FrameTree on the |
| 657 // opener chain. Don't create proxies for the subtree rooted at | 658 // opener chain. Don't create proxies for the subtree rooted at |
| 658 // |skip_this_node|. | 659 // |skip_this_node|. |
| 659 void CreateOpenerProxiesForFrameTree(SiteInstance* instance, | 660 void CreateOpenerProxiesForFrameTree(SiteInstanceImpl* instance, |
| 660 FrameTreeNode* skip_this_node); | 661 FrameTreeNode* skip_this_node); |
| 661 | 662 |
| 662 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. | 663 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. |
| 663 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost( | 664 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost( |
| 664 SiteInstance* instance, | 665 SiteInstanceImpl* instance, |
| 665 int32_t view_routing_id, | 666 int32_t view_routing_id, |
| 666 int32_t frame_routing_id, | 667 int32_t frame_routing_id, |
| 667 int32_t widget_routing_id, | 668 int32_t widget_routing_id, |
| 668 bool hidden); | 669 bool hidden); |
| 669 | 670 |
| 670 // PlzNavigate | 671 // PlzNavigate |
| 671 // Create and initialize a speculative RenderFrameHost for an ongoing | 672 // Create and initialize a speculative RenderFrameHost for an ongoing |
| 672 // navigation. It might be destroyed and re-created later if the navigation | 673 // navigation. It might be destroyed and re-created later if the navigation |
| 673 // is redirected to a different SiteInstance. | 674 // is redirected to a different SiteInstance. |
| 674 bool CreateSpeculativeRenderFrameHost(SiteInstance* old_instance, | 675 bool CreateSpeculativeRenderFrameHost(SiteInstanceImpl* old_instance, |
| 675 SiteInstance* new_instance); | 676 SiteInstanceImpl* new_instance); |
| 676 | 677 |
| 677 // Initialization for RenderFrameHost uses the same sequence as InitRenderView | 678 // Initialization for RenderFrameHost uses the same sequence as InitRenderView |
| 678 // above. | 679 // above. |
| 679 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); | 680 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); |
| 680 | 681 |
| 681 // Makes the pending WebUI on the current RenderFrameHost active. Call this | 682 // Makes the pending WebUI on the current RenderFrameHost active. Call this |
| 682 // when the current RenderFrameHost commits and it has a pending WebUI. | 683 // when the current RenderFrameHost commits and it has a pending WebUI. |
| 683 void CommitPendingWebUI(); | 684 void CommitPendingWebUI(); |
| 684 | 685 |
| 685 // Sets the pending RenderFrameHost to be the active one. Call when the | 686 // Sets the pending RenderFrameHost to be the active one. Call when the |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 // Clears pending_render_frame_host_, returning it to the caller for disposal. | 718 // Clears pending_render_frame_host_, returning it to the caller for disposal. |
| 718 scoped_ptr<RenderFrameHostImpl> UnsetPendingRenderFrameHost(); | 719 scoped_ptr<RenderFrameHostImpl> UnsetPendingRenderFrameHost(); |
| 719 | 720 |
| 720 // Helper method to set the active RenderFrameHost. Returns the old | 721 // Helper method to set the active RenderFrameHost. Returns the old |
| 721 // RenderFrameHost and updates counts. | 722 // RenderFrameHost and updates counts. |
| 722 scoped_ptr<RenderFrameHostImpl> SetRenderFrameHost( | 723 scoped_ptr<RenderFrameHostImpl> SetRenderFrameHost( |
| 723 scoped_ptr<RenderFrameHostImpl> render_frame_host); | 724 scoped_ptr<RenderFrameHostImpl> render_frame_host); |
| 724 | 725 |
| 725 RenderFrameHostImpl* UpdateStateForNavigate( | 726 RenderFrameHostImpl* UpdateStateForNavigate( |
| 726 const GURL& dest_url, | 727 const GURL& dest_url, |
| 727 SiteInstance* source_instance, | 728 SiteInstanceImpl* source_instance, |
| 728 SiteInstance* dest_instance, | 729 SiteInstanceImpl* dest_instance, |
| 729 ui::PageTransition transition, | 730 ui::PageTransition transition, |
| 730 bool dest_is_restore, | 731 bool dest_is_restore, |
| 731 bool dest_is_view_source_mode, | 732 bool dest_is_view_source_mode, |
| 732 const GlobalRequestID& transferred_request_id, | 733 const GlobalRequestID& transferred_request_id, |
| 733 int bindings); | 734 int bindings); |
| 734 | 735 |
| 735 // Updates the pending WebUI of the current RenderFrameHost for a same-site | 736 // Updates the pending WebUI of the current RenderFrameHost for a same-site |
| 736 // navigation. | 737 // navigation. |
| 737 void UpdatePendingWebUIOnCurrentFrameHost(const GURL& dest_url, | 738 void UpdatePendingWebUIOnCurrentFrameHost(const GURL& dest_url, |
| 738 int entry_bindings); | 739 int entry_bindings); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; | 797 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; |
| 797 | 798 |
| 798 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 799 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
| 799 | 800 |
| 800 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 801 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
| 801 }; | 802 }; |
| 802 | 803 |
| 803 } // namespace content | 804 } // namespace content |
| 804 | 805 |
| 805 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 806 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
| OLD | NEW |