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 |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 // window.name property. | 443 // window.name property. |
444 void OnDidUpdateName(const std::string& name); | 444 void OnDidUpdateName(const std::string& name); |
445 | 445 |
446 // Send updated origin to all frame proxies when the frame navigates to a new | 446 // Send updated origin to all frame proxies when the frame navigates to a new |
447 // origin. | 447 // origin. |
448 void OnDidUpdateOrigin(const url::Origin& origin); | 448 void OnDidUpdateOrigin(const url::Origin& origin); |
449 | 449 |
450 void EnsureRenderViewInitialized(RenderViewHostImpl* render_view_host, | 450 void EnsureRenderViewInitialized(RenderViewHostImpl* render_view_host, |
451 SiteInstance* instance); | 451 SiteInstance* instance); |
452 | 452 |
453 // Recursively creates swapped out RenderViews and RenderFrameProxies for | 453 // Creates swapped out RenderViews and RenderFrameProxies for this frame's |
454 // this frame's FrameTree and for its opener chain in the given SiteInstance. | 454 // FrameTree and for its opener chain in the given SiteInstance. This allows |
455 // This allows other tabs to send cross-process JavaScript calls to their | 455 // other tabs to send cross-process JavaScript calls to their opener(s) and |
456 // opener(s) and to any other frames in the opener's FrameTree (e.g., | 456 // to any other frames in the opener's FrameTree (e.g., supporting calls like |
457 // supporting calls like window.opener.opener.frames[x][y]). | 457 // window.opener.opener.frames[x][y]). Does not create proxies for the |
458 void CreateOpenerProxies(SiteInstance* instance); | 458 // subtree rooted at |skip_this_node| (e.g., if a node is being navigated, it |
| 459 // can be passed here to prevent proxies from being created for it, in |
| 460 // case it is in the same FrameTree as another node on its opener chain). |
| 461 void CreateOpenerProxies(SiteInstance* instance, |
| 462 FrameTreeNode* skip_this_node); |
459 | 463 |
460 // Ensure that this frame has proxies in all SiteInstances that can discover | 464 // Ensure that this frame has proxies in all SiteInstances that can discover |
461 // this frame by name (e.g., via window.open("", "frame_name")). See | 465 // this frame by name (e.g., via window.open("", "frame_name")). See |
462 // https://crbug.com/511474. | 466 // https://crbug.com/511474. |
463 void CreateProxiesForNewNamedFrame(); | 467 void CreateProxiesForNewNamedFrame(); |
464 | 468 |
465 // Returns a routing ID for the current FrameTreeNode's opener node in the | 469 // Returns a routing ID for the current FrameTreeNode's opener node in the |
466 // given SiteInstance. May return a routing ID of either a RenderFrameHost | 470 // given SiteInstance. May return a routing ID of either a RenderFrameHost |
467 // (if opener's current or pending RFH has SiteInstance |instance|) or a | 471 // (if opener's current or pending RFH has SiteInstance |instance|) or a |
468 // RenderFrameProxyHost. Returns MSG_ROUTING_NONE if there is no opener, or | 472 // RenderFrameProxyHost. Returns MSG_ROUTING_NONE if there is no opener, or |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 SiteInstance* new_instance, | 614 SiteInstance* new_instance, |
611 bool is_main_frame); | 615 bool is_main_frame); |
612 | 616 |
613 // Ensure that we have created all needed proxies for a new RFH with | 617 // Ensure that we have created all needed proxies for a new RFH with |
614 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for | 618 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for |
615 // the new RFH's opener chain if we are staying in the same BrowsingInstance; | 619 // the new RFH's opener chain if we are staying in the same BrowsingInstance; |
616 // (2) Create proxies for the new RFH's SiteInstance in its own frame tree. | 620 // (2) Create proxies for the new RFH's SiteInstance in its own frame tree. |
617 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance, | 621 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance, |
618 SiteInstance* new_instance); | 622 SiteInstance* new_instance); |
619 | 623 |
620 // Create swapped out RenderViews and RenderFrameProxies in the given | |
621 // SiteInstance for all frames on the opener chain of this frame. Same as | |
622 // CreateOpenerProxies, but starts from this frame's opener, calling | |
623 // CreateOpenerProxies on it if it exists and returning otherwise. | |
624 void CreateOpenerProxiesIfNeeded(SiteInstance* instance); | |
625 | |
626 // Traverse the opener chain and populate |opener_frame_trees| with | 624 // Traverse the opener chain and populate |opener_frame_trees| with |
627 // all FrameTrees accessible by following frame openers of nodes in the | 625 // all FrameTrees accessible by following frame openers of nodes in the |
628 // given node's FrameTree. |opener_frame_trees| is ordered so that openers | 626 // given node's FrameTree. |opener_frame_trees| is ordered so that openers |
629 // of smaller-indexed entries point to larger-indexed entries (i.e., this | 627 // of smaller-indexed entries point to larger-indexed entries (i.e., this |
630 // node's FrameTree is at index 0, its opener's FrameTree is at index 1, | 628 // node's FrameTree is at index 0, its opener's FrameTree is at index 1, |
631 // etc). If the traversal encounters a node with an opener pointing to a | 629 // etc). If the traversal encounters a node with an opener pointing to a |
632 // FrameTree that has already been traversed (such as when there's a cycle), | 630 // FrameTree that has already been traversed (such as when there's a cycle), |
633 // the node is added to |nodes_with_back_links|. | 631 // the node is added to |nodes_with_back_links|. |
634 void CollectOpenerFrameTrees( | 632 void CollectOpenerFrameTrees( |
635 std::vector<FrameTree*>* opener_frame_trees, | 633 std::vector<FrameTree*>* opener_frame_trees, |
636 base::hash_set<FrameTreeNode*>* nodes_with_back_links); | 634 base::hash_set<FrameTreeNode*>* nodes_with_back_links); |
637 | 635 |
638 // Create swapped out RenderViews and RenderFrameProxies in the given | 636 // Create swapped out RenderViews and RenderFrameProxies in the given |
639 // SiteInstance for the current node's FrameTree. Used as a helper function | 637 // SiteInstance for the current node's FrameTree. Used as a helper function |
640 // in CreateOpenerProxies for creating proxies in each FrameTree on the | 638 // in CreateOpenerProxies for creating proxies in each FrameTree on the |
641 // opener chain. | 639 // opener chain. Don't create proxies for the subtree rooted at |
642 void CreateOpenerProxiesForFrameTree(SiteInstance* instance); | 640 // |skip_this_node|. |
| 641 void CreateOpenerProxiesForFrameTree(SiteInstance* instance, |
| 642 FrameTreeNode* skip_this_node); |
643 | 643 |
644 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. | 644 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. |
645 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, | 645 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, |
646 int32 view_routing_id, | 646 int32 view_routing_id, |
647 int32 frame_routing_id, | 647 int32 frame_routing_id, |
648 int32 widget_routing_id, | 648 int32 widget_routing_id, |
649 int32 surface_id, | 649 int32 surface_id, |
650 int flags); | 650 int flags); |
651 | 651 |
652 // PlzNavigate | 652 // PlzNavigate |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 bool should_reuse_web_ui_; | 818 bool should_reuse_web_ui_; |
819 | 819 |
820 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 820 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
821 | 821 |
822 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 822 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
823 }; | 823 }; |
824 | 824 |
825 } // namespace content | 825 } // namespace content |
826 | 826 |
827 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 827 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |