Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.h

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

Powered by Google App Engine
This is Rietveld 408576698