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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 struct CommonNavigationParams; | 23 struct CommonNavigationParams; |
24 struct RequestNavigationParams; | 24 struct RequestNavigationParams; |
25 struct StartNavigationParams; | 25 struct StartNavigationParams; |
26 | 26 |
27 class CONTENT_EXPORT NavigationEntryImpl | 27 class CONTENT_EXPORT NavigationEntryImpl |
28 : public NON_EXPORTED_BASE(NavigationEntry) { | 28 : public NON_EXPORTED_BASE(NavigationEntry) { |
29 public: | 29 public: |
30 // Represents a tree of FrameNavigationEntries that make up this joint session | 30 // Represents a tree of FrameNavigationEntries that make up this joint session |
31 // history item. The tree currently only tracks the main frame. | 31 // history item. The tree currently only tracks the main frame by default, |
32 // TODO(creis): Populate the tree with subframe entries in --site-per-process. | 32 // and is populated with subframe nodes in --site-per-process mode. |
33 struct TreeNode { | 33 struct TreeNode { |
34 TreeNode(FrameNavigationEntry* frame_entry); | 34 TreeNode(FrameNavigationEntry* frame_entry); |
35 ~TreeNode(); | 35 ~TreeNode(); |
36 | 36 |
37 // Returns whether this TreeNode corresponds to |frame_tree_node|. | 37 // Returns whether this TreeNode corresponds to |frame_tree_node|. |
38 bool MatchesFrame(FrameTreeNode* frame_tree_node) const; | 38 bool MatchesFrame(FrameTreeNode* frame_tree_node) const; |
39 | 39 |
40 // Returns a deep copy of the tree with copies of each node's | 40 // Recursively makes a deep copy of TreeNode with copies of each of the |
41 // FrameNavigationEntries. We do not yet share FrameNavigationEntries | 41 // FrameNavigationEntries in the subtree. Replaces the TreeNode |
42 // across trees. | 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 |
| 44 // to make a complete clone. |
43 // TODO(creis): For --site-per-process, share FrameNavigationEntries between | 45 // TODO(creis): For --site-per-process, share FrameNavigationEntries between |
44 // NavigationEntries of the same tab. | 46 // NavigationEntries of the same tab. |
45 TreeNode* Clone() const; | 47 scoped_ptr<TreeNode> CloneAndReplace( |
| 48 FrameTreeNode* frame_tree_node, |
| 49 FrameNavigationEntry* frame_navigation_entry) const; |
46 | 50 |
47 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as | 51 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as |
48 // it is needed by this node's NavigationEntry. | 52 // it is needed by this node's NavigationEntry. |
49 scoped_refptr<FrameNavigationEntry> frame_entry; | 53 scoped_refptr<FrameNavigationEntry> frame_entry; |
50 | 54 |
51 // List of child TreeNodes, which will be deleted when this node is. | 55 // List of child TreeNodes, which will be deleted when this node is. |
52 ScopedVector<TreeNode> children; | 56 ScopedVector<TreeNode> children; |
53 }; | 57 }; |
54 | 58 |
55 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); | 59 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void ClearExtraData(const std::string& key) override; | 121 void ClearExtraData(const std::string& key) override; |
118 void SetHttpStatusCode(int http_status_code) override; | 122 void SetHttpStatusCode(int http_status_code) override; |
119 int GetHttpStatusCode() const override; | 123 int GetHttpStatusCode() const override; |
120 void SetRedirectChain(const std::vector<GURL>& redirects) override; | 124 void SetRedirectChain(const std::vector<GURL>& redirects) override; |
121 const std::vector<GURL>& GetRedirectChain() const override; | 125 const std::vector<GURL>& GetRedirectChain() const override; |
122 bool IsRestored() const override; | 126 bool IsRestored() const override; |
123 | 127 |
124 // Creates a copy of this NavigationEntryImpl that can be modified | 128 // Creates a copy of this NavigationEntryImpl that can be modified |
125 // independently from the original. Does not copy any value that would be | 129 // independently from the original. Does not copy any value that would be |
126 // cleared in ResetForCommit. | 130 // cleared in ResetForCommit. |
| 131 NavigationEntryImpl* Clone() const; |
| 132 |
| 133 // Like |Clone|, but replaces the FrameNavigationEntry corresponding to |
| 134 // |frame_tree_node| (and all its children) with |frame_entry|. |
127 // TODO(creis): Once we start sharing FrameNavigationEntries between | 135 // TODO(creis): Once we start sharing FrameNavigationEntries between |
128 // NavigationEntryImpls, we will need to support two versions of Clone: one | 136 // NavigationEntryImpls, we will need to support two versions of Clone: one |
129 // that shares the existing FrameNavigationEntries (for use within the same | 137 // that shares the existing FrameNavigationEntries (for use within the same |
130 // tab) and one that draws them from a different pool (for use in a new tab). | 138 // tab) and one that draws them from a different pool (for use in a new tab). |
131 NavigationEntryImpl* Clone() const; | 139 NavigationEntryImpl* CloneAndReplace(FrameTreeNode* frame_tree_node, |
| 140 FrameNavigationEntry* frame_entry) const; |
132 | 141 |
133 // Helper functions to construct NavigationParameters for a navigation to this | 142 // Helper functions to construct NavigationParameters for a navigation to this |
134 // NavigationEntry. | 143 // NavigationEntry. |
135 CommonNavigationParams ConstructCommonNavigationParams( | 144 CommonNavigationParams ConstructCommonNavigationParams( |
136 FrameMsg_Navigate_Type::Value navigation_type) const; | 145 FrameMsg_Navigate_Type::Value navigation_type) const; |
137 StartNavigationParams ConstructStartNavigationParams() const; | 146 StartNavigationParams ConstructStartNavigationParams() const; |
138 RequestNavigationParams ConstructRequestNavigationParams( | 147 RequestNavigationParams ConstructRequestNavigationParams( |
139 base::TimeTicks navigation_start, | 148 base::TimeTicks navigation_start, |
140 bool has_committed_real_load, | 149 bool has_committed_real_load, |
141 bool intended_as_new_entry, | 150 bool intended_as_new_entry, |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 // persisted, unless specific data is taken out/put back in at save/restore | 457 // persisted, unless specific data is taken out/put back in at save/restore |
449 // time (see TabNavigation for an example of this). | 458 // time (see TabNavigation for an example of this). |
450 std::map<std::string, base::string16> extra_data_; | 459 std::map<std::string, base::string16> extra_data_; |
451 | 460 |
452 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); | 461 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); |
453 }; | 462 }; |
454 | 463 |
455 } // namespace content | 464 } // namespace content |
456 | 465 |
457 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ | 466 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ |
OLD | NEW |