| 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_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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Recursively makes a deep copy of TreeNode with copies of each of the | 40 // Recursively makes a deep copy of TreeNode with copies of each of the |
| 41 // FrameNavigationEntries in the subtree. Replaces the TreeNode | 41 // FrameNavigationEntries in the subtree. Replaces the TreeNode |
| 42 // corresponding to |frame_tree_node| (and all of its children) with a new | 42 // corresponding to |frame_tree_node| (and all of its children) with a new |
| 43 // TreeNode for |frame_navigation_entry|. Pass nullptr for both parameters | 43 // TreeNode for |frame_navigation_entry|. Pass nullptr for both parameters |
| 44 // to make a complete clone. | 44 // to make a complete clone. |
| 45 // TODO(creis): For --site-per-process, share FrameNavigationEntries between | 45 // TODO(creis): For --site-per-process, share FrameNavigationEntries between |
| 46 // NavigationEntries of the same tab. | 46 // NavigationEntries of the same tab. |
| 47 scoped_ptr<TreeNode> CloneAndReplace( | 47 scoped_ptr<TreeNode> CloneAndReplace( |
| 48 FrameTreeNode* frame_tree_node, | 48 FrameTreeNode* frame_tree_node, |
| 49 FrameNavigationEntry* frame_navigation_entry) const; | 49 FrameNavigationEntry* frame_navigation_entry, |
| 50 bool clone_children_of_target) const; |
| 50 | 51 |
| 51 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as | 52 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as |
| 52 // it is needed by this node's NavigationEntry. | 53 // it is needed by this node's NavigationEntry. |
| 53 scoped_refptr<FrameNavigationEntry> frame_entry; | 54 scoped_refptr<FrameNavigationEntry> frame_entry; |
| 54 | 55 |
| 55 // List of child TreeNodes, which will be deleted when this node is. | 56 // List of child TreeNodes, which will be deleted when this node is. |
| 56 ScopedVector<TreeNode> children; | 57 ScopedVector<TreeNode> children; |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); | 60 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // cleared in ResetForCommit. | 133 // cleared in ResetForCommit. |
| 133 scoped_ptr<NavigationEntryImpl> Clone() const; | 134 scoped_ptr<NavigationEntryImpl> Clone() const; |
| 134 | 135 |
| 135 // Like |Clone|, but replaces the FrameNavigationEntry corresponding to | 136 // Like |Clone|, but replaces the FrameNavigationEntry corresponding to |
| 136 // |frame_tree_node| (and all its children) with |frame_entry|. | 137 // |frame_tree_node| (and all its children) with |frame_entry|. |
| 137 // TODO(creis): Once we start sharing FrameNavigationEntries between | 138 // TODO(creis): Once we start sharing FrameNavigationEntries between |
| 138 // NavigationEntryImpls, we will need to support two versions of Clone: one | 139 // NavigationEntryImpls, we will need to support two versions of Clone: one |
| 139 // that shares the existing FrameNavigationEntries (for use within the same | 140 // that shares the existing FrameNavigationEntries (for use within the same |
| 140 // tab) and one that draws them from a different pool (for use in a new tab). | 141 // tab) and one that draws them from a different pool (for use in a new tab). |
| 141 scoped_ptr<NavigationEntryImpl> CloneAndReplace( | 142 scoped_ptr<NavigationEntryImpl> CloneAndReplace( |
| 142 FrameTreeNode* frame_tree_node, FrameNavigationEntry* frame_entry) const; | 143 FrameTreeNode* frame_tree_node, |
| 144 FrameNavigationEntry* frame_entry, |
| 145 bool clone_children_of_target) const; |
| 143 | 146 |
| 144 // Helper functions to construct NavigationParameters for a navigation to this | 147 // Helper functions to construct NavigationParameters for a navigation to this |
| 145 // NavigationEntry. | 148 // NavigationEntry. |
| 146 CommonNavigationParams ConstructCommonNavigationParams( | 149 CommonNavigationParams ConstructCommonNavigationParams( |
| 147 const GURL& dest_url, | 150 const GURL& dest_url, |
| 148 const Referrer& dest_referrer, | 151 const Referrer& dest_referrer, |
| 149 const FrameNavigationEntry& frame_entry, | 152 const FrameNavigationEntry& frame_entry, |
| 150 FrameMsg_Navigate_Type::Value navigation_type) const; | 153 FrameMsg_Navigate_Type::Value navigation_type) const; |
| 151 StartNavigationParams ConstructStartNavigationParams() const; | 154 StartNavigationParams ConstructStartNavigationParams() const; |
| 152 RequestNavigationParams ConstructRequestNavigationParams( | 155 RequestNavigationParams ConstructRequestNavigationParams( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 164 void ResetForCommit(); | 167 void ResetForCommit(); |
| 165 | 168 |
| 166 // Exposes the tree of FrameNavigationEntries that make up this joint session | 169 // Exposes the tree of FrameNavigationEntries that make up this joint session |
| 167 // history item. | 170 // history item. |
| 168 // In default Chrome, this tree only has a root node with an unshared | 171 // In default Chrome, this tree only has a root node with an unshared |
| 169 // FrameNavigationEntry. Subframes are only added to the tree if the | 172 // FrameNavigationEntry. Subframes are only added to the tree if the |
| 170 // --site-per-process flag is passed. | 173 // --site-per-process flag is passed. |
| 171 TreeNode* root_node() const { | 174 TreeNode* root_node() const { |
| 172 return frame_tree_.get(); | 175 return frame_tree_.get(); |
| 173 } | 176 } |
| 177 // TODO(creis): Avoid exposing this. |
| 178 void set_root_node(scoped_ptr<TreeNode> root_node) { |
| 179 frame_tree_ = root_node.Pass(); |
| 180 } |
| 174 | 181 |
| 175 // Finds the TreeNode associated with |frame_tree_node_id| to add or update | 182 // Finds the TreeNode associated with |frame_tree_node_id| to add or update |
| 176 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none | 183 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none |
| 177 // exists, or else the existing one (which might be shared with other | 184 // exists, or else the existing one (which might be shared with other |
| 178 // NavigationEntries) is updated with the given parameters. | 185 // NavigationEntries) is updated with the given parameters. |
| 179 // Does nothing if there is no entry already and |url| is about:blank, since | 186 // Does nothing if there is no entry already and |url| is about:blank, since |
| 180 // that does not count as a real commit. | 187 // that does not count as a real commit. |
| 181 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node, | 188 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node, |
| 182 int64 item_sequence_number, | 189 int64 item_sequence_number, |
| 183 int64 document_sequence_number, | 190 int64 document_sequence_number, |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 // persisted, unless specific data is taken out/put back in at save/restore | 484 // persisted, unless specific data is taken out/put back in at save/restore |
| 478 // time (see TabNavigation for an example of this). | 485 // time (see TabNavigation for an example of this). |
| 479 std::map<std::string, base::string16> extra_data_; | 486 std::map<std::string, base::string16> extra_data_; |
| 480 | 487 |
| 481 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); | 488 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); |
| 482 }; | 489 }; |
| 483 | 490 |
| 484 } // namespace content | 491 } // namespace content |
| 485 | 492 |
| 486 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ | 493 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ |
| OLD | NEW |