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

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

Issue 2161393002: Clone children of FrameNavigationEntries for in-page navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 4 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_NAVIGATION_ENTRY_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 30 matching lines...) Expand all
41 41
42 // Returns whether this TreeNode corresponds to |frame_tree_node|. If this 42 // Returns whether this TreeNode corresponds to |frame_tree_node|. If this
43 // is called on the root TreeNode, then |is_root_tree_node| should be true 43 // is called on the root TreeNode, then |is_root_tree_node| should be true
44 // and we only check if |frame_tree_node| is the main frame. Otherwise, we 44 // and we only check if |frame_tree_node| is the main frame. Otherwise, we
45 // check if the unique name matches. 45 // check if the unique name matches.
46 bool MatchesFrame(FrameTreeNode* frame_tree_node, 46 bool MatchesFrame(FrameTreeNode* frame_tree_node,
47 bool is_root_tree_node) const; 47 bool is_root_tree_node) const;
48 48
49 // Recursively makes a deep copy of TreeNode with copies of each of the 49 // Recursively makes a deep copy of TreeNode with copies of each of the
50 // FrameNavigationEntries in the subtree. Replaces the TreeNode 50 // FrameNavigationEntries in the subtree. Replaces the TreeNode
51 // corresponding to |frame_tree_node| (and all of its children) with a new 51 // corresponding to |target_frame_tree_node|, clearing all of its children
52 // TreeNode for |frame_navigation_entry|. Pass nullptr for both parameters 52 // unless |clone_children_of_target| is true. This function omits any
53 // to make a complete clone. 53 // subframe history items that do not correspond to frames actually in the
54 // current page, using |current_frame_tree_node| (if present).
54 // |is_root_tree_node| indicates whether this is being called on the root 55 // |is_root_tree_node| indicates whether this is being called on the root
55 // NavigationEntryImpl::TreeNode. 56 // NavigationEntryImpl::TreeNode.
56 // TODO(creis): For --site-per-process, share FrameNavigationEntries between 57 // TODO(creis): For --site-per-process, share FrameNavigationEntries between
57 // NavigationEntries of the same tab. 58 // NavigationEntries of the same tab.
58 std::unique_ptr<TreeNode> CloneAndReplace( 59 std::unique_ptr<TreeNode> CloneAndReplace(
59 FrameTreeNode* frame_tree_node,
60 FrameNavigationEntry* frame_navigation_entry, 60 FrameNavigationEntry* frame_navigation_entry,
61 bool clone_children_of_target,
62 FrameTreeNode* target_frame_tree_node,
63 FrameTreeNode* current_frame_tree_node,
61 bool is_root_tree_node) const; 64 bool is_root_tree_node) const;
62 65
63 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as 66 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as
64 // it is needed by this node's NavigationEntry. 67 // it is needed by this node's NavigationEntry.
65 scoped_refptr<FrameNavigationEntry> frame_entry; 68 scoped_refptr<FrameNavigationEntry> frame_entry;
66 69
67 // List of child TreeNodes, which will be deleted when this node is. 70 // List of child TreeNodes, which will be deleted when this node is.
68 ScopedVector<TreeNode> children; 71 ScopedVector<TreeNode> children;
69 }; 72 };
70 73
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 base::string16* data) const override; 142 base::string16* data) const override;
140 void ClearExtraData(const std::string& key) override; 143 void ClearExtraData(const std::string& key) override;
141 void SetHttpStatusCode(int http_status_code) override; 144 void SetHttpStatusCode(int http_status_code) override;
142 int GetHttpStatusCode() const override; 145 int GetHttpStatusCode() const override;
143 void SetRedirectChain(const std::vector<GURL>& redirects) override; 146 void SetRedirectChain(const std::vector<GURL>& redirects) override;
144 const std::vector<GURL>& GetRedirectChain() const override; 147 const std::vector<GURL>& GetRedirectChain() const override;
145 bool IsRestored() const override; 148 bool IsRestored() const override;
146 149
147 // Creates a copy of this NavigationEntryImpl that can be modified 150 // Creates a copy of this NavigationEntryImpl that can be modified
148 // independently from the original. Does not copy any value that would be 151 // independently from the original. Does not copy any value that would be
149 // cleared in ResetForCommit. 152 // cleared in ResetForCommit. Unlike |CloneAndReplace|, this does not check
153 // whether the subframe history items are for frames that are still in the
154 // current page.
150 std::unique_ptr<NavigationEntryImpl> Clone() const; 155 std::unique_ptr<NavigationEntryImpl> Clone() const;
151 156
152 // Like |Clone|, but replaces the FrameNavigationEntry corresponding to 157 // Like |Clone|, but replaces the FrameNavigationEntry corresponding to
153 // |frame_tree_node| (and all its children) with |frame_entry|. 158 // |target_frame_tree_node| with |frame_entry|, clearing all of its children
159 // unless |clone_children_of_target| is true. This function omits any
160 // subframe history items that do not correspond to frames actually in the
161 // current page, using |root_frame_tree_node| (if present).
162 //
154 // TODO(creis): Once we start sharing FrameNavigationEntries between 163 // TODO(creis): Once we start sharing FrameNavigationEntries between
155 // NavigationEntryImpls, we will need to support two versions of Clone: one 164 // NavigationEntryImpls, we will need to support two versions of Clone: one
156 // that shares the existing FrameNavigationEntries (for use within the same 165 // that shares the existing FrameNavigationEntries (for use within the same
157 // tab) and one that draws them from a different pool (for use in a new tab). 166 // tab) and one that draws them from a different pool (for use in a new tab).
158 std::unique_ptr<NavigationEntryImpl> CloneAndReplace( 167 std::unique_ptr<NavigationEntryImpl> CloneAndReplace(
159 FrameTreeNode* frame_tree_node, 168 FrameNavigationEntry* frame_entry,
160 FrameNavigationEntry* frame_entry) const; 169 bool clone_children_of_target,
170 FrameTreeNode* target_frame_tree_node,
171 FrameTreeNode* root_frame_tree_node) const;
161 172
162 // Helper functions to construct NavigationParameters for a navigation to this 173 // Helper functions to construct NavigationParameters for a navigation to this
163 // NavigationEntry. 174 // NavigationEntry.
164 CommonNavigationParams ConstructCommonNavigationParams( 175 CommonNavigationParams ConstructCommonNavigationParams(
165 const FrameNavigationEntry& frame_entry, 176 const FrameNavigationEntry& frame_entry,
166 const scoped_refptr<ResourceRequestBodyImpl>& post_body, 177 const scoped_refptr<ResourceRequestBodyImpl>& post_body,
167 const GURL& dest_url, 178 const GURL& dest_url,
168 const Referrer& dest_referrer, 179 const Referrer& dest_referrer,
169 FrameMsg_Navigate_Type::Value navigation_type, 180 FrameMsg_Navigate_Type::Value navigation_type,
170 LoFiState lofi_state, 181 LoFiState lofi_state,
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // persisted, unless specific data is taken out/put back in at save/restore 522 // persisted, unless specific data is taken out/put back in at save/restore
512 // time (see TabNavigation for an example of this). 523 // time (see TabNavigation for an example of this).
513 std::map<std::string, base::string16> extra_data_; 524 std::map<std::string, base::string16> extra_data_;
514 525
515 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); 526 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl);
516 }; 527 };
517 528
518 } // namespace content 529 } // namespace content
519 530
520 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ 531 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698