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|. | |
38 bool MatchesFrame(FrameTreeNode* frame_tree_node) const; | |
39 | |
37 // Returns a deep copy of the tree with copies of each node's | 40 // Returns a deep copy of the tree with copies of each node's |
38 // FrameNavigationEntries. We do not yet share FrameNavigationEntries | 41 // FrameNavigationEntries. Replaces the TreeNode corresponding to |
39 // across trees. | 42 // |frame_tree_node| (and all of its children) with a new TreeNode for |
43 // |frame_navigation_entry|. Pass nullptr for both for a complete clone. | |
Avi (use Gerrit)
2015/05/19 16:34:13
I'm pondering this comment.
1. "with copies of ea
Charlie Reis
2015/05/19 17:59:24
We're not sharing FNEs just yet (hence the TODO be
| |
44 // | |
40 // TODO(creis): For --site-per-process, share FrameNavigationEntries between | 45 // TODO(creis): For --site-per-process, share FrameNavigationEntries between |
41 // NavigationEntries of the same tab. | 46 // NavigationEntries of the same tab. |
42 TreeNode* Clone() const; | 47 TreeNode* CloneAndReplace( |
48 FrameTreeNode* frame_tree_node, | |
49 FrameNavigationEntry* frame_navigation_entry) const; | |
43 | 50 |
44 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as | 51 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as |
45 // it is needed by this node's NavigationEntry. | 52 // it is needed by this node's NavigationEntry. |
46 scoped_refptr<FrameNavigationEntry> frame_entry; | 53 scoped_refptr<FrameNavigationEntry> frame_entry; |
47 | 54 |
48 // 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. |
49 ScopedVector<TreeNode> children; | 56 ScopedVector<TreeNode> children; |
50 }; | 57 }; |
51 | 58 |
52 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); | 59 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 void ClearExtraData(const std::string& key) override; | 119 void ClearExtraData(const std::string& key) override; |
113 void SetHttpStatusCode(int http_status_code) override; | 120 void SetHttpStatusCode(int http_status_code) override; |
114 int GetHttpStatusCode() const override; | 121 int GetHttpStatusCode() const override; |
115 void SetRedirectChain(const std::vector<GURL>& redirects) override; | 122 void SetRedirectChain(const std::vector<GURL>& redirects) override; |
116 const std::vector<GURL>& GetRedirectChain() const override; | 123 const std::vector<GURL>& GetRedirectChain() const override; |
117 bool IsRestored() const override; | 124 bool IsRestored() const override; |
118 | 125 |
119 // Creates a copy of this NavigationEntryImpl that can be modified | 126 // Creates a copy of this NavigationEntryImpl that can be modified |
120 // independently from the original. Does not copy any value that would be | 127 // independently from the original. Does not copy any value that would be |
121 // cleared in ResetForCommit. | 128 // cleared in ResetForCommit. |
129 NavigationEntryImpl* Clone() const; | |
130 | |
131 // Like |Clone|, but replaces the FrameNavigationEntry corresponding to | |
132 // |frame_tree_node| (and all its children) with |frame_entry|. | |
122 // TODO(creis): Once we start sharing FrameNavigationEntries between | 133 // TODO(creis): Once we start sharing FrameNavigationEntries between |
123 // NavigationEntryImpls, we will need to support two versions of Clone: one | 134 // NavigationEntryImpls, we will need to support two versions of Clone: one |
124 // that shares the existing FrameNavigationEntries (for use within the same | 135 // that shares the existing FrameNavigationEntries (for use within the same |
125 // tab) and one that draws them from a different pool (for use in a new tab). | 136 // tab) and one that draws them from a different pool (for use in a new tab). |
126 NavigationEntryImpl* Clone() const; | 137 NavigationEntryImpl* CloneAndReplace(FrameTreeNode* frame_tree_node, |
138 FrameNavigationEntry* frame_entry) const; | |
127 | 139 |
128 // Helper functions to construct NavigationParameters for a navigation to this | 140 // Helper functions to construct NavigationParameters for a navigation to this |
129 // NavigationEntry. | 141 // NavigationEntry. |
130 CommonNavigationParams ConstructCommonNavigationParams( | 142 CommonNavigationParams ConstructCommonNavigationParams( |
131 FrameMsg_Navigate_Type::Value navigation_type) const; | 143 FrameMsg_Navigate_Type::Value navigation_type) const; |
132 StartNavigationParams ConstructStartNavigationParams() const; | 144 StartNavigationParams ConstructStartNavigationParams() const; |
133 RequestNavigationParams ConstructRequestNavigationParams( | 145 RequestNavigationParams ConstructRequestNavigationParams( |
134 base::TimeTicks navigation_start, | 146 base::TimeTicks navigation_start, |
135 bool intended_as_new_entry, | 147 bool intended_as_new_entry, |
136 int pending_offset_to_send, | 148 int pending_offset_to_send, |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 // persisted, unless specific data is taken out/put back in at save/restore | 444 // persisted, unless specific data is taken out/put back in at save/restore |
433 // time (see TabNavigation for an example of this). | 445 // time (see TabNavigation for an example of this). |
434 std::map<std::string, base::string16> extra_data_; | 446 std::map<std::string, base::string16> extra_data_; |
435 | 447 |
436 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); | 448 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); |
437 }; | 449 }; |
438 | 450 |
439 } // namespace content | 451 } // namespace content |
440 | 452 |
441 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ | 453 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ |
OLD | NEW |