Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: components/sessions/serialized_navigation_entry.h

Issue 658073004: Rewrites SerializedNavigationEntry to not have any //content member variables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
18 #include "content/public/common/referrer.h"
19 #include "ui/base/page_transition_types.h" 17 #include "ui/base/page_transition_types.h"
20 #include "url/gurl.h" 18 #include "url/gurl.h"
21 19
22 class Pickle; 20 class Pickle;
23 class PickleIterator; 21 class PickleIterator;
24 22
25 namespace content { 23 namespace content {
26 class BrowserContext; 24 class BrowserContext;
27 class NavigationEntry; 25 class NavigationEntry;
28 } 26 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 88
91 // The index in the NavigationController. This SerializedNavigationEntry is 89 // The index in the NavigationController. This SerializedNavigationEntry is
92 // valid only when the index is non-negative. 90 // valid only when the index is non-negative.
93 int index() const { return index_; } 91 int index() const { return index_; }
94 void set_index(int index) { index_ = index; } 92 void set_index(int index) { index_ = index; }
95 93
96 // Accessors for some fields taken from NavigationEntry. 94 // Accessors for some fields taken from NavigationEntry.
97 int unique_id() const { return unique_id_; } 95 int unique_id() const { return unique_id_; }
98 const GURL& virtual_url() const { return virtual_url_; } 96 const GURL& virtual_url() const { return virtual_url_; }
99 const base::string16& title() const { return title_; } 97 const base::string16& title() const { return title_; }
100 const content::PageState& page_state() const { return page_state_; } 98 const std::string& encoded_page_state() const { return encoded_page_state_; }
101 const base::string16& search_terms() const { return search_terms_; } 99 const base::string16& search_terms() const { return search_terms_; }
102 const GURL& favicon_url() const { return favicon_url_; } 100 const GURL& favicon_url() const { return favicon_url_; }
103 int http_status_code() const { return http_status_code_; } 101 int http_status_code() const { return http_status_code_; }
104 const content::Referrer& referrer() const { return referrer_; } 102 const GURL& referrer_url() const { return referrer_url_; }
103 int referrer_policy() const { return referrer_policy_; }
105 ui::PageTransition transition_type() const { 104 ui::PageTransition transition_type() const {
106 return transition_type_; 105 return transition_type_;
107 } 106 }
108 bool has_post_data() const { return has_post_data_; } 107 bool has_post_data() const { return has_post_data_; }
109 int64 post_id() const { return post_id_; } 108 int64 post_id() const { return post_id_; }
110 const GURL& original_request_url() const { return original_request_url_; } 109 const GURL& original_request_url() const { return original_request_url_; }
111 bool is_overriding_user_agent() const { return is_overriding_user_agent_; } 110 bool is_overriding_user_agent() const { return is_overriding_user_agent_; }
112 base::Time timestamp() const { return timestamp_; } 111 base::Time timestamp() const { return timestamp_; }
113 112
114 BlockedState blocked_state() { return blocked_state_; } 113 BlockedState blocked_state() { return blocked_state_; }
(...skipping 12 matching lines...) Expand all
127 // Converts a set of SerializedNavigationEntrys into a list of 126 // Converts a set of SerializedNavigationEntrys into a list of
128 // NavigationEntrys with sequential page IDs and the given context. The caller 127 // NavigationEntrys with sequential page IDs and the given context. The caller
129 // owns the returned NavigationEntrys. 128 // owns the returned NavigationEntrys.
130 static std::vector<content::NavigationEntry*> ToNavigationEntries( 129 static std::vector<content::NavigationEntry*> ToNavigationEntries(
131 const std::vector<SerializedNavigationEntry>& navigations, 130 const std::vector<SerializedNavigationEntry>& navigations,
132 content::BrowserContext* browser_context); 131 content::BrowserContext* browser_context);
133 132
134 private: 133 private:
135 friend class SerializedNavigationEntryTestHelper; 134 friend class SerializedNavigationEntryTestHelper;
136 135
136 // Returns the default referrer policy.
137 int GetDefaultReferrerPolicy() const;
138
139 // Returns a sanitized version of |encoded_page_state_| suitable for writing
140 // to disk.
141 std::string GetSanitizedPageStateForPickle() const;
142
137 // Sanitizes the data in this class to be more robust against faulty data 143 // Sanitizes the data in this class to be more robust against faulty data
138 // written by older versions. 144 // written by older versions.
139 void Sanitize(); 145 void Sanitize();
140 146
141 // Index in the NavigationController. 147 // Index in the NavigationController.
142 int index_; 148 int index_;
143 149
144 // Member variables corresponding to NavigationEntry fields. 150 // Member variables corresponding to NavigationEntry fields.
145 int unique_id_; 151 int unique_id_;
146 content::Referrer referrer_; 152 GURL referrer_url_;
153 int referrer_policy_;
147 GURL virtual_url_; 154 GURL virtual_url_;
148 base::string16 title_; 155 base::string16 title_;
149 content::PageState page_state_; 156 std::string encoded_page_state_;
150 ui::PageTransition transition_type_; 157 ui::PageTransition transition_type_;
151 bool has_post_data_; 158 bool has_post_data_;
152 int64 post_id_; 159 int64 post_id_;
153 GURL original_request_url_; 160 GURL original_request_url_;
154 bool is_overriding_user_agent_; 161 bool is_overriding_user_agent_;
155 base::Time timestamp_; 162 base::Time timestamp_;
156 base::string16 search_terms_; 163 base::string16 search_terms_;
157 GURL favicon_url_; 164 GURL favicon_url_;
158 int http_status_code_; 165 int http_status_code_;
159 bool is_restored_; // Not persisted. 166 bool is_restored_; // Not persisted.
160 std::vector<GURL> redirect_chain_; // Not persisted. 167 std::vector<GURL> redirect_chain_; // Not persisted.
161 168
162 // Additional information. 169 // Additional information.
163 BlockedState blocked_state_; 170 BlockedState blocked_state_;
164 std::set<std::string> content_pack_categories_; 171 std::set<std::string> content_pack_categories_;
165 }; 172 };
166 173
167 } // namespace sessions 174 } // namespace sessions
168 175
169 #endif // COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_ 176 #endif // COMPONENTS_SESSIONS_SERIALIZED_NAVIGATION_ENTRY_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_commands.cc ('k') | components/sessions/serialized_navigation_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698