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_SERIALIZED_NAVIGATION_ENTRY_H_ | 5 #ifndef COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ |
6 #define COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ | 6 #define COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "components/sessions/sessions_export.h" | 16 #include "components/sessions/sessions_export.h" |
17 #include "content/public/common/page_state.h" | 17 #include "content/public/common/page_state.h" |
marja
2014/10/20 07:43:16
These content/ includes can now be removed, right?
rohitrao (ping after 24h)
2014/10/20 13:24:49
Moved to various .cc files as needed.
| |
18 #include "content/public/common/referrer.h" | 18 #include "content/public/common/referrer.h" |
19 #include "ui/base/page_transition_types.h" | 19 #include "ui/base/page_transition_types.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 class Pickle; | 22 class Pickle; |
23 class PickleIterator; | 23 class PickleIterator; |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 class BrowserContext; | 26 class BrowserContext; |
27 class NavigationEntry; | 27 class NavigationEntry; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 | 90 |
91 // The index in the NavigationController. This SerializedNavigationEntry is | 91 // The index in the NavigationController. This SerializedNavigationEntry is |
92 // valid only when the index is non-negative. | 92 // valid only when the index is non-negative. |
93 int index() const { return index_; } | 93 int index() const { return index_; } |
94 void set_index(int index) { index_ = index; } | 94 void set_index(int index) { index_ = index; } |
95 | 95 |
96 // Accessors for some fields taken from NavigationEntry. | 96 // Accessors for some fields taken from NavigationEntry. |
97 int unique_id() const { return unique_id_; } | 97 int unique_id() const { return unique_id_; } |
98 const GURL& virtual_url() const { return virtual_url_; } | 98 const GURL& virtual_url() const { return virtual_url_; } |
99 const base::string16& title() const { return title_; } | 99 const base::string16& title() const { return title_; } |
100 const content::PageState& page_state() const { return page_state_; } | 100 const std::string& encoded_page_state() const { return encoded_page_state_; } |
101 const base::string16& search_terms() const { return search_terms_; } | 101 const base::string16& search_terms() const { return search_terms_; } |
102 const GURL& favicon_url() const { return favicon_url_; } | 102 const GURL& favicon_url() const { return favicon_url_; } |
103 int http_status_code() const { return http_status_code_; } | 103 int http_status_code() const { return http_status_code_; } |
104 const content::Referrer& referrer() const { return referrer_; } | 104 const GURL& referrer_url() const { return referrer_url_; } |
105 int referrer_policy() const { return referrer_policy_; } | |
105 ui::PageTransition transition_type() const { | 106 ui::PageTransition transition_type() const { |
106 return transition_type_; | 107 return transition_type_; |
107 } | 108 } |
108 bool has_post_data() const { return has_post_data_; } | 109 bool has_post_data() const { return has_post_data_; } |
109 int64 post_id() const { return post_id_; } | 110 int64 post_id() const { return post_id_; } |
110 const GURL& original_request_url() const { return original_request_url_; } | 111 const GURL& original_request_url() const { return original_request_url_; } |
111 bool is_overriding_user_agent() const { return is_overriding_user_agent_; } | 112 bool is_overriding_user_agent() const { return is_overriding_user_agent_; } |
112 base::Time timestamp() const { return timestamp_; } | 113 base::Time timestamp() const { return timestamp_; } |
113 | 114 |
114 BlockedState blocked_state() { return blocked_state_; } | 115 BlockedState blocked_state() { return blocked_state_; } |
(...skipping 12 matching lines...) Expand all Loading... | |
127 // Converts a set of SerializedNavigationEntrys into a list of | 128 // Converts a set of SerializedNavigationEntrys into a list of |
128 // NavigationEntrys with sequential page IDs and the given context. The caller | 129 // NavigationEntrys with sequential page IDs and the given context. The caller |
129 // owns the returned NavigationEntrys. | 130 // owns the returned NavigationEntrys. |
130 static std::vector<content::NavigationEntry*> ToNavigationEntries( | 131 static std::vector<content::NavigationEntry*> ToNavigationEntries( |
131 const std::vector<SerializedNavigationEntry>& navigations, | 132 const std::vector<SerializedNavigationEntry>& navigations, |
132 content::BrowserContext* browser_context); | 133 content::BrowserContext* browser_context); |
133 | 134 |
134 private: | 135 private: |
135 friend class SerializedNavigationEntryTestHelper; | 136 friend class SerializedNavigationEntryTestHelper; |
136 | 137 |
138 // Returns the default referrer policy. | |
139 int GetDefaultReferrerPolicy() const; | |
140 | |
141 // Returns a sanitized version of |encoded_page_state_| suitable for writing | |
142 // to disk. | |
143 std::string GetSanitizedPageStateForPickle() const; | |
144 | |
137 // Sanitizes the data in this class to be more robust against faulty data | 145 // Sanitizes the data in this class to be more robust against faulty data |
138 // written by older versions. | 146 // written by older versions. |
139 void Sanitize(); | 147 void Sanitize(); |
140 | 148 |
141 // Index in the NavigationController. | 149 // Index in the NavigationController. |
142 int index_; | 150 int index_; |
143 | 151 |
144 // Member variables corresponding to NavigationEntry fields. | 152 // Member variables corresponding to NavigationEntry fields. |
145 int unique_id_; | 153 int unique_id_; |
146 content::Referrer referrer_; | 154 GURL referrer_url_; |
155 int referrer_policy_; | |
147 GURL virtual_url_; | 156 GURL virtual_url_; |
148 base::string16 title_; | 157 base::string16 title_; |
149 content::PageState page_state_; | 158 std::string encoded_page_state_; |
150 ui::PageTransition transition_type_; | 159 ui::PageTransition transition_type_; |
151 bool has_post_data_; | 160 bool has_post_data_; |
152 int64 post_id_; | 161 int64 post_id_; |
153 GURL original_request_url_; | 162 GURL original_request_url_; |
154 bool is_overriding_user_agent_; | 163 bool is_overriding_user_agent_; |
155 base::Time timestamp_; | 164 base::Time timestamp_; |
156 base::string16 search_terms_; | 165 base::string16 search_terms_; |
157 GURL favicon_url_; | 166 GURL favicon_url_; |
158 int http_status_code_; | 167 int http_status_code_; |
159 bool is_restored_; // Not persisted. | 168 bool is_restored_; // Not persisted. |
160 std::vector<GURL> redirect_chain_; // Not persisted. | 169 std::vector<GURL> redirect_chain_; // Not persisted. |
161 | 170 |
162 // Additional information. | 171 // Additional information. |
163 BlockedState blocked_state_; | 172 BlockedState blocked_state_; |
164 std::set<std::string> content_pack_categories_; | 173 std::set<std::string> content_pack_categories_; |
165 }; | 174 }; |
166 | 175 |
167 } // namespace sessions | 176 } // namespace sessions |
168 | 177 |
169 #endif // COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ | 178 #endif // COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ |
OLD | NEW |