OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_RENDERER_NAVIGATION_STATE_H_ | 5 #ifndef CHROME_RENDERER_NAVIGATION_STATE_H_ |
6 #define CHROME_RENDERER_NAVIGATION_STATE_H_ | 6 #define CHROME_RENDERER_NAVIGATION_STATE_H_ |
7 | 7 |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/common/page_transition_types.h" | 10 #include "chrome/common/page_transition_types.h" |
11 #include "webkit/api/public/WebDataSource.h" | 11 #include "webkit/api/public/WebDataSource.h" |
| 12 #include "webkit/api/public/WebURLRequest.h" |
12 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 13 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
13 #include "webkit/glue/password_form.h" | 14 #include "webkit/glue/password_form.h" |
14 | 15 |
15 // The RenderView stores an instance of this class in the "extra data" of each | 16 // The RenderView stores an instance of this class in the "extra data" of each |
16 // WebDataSource (see RenderView::DidCreateDataSource). | 17 // WebDataSource (see RenderView::DidCreateDataSource). |
17 class NavigationState : public WebKit::WebDataSource::ExtraData { | 18 class NavigationState : public WebKit::WebDataSource::ExtraData { |
18 public: | 19 public: |
19 static NavigationState* CreateBrowserInitiated( | 20 static NavigationState* CreateBrowserInitiated( |
20 int32 pending_page_id, | 21 int32 pending_page_id, |
21 PageTransition::Type transition_type, | 22 PageTransition::Type transition_type, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 void clear_postponed_data() { | 156 void clear_postponed_data() { |
156 postponed_data_.clear(); | 157 postponed_data_.clear(); |
157 } | 158 } |
158 void append_postponed_data(const char* data, size_t data_len) { | 159 void append_postponed_data(const char* data, size_t data_len) { |
159 postponed_data_.append(data, data_len); | 160 postponed_data_.append(data, data_len); |
160 } | 161 } |
161 const std::string& postponed_data() const { | 162 const std::string& postponed_data() const { |
162 return postponed_data_; | 163 return postponed_data_; |
163 } | 164 } |
164 | 165 |
| 166 // Sets the cache policy. The cache policy is only used if explicitly set and |
| 167 // by default is not set. You can mark a NavigationState as not having a cache |
| 168 // state by way of clear_cache_policy_override. |
| 169 void set_cache_policy_override( |
| 170 WebKit::WebURLRequest::CachePolicy cache_policy) { |
| 171 cache_policy_override_ = cache_policy; |
| 172 cache_policy_override_set_ = true; |
| 173 } |
| 174 WebKit::WebURLRequest::CachePolicy cache_policy_override() const { |
| 175 return cache_policy_override_; |
| 176 } |
| 177 void clear_cache_policy_override() { |
| 178 cache_policy_override_set_ = false; |
| 179 cache_policy_override_ = WebKit::WebURLRequest::UseProtocolCachePolicy; |
| 180 } |
| 181 bool is_cache_policy_override_set() const { |
| 182 return cache_policy_override_set_; |
| 183 } |
| 184 |
165 private: | 185 private: |
166 NavigationState(PageTransition::Type transition_type, | 186 NavigationState(PageTransition::Type transition_type, |
167 const base::Time& request_time, | 187 const base::Time& request_time, |
168 bool is_content_initiated, | 188 bool is_content_initiated, |
169 int32 pending_page_id) | 189 int32 pending_page_id) |
170 : transition_type_(transition_type), | 190 : transition_type_(transition_type), |
171 request_time_(request_time), | 191 request_time_(request_time), |
172 load_histograms_recorded_(false), | 192 load_histograms_recorded_(false), |
173 request_committed_(false), | 193 request_committed_(false), |
174 is_content_initiated_(is_content_initiated), | 194 is_content_initiated_(is_content_initiated), |
175 pending_page_id_(pending_page_id), | 195 pending_page_id_(pending_page_id), |
176 postpone_loading_data_(false) { | 196 postpone_loading_data_(false), |
| 197 cache_policy_override_set_(false), |
| 198 cache_policy_override_(WebKit::WebURLRequest::UseProtocolCachePolicy) { |
177 } | 199 } |
178 | 200 |
179 PageTransition::Type transition_type_; | 201 PageTransition::Type transition_type_; |
180 base::Time request_time_; | 202 base::Time request_time_; |
181 base::Time start_load_time_; | 203 base::Time start_load_time_; |
182 base::Time commit_load_time_; | 204 base::Time commit_load_time_; |
183 base::Time finish_document_load_time_; | 205 base::Time finish_document_load_time_; |
184 base::Time finish_load_time_; | 206 base::Time finish_load_time_; |
185 base::Time first_paint_time_; | 207 base::Time first_paint_time_; |
186 base::Time first_paint_after_load_time_; | 208 base::Time first_paint_after_load_time_; |
187 bool load_histograms_recorded_; | 209 bool load_histograms_recorded_; |
188 bool request_committed_; | 210 bool request_committed_; |
189 bool is_content_initiated_; | 211 bool is_content_initiated_; |
190 int32 pending_page_id_; | 212 int32 pending_page_id_; |
191 GURL searchable_form_url_; | 213 GURL searchable_form_url_; |
192 std::string searchable_form_encoding_; | 214 std::string searchable_form_encoding_; |
193 scoped_ptr<webkit_glue::PasswordForm> password_form_data_; | 215 scoped_ptr<webkit_glue::PasswordForm> password_form_data_; |
194 scoped_ptr<webkit_glue::AltErrorPageResourceFetcher> alt_error_page_fetcher_; | 216 scoped_ptr<webkit_glue::AltErrorPageResourceFetcher> alt_error_page_fetcher_; |
195 std::string security_info_; | 217 std::string security_info_; |
196 bool postpone_loading_data_; | 218 bool postpone_loading_data_; |
197 std::string postponed_data_; | 219 std::string postponed_data_; |
| 220 bool cache_policy_override_set_; |
| 221 WebKit::WebURLRequest::CachePolicy cache_policy_override_; |
198 | 222 |
199 DISALLOW_COPY_AND_ASSIGN(NavigationState); | 223 DISALLOW_COPY_AND_ASSIGN(NavigationState); |
200 }; | 224 }; |
201 | 225 |
202 #endif // CHROME_RENDERER_NAVIGATION_STATE_H_ | 226 #endif // CHROME_RENDERER_NAVIGATION_STATE_H_ |
OLD | NEW |