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

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

Issue 1816763002: OOPIF: Fix subframe back/forward after recreating FTNs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review comments Created 4 years, 8 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 19 matching lines...) Expand all
30 class CONTENT_EXPORT NavigationEntryImpl 30 class CONTENT_EXPORT NavigationEntryImpl
31 : public NON_EXPORTED_BASE(NavigationEntry) { 31 : public NON_EXPORTED_BASE(NavigationEntry) {
32 public: 32 public:
33 // Represents a tree of FrameNavigationEntries that make up this joint session 33 // Represents a tree of FrameNavigationEntries that make up this joint session
34 // history item. The tree currently only tracks the main frame by default, 34 // history item. The tree currently only tracks the main frame by default,
35 // and is populated with subframe nodes in --site-per-process mode. 35 // and is populated with subframe nodes in --site-per-process mode.
36 struct TreeNode { 36 struct TreeNode {
37 TreeNode(FrameNavigationEntry* frame_entry); 37 TreeNode(FrameNavigationEntry* frame_entry);
38 ~TreeNode(); 38 ~TreeNode();
39 39
40 // Returns whether this TreeNode corresponds to |frame_tree_node|. 40 // Returns whether this TreeNode corresponds to |frame_tree_node|, based on
41 bool MatchesFrame(FrameTreeNode* frame_tree_node) const; 41 // the FrameTreeNode ID or unique name. If the unique name matches and
42 // FrameTreeNode ID does not, then this will update the entry's
43 // FrameTreeNode ID (which may be stale if the node was recreated).
44 bool MatchesFrame(FrameTreeNode* frame_tree_node);
42 45
43 // Recursively makes a deep copy of TreeNode with copies of each of the 46 // Recursively makes a deep copy of TreeNode with copies of each of the
44 // FrameNavigationEntries in the subtree. Replaces the TreeNode 47 // FrameNavigationEntries in the subtree. Replaces the TreeNode
45 // corresponding to |frame_tree_node| (and all of its children) with a new 48 // corresponding to |frame_tree_node| (and all of its children) with a new
46 // TreeNode for |frame_navigation_entry|. Pass nullptr for both parameters 49 // TreeNode for |frame_navigation_entry|. Pass nullptr for both parameters
47 // to make a complete clone. 50 // to make a complete clone.
48 // TODO(creis): For --site-per-process, share FrameNavigationEntries between 51 // TODO(creis): For --site-per-process, share FrameNavigationEntries between
49 // NavigationEntries of the same tab. 52 // NavigationEntries of the same tab.
50 std::unique_ptr<TreeNode> CloneAndReplace( 53 std::unique_ptr<TreeNode> CloneAndReplace(
51 FrameTreeNode* frame_tree_node, 54 FrameTreeNode* frame_tree_node,
52 FrameNavigationEntry* frame_navigation_entry) const; 55 FrameNavigationEntry* frame_navigation_entry);
53 56
54 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as 57 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as
55 // it is needed by this node's NavigationEntry. 58 // it is needed by this node's NavigationEntry.
56 scoped_refptr<FrameNavigationEntry> frame_entry; 59 scoped_refptr<FrameNavigationEntry> frame_entry;
57 60
58 // List of child TreeNodes, which will be deleted when this node is. 61 // List of child TreeNodes, which will be deleted when this node is.
59 ScopedVector<TreeNode> children; 62 ScopedVector<TreeNode> children;
60 }; 63 };
61 64
62 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); 65 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 return frame_tree_.get(); 184 return frame_tree_.get();
182 } 185 }
183 186
184 // Finds the TreeNode associated with |frame_tree_node_id| to add or update 187 // Finds the TreeNode associated with |frame_tree_node_id| to add or update
185 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none 188 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none
186 // exists, or else the existing one (which might be shared with other 189 // exists, or else the existing one (which might be shared with other
187 // NavigationEntries) is updated with the given parameters. 190 // NavigationEntries) is updated with the given parameters.
188 // Does nothing if there is no entry already and |url| is about:blank, since 191 // Does nothing if there is no entry already and |url| is about:blank, since
189 // that does not count as a real commit. 192 // that does not count as a real commit.
190 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node, 193 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node,
191 const std::string& frame_unique_name,
192 int64_t item_sequence_number, 194 int64_t item_sequence_number,
193 int64_t document_sequence_number, 195 int64_t document_sequence_number,
194 SiteInstanceImpl* site_instance, 196 SiteInstanceImpl* site_instance,
195 const GURL& url, 197 const GURL& url,
196 const Referrer& referrer, 198 const Referrer& referrer,
197 const PageState& page_state); 199 const PageState& page_state);
198 200
199 // Returns the FrameNavigationEntry corresponding to |frame_tree_node|, if 201 // Returns the FrameNavigationEntry corresponding to |frame_tree_node|, if
200 // there is one in this NavigationEntry. 202 // there is one in this NavigationEntry. This compares against the
201 FrameNavigationEntry* GetFrameEntry(FrameTreeNode* frame_tree_node) const; 203 // FrameTreeNode ID first, and if that doesn't match, then the unique_name.
202 204 // It will update the FrameNavigationEntry's FrameTreeNode ID if it is stale.
203 // Returns the FrameNavigationEntry corresponding to the frame with the given 205 FrameNavigationEntry* GetFrameEntry(FrameTreeNode* frame_tree_node);
204 // |unique_name|, if any. This is useful when the FrameTreeNode cannot be used
205 // to find the entry, such as for a newly created subframe in a history
206 // navigation. Callers should update the FrameTreeNode ID of the entry so that
207 // it can be found with |GetFrameEntry| above.
208 // TODO(creis): Generate or verify the unique_name in the browser process.
209 FrameNavigationEntry* GetFrameEntryByUniqueName(
210 const std::string& unique_name) const;
211 206
212 void set_unique_id(int unique_id) { 207 void set_unique_id(int unique_id) {
213 unique_id_ = unique_id; 208 unique_id_ = unique_id;
214 } 209 }
215 210
216 // The SiteInstance represents which pages must share processes. This is a 211 // The SiteInstance represents which pages must share processes. This is a
217 // reference counted pointer to a shared SiteInstance. 212 // reference counted pointer to a shared SiteInstance.
218 // 213 //
219 // Note that the SiteInstance should usually not be changed after it is set, 214 // Note that the SiteInstance should usually not be changed after it is set,
220 // but this may happen if the NavigationEntry was cloned and needs to use a 215 // but this may happen if the NavigationEntry was cloned and needs to use a
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return has_user_gesture_; 352 return has_user_gesture_;
358 } 353 }
359 354
360 void set_has_user_gesture (bool has_user_gesture) { 355 void set_has_user_gesture (bool has_user_gesture) {
361 has_user_gesture_ = has_user_gesture; 356 has_user_gesture_ = has_user_gesture;
362 } 357 }
363 #endif 358 #endif
364 359
365 private: 360 private:
366 // Finds the TreeNode associated with |frame_tree_node|, if any. 361 // Finds the TreeNode associated with |frame_tree_node|, if any.
367 NavigationEntryImpl::TreeNode* FindFrameEntry( 362 NavigationEntryImpl::TreeNode* FindFrameEntry(FrameTreeNode* frame_tree_node);
368 FrameTreeNode* frame_tree_node) const;
369 363
370 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 364 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
371 // Session/Tab restore save portions of this class so that it can be recreated 365 // Session/Tab restore save portions of this class so that it can be recreated
372 // later. If you add a new field that needs to be persisted you'll have to 366 // later. If you add a new field that needs to be persisted you'll have to
373 // update SessionService/TabRestoreService and Android WebView 367 // update SessionService/TabRestoreService and Android WebView
374 // state_serializer.cc appropriately. 368 // state_serializer.cc appropriately.
375 // For all new fields, update |Clone| and possibly |ResetForCommit|. 369 // For all new fields, update |Clone| and possibly |ResetForCommit|.
376 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 370 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
377 371
378 // Tree of FrameNavigationEntries, one for each frame on the page. 372 // Tree of FrameNavigationEntries, one for each frame on the page.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // persisted, unless specific data is taken out/put back in at save/restore 496 // persisted, unless specific data is taken out/put back in at save/restore
503 // time (see TabNavigation for an example of this). 497 // time (see TabNavigation for an example of this).
504 std::map<std::string, base::string16> extra_data_; 498 std::map<std::string, base::string16> extra_data_;
505 499
506 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); 500 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl);
507 }; 501 };
508 502
509 } // namespace content 503 } // namespace content
510 504
511 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ 505 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698