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 COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_ENTRY_H_ | 5 #ifndef COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_ENTRY_H_ |
6 #define COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_ENTRY_H_ | 6 #define COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_ENTRY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 const sync_pb::TabNavigation& sync_data); | 72 const sync_pb::TabNavigation& sync_data); |
73 | 73 |
74 // Note that not all SerializedNavigationEntry fields are preserved. | 74 // Note that not all SerializedNavigationEntry fields are preserved. |
75 // |max_size| is the max number of bytes to write. | 75 // |max_size| is the max number of bytes to write. |
76 void WriteToPickle(int max_size, base::Pickle* pickle) const; | 76 void WriteToPickle(int max_size, base::Pickle* pickle) const; |
77 bool ReadFromPickle(base::PickleIterator* iterator); | 77 bool ReadFromPickle(base::PickleIterator* iterator); |
78 | 78 |
79 // Convert this navigation into its sync protocol buffer equivalent. Note | 79 // Convert this navigation into its sync protocol buffer equivalent. Note |
80 // that the protocol buffer doesn't contain all SerializedNavigationEntry | 80 // that the protocol buffer doesn't contain all SerializedNavigationEntry |
81 // fields. | 81 // fields. |
82 sync_pb::TabNavigation ToSyncData() const; | 82 sync_pb::TabNavigation ToSyncData() const; |
Patrick Noland
2017/03/24 20:51:57
I think you'll need to update the definition of To
shenchao
2017/03/25 23:53:13
Done.
| |
83 | 83 |
84 // The index in the NavigationController. This SerializedNavigationEntry is | 84 // The index in the NavigationController. This SerializedNavigationEntry is |
85 // valid only when the index is non-negative. | 85 // valid only when the index is non-negative. |
86 int index() const { return index_; } | 86 int index() const { return index_; } |
87 void set_index(int index) { index_ = index; } | 87 void set_index(int index) { index_ = index; } |
88 | 88 |
89 // Accessors for some fields taken from NavigationEntry. | 89 // Accessors for some fields taken from NavigationEntry. |
90 int unique_id() const { return unique_id_; } | 90 int unique_id() const { return unique_id_; } |
91 const GURL& virtual_url() const { return virtual_url_; } | 91 const GURL& virtual_url() const { return virtual_url_; } |
92 const base::string16& title() const { return title_; } | 92 const base::string16& title() const { return title_; } |
(...skipping 28 matching lines...) Expand all Loading... | |
121 void set_content_pack_categories( | 121 void set_content_pack_categories( |
122 const std::set<std::string>& content_pack_categories) { | 122 const std::set<std::string>& content_pack_categories) { |
123 content_pack_categories_ = content_pack_categories; | 123 content_pack_categories_ = content_pack_categories; |
124 } | 124 } |
125 const std::vector<GURL>& redirect_chain() const { return redirect_chain_; } | 125 const std::vector<GURL>& redirect_chain() const { return redirect_chain_; } |
126 | 126 |
127 const std::map<std::string, std::string>& extended_info_map() const { | 127 const std::map<std::string, std::string>& extended_info_map() const { |
128 return extended_info_map_; | 128 return extended_info_map_; |
129 } | 129 } |
130 | 130 |
131 const std::vector<int64_t>& get_task_id() const { return task_id_; } | |
132 void set_task_id(const std::vector<int64_t>& task_id) { task_id_ = task_id; } | |
133 | |
131 size_t EstimateMemoryUsage() const; | 134 size_t EstimateMemoryUsage() const; |
132 | 135 |
133 private: | 136 private: |
134 friend class ContentSerializedNavigationBuilder; | 137 friend class ContentSerializedNavigationBuilder; |
135 friend class ContentSerializedNavigationDriver; | 138 friend class ContentSerializedNavigationDriver; |
136 friend class SerializedNavigationEntryTestHelper; | 139 friend class SerializedNavigationEntryTestHelper; |
137 friend class IOSSerializedNavigationBuilder; | 140 friend class IOSSerializedNavigationBuilder; |
138 friend class IOSSerializedNavigationDriver; | 141 friend class IOSSerializedNavigationDriver; |
139 | 142 |
140 // Index in the NavigationController. | 143 // Index in the NavigationController. |
(...skipping 21 matching lines...) Expand all Loading... | |
162 std::vector<GURL> redirect_chain_; // Not persisted. | 165 std::vector<GURL> redirect_chain_; // Not persisted. |
163 | 166 |
164 // Additional information. | 167 // Additional information. |
165 BlockedState blocked_state_; | 168 BlockedState blocked_state_; |
166 PasswordState password_state_; | 169 PasswordState password_state_; |
167 std::set<std::string> content_pack_categories_; | 170 std::set<std::string> content_pack_categories_; |
168 | 171 |
169 // Provides storage for arbitrary key/value pairs used by features. This | 172 // Provides storage for arbitrary key/value pairs used by features. This |
170 // data is not synced. | 173 // data is not synced. |
171 std::map<std::string, std::string> extended_info_map_; | 174 std::map<std::string, std::string> extended_info_map_; |
175 | |
176 // Task id of a Chrome task, which is prefixed by its parent task. | |
Patrick Noland
2017/03/24 20:51:57
Can you explain the prefixing more fully; i.e. it'
shenchao
2017/03/25 23:53:13
Move it above to the variables corresponding to Na
| |
177 std::vector<int64_t> task_id_; | |
172 }; | 178 }; |
173 | 179 |
174 } // namespace sessions | 180 } // namespace sessions |
175 | 181 |
176 #endif // COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_ENTRY_H_ | 182 #endif // COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_ENTRY_H_ |
OLD | NEW |