| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 LINK_LOAD, // (deprecated) Included next 4 categories. | 26 LINK_LOAD, // (deprecated) Included next 4 categories. |
| 27 LINK_LOAD_NORMAL, // Commonly following of link. | 27 LINK_LOAD_NORMAL, // Commonly following of link. |
| 28 LINK_LOAD_RELOAD, // JS/link directed reload. | 28 LINK_LOAD_RELOAD, // JS/link directed reload. |
| 29 LINK_LOAD_CACHE_STALE_OK, // back/forward or encoding change. | 29 LINK_LOAD_CACHE_STALE_OK, // back/forward or encoding change. |
| 30 LINK_LOAD_CACHE_ONLY, // Allow stale data (avoid doing a re-post) | 30 LINK_LOAD_CACHE_ONLY, // Allow stale data (avoid doing a re-post) |
| 31 kLoadTypeMax // Bounding value for this enum. | 31 kLoadTypeMax // Bounding value for this enum. |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 static NavigationState* CreateBrowserInitiated( | 34 static NavigationState* CreateBrowserInitiated( |
| 35 int32 pending_page_id, | 35 int32 pending_page_id, |
| 36 int pending_history_list_offset, |
| 36 PageTransition::Type transition_type, | 37 PageTransition::Type transition_type, |
| 37 base::Time request_time) { | 38 base::Time request_time) { |
| 38 return new NavigationState(transition_type, request_time, false, | 39 return new NavigationState(transition_type, request_time, false, |
| 39 pending_page_id); | 40 pending_page_id, |
| 41 pending_history_list_offset); |
| 40 } | 42 } |
| 41 | 43 |
| 42 static NavigationState* CreateContentInitiated() { | 44 static NavigationState* CreateContentInitiated() { |
| 43 // We assume navigations initiated by content are link clicks. | 45 // We assume navigations initiated by content are link clicks. |
| 44 return new NavigationState(PageTransition::LINK, base::Time(), true, -1); | 46 return new NavigationState(PageTransition::LINK, base::Time(), true, -1, |
| 47 -1); |
| 45 } | 48 } |
| 46 | 49 |
| 47 static NavigationState* FromDataSource(WebKit::WebDataSource* ds) { | 50 static NavigationState* FromDataSource(WebKit::WebDataSource* ds) { |
| 48 return static_cast<NavigationState*>(ds->extraData()); | 51 return static_cast<NavigationState*>(ds->extraData()); |
| 49 } | 52 } |
| 50 | 53 |
| 51 UserScriptIdleScheduler* user_script_idle_scheduler() { | 54 UserScriptIdleScheduler* user_script_idle_scheduler() { |
| 52 return user_script_idle_scheduler_.get(); | 55 return user_script_idle_scheduler_.get(); |
| 53 } | 56 } |
| 54 void set_user_script_idle_scheduler(UserScriptIdleScheduler* scheduler) { | 57 void set_user_script_idle_scheduler(UserScriptIdleScheduler* scheduler) { |
| 55 user_script_idle_scheduler_.reset(scheduler); | 58 user_script_idle_scheduler_.reset(scheduler); |
| 56 } | 59 } |
| 57 | 60 |
| 58 // Contains the page_id for this navigation or -1 if there is none yet. | 61 // Contains the page_id for this navigation or -1 if there is none yet. |
| 59 int32 pending_page_id() const { return pending_page_id_; } | 62 int32 pending_page_id() const { return pending_page_id_; } |
| 60 | 63 |
| 64 // If pending_page_id() is not -1, then this contains the corresponding |
| 65 // offset of the page in the back/forward history list. |
| 66 int pending_history_list_offset() const { |
| 67 return pending_history_list_offset_; |
| 68 } |
| 69 |
| 61 // Contains the transition type that the browser specified when it | 70 // Contains the transition type that the browser specified when it |
| 62 // initiated the load. | 71 // initiated the load. |
| 63 PageTransition::Type transition_type() const { return transition_type_; } | 72 PageTransition::Type transition_type() const { return transition_type_; } |
| 64 void set_transition_type(PageTransition::Type type) { | 73 void set_transition_type(PageTransition::Type type) { |
| 65 transition_type_ = type; | 74 transition_type_ = type; |
| 66 } | 75 } |
| 67 | 76 |
| 68 // Record the nature of this load, for use when histogramming page load times. | 77 // Record the nature of this load, for use when histogramming page load times. |
| 69 LoadType load_type() const { return load_type_; } | 78 LoadType load_type() const { return load_type_; } |
| 70 void set_load_type(LoadType load_type) { load_type_ = load_type; } | 79 void set_load_type(LoadType load_type) { load_type_ = load_type; } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 bool was_fetched_via_spdy() const { return was_fetched_via_spdy_; } | 221 bool was_fetched_via_spdy() const { return was_fetched_via_spdy_; } |
| 213 | 222 |
| 214 // Whether the frame text contents was translated to a different language. | 223 // Whether the frame text contents was translated to a different language. |
| 215 void set_was_translated(bool value) { was_translated_ = value; } | 224 void set_was_translated(bool value) { was_translated_ = value; } |
| 216 bool was_translated() const { return was_translated_; } | 225 bool was_translated() const { return was_translated_; } |
| 217 | 226 |
| 218 private: | 227 private: |
| 219 NavigationState(PageTransition::Type transition_type, | 228 NavigationState(PageTransition::Type transition_type, |
| 220 const base::Time& request_time, | 229 const base::Time& request_time, |
| 221 bool is_content_initiated, | 230 bool is_content_initiated, |
| 222 int32 pending_page_id) | 231 int32 pending_page_id, |
| 232 int pending_history_list_offset) |
| 223 : transition_type_(transition_type), | 233 : transition_type_(transition_type), |
| 224 load_type_(UNDEFINED_LOAD), | 234 load_type_(UNDEFINED_LOAD), |
| 225 request_time_(request_time), | 235 request_time_(request_time), |
| 226 load_histograms_recorded_(false), | 236 load_histograms_recorded_(false), |
| 227 request_committed_(false), | 237 request_committed_(false), |
| 228 is_content_initiated_(is_content_initiated), | 238 is_content_initiated_(is_content_initiated), |
| 229 pending_page_id_(pending_page_id), | 239 pending_page_id_(pending_page_id), |
| 240 pending_history_list_offset_(pending_history_list_offset), |
| 230 postpone_loading_data_(false), | 241 postpone_loading_data_(false), |
| 231 cache_policy_override_set_(false), | 242 cache_policy_override_set_(false), |
| 232 cache_policy_override_(WebKit::WebURLRequest::UseProtocolCachePolicy), | 243 cache_policy_override_(WebKit::WebURLRequest::UseProtocolCachePolicy), |
| 233 user_script_idle_scheduler_(NULL), | 244 user_script_idle_scheduler_(NULL), |
| 234 was_fetched_via_spdy_(false), | 245 was_fetched_via_spdy_(false), |
| 235 was_translated_(false) { | 246 was_translated_(false) { |
| 236 } | 247 } |
| 237 | 248 |
| 238 PageTransition::Type transition_type_; | 249 PageTransition::Type transition_type_; |
| 239 LoadType load_type_; | 250 LoadType load_type_; |
| 240 base::Time request_time_; | 251 base::Time request_time_; |
| 241 base::Time start_load_time_; | 252 base::Time start_load_time_; |
| 242 base::Time commit_load_time_; | 253 base::Time commit_load_time_; |
| 243 base::Time finish_document_load_time_; | 254 base::Time finish_document_load_time_; |
| 244 base::Time finish_load_time_; | 255 base::Time finish_load_time_; |
| 245 base::Time first_paint_time_; | 256 base::Time first_paint_time_; |
| 246 base::Time first_paint_after_load_time_; | 257 base::Time first_paint_after_load_time_; |
| 247 bool load_histograms_recorded_; | 258 bool load_histograms_recorded_; |
| 248 bool request_committed_; | 259 bool request_committed_; |
| 249 bool is_content_initiated_; | 260 bool is_content_initiated_; |
| 250 int32 pending_page_id_; | 261 int32 pending_page_id_; |
| 262 int pending_history_list_offset_; |
| 251 GURL searchable_form_url_; | 263 GURL searchable_form_url_; |
| 252 std::string searchable_form_encoding_; | 264 std::string searchable_form_encoding_; |
| 253 scoped_ptr<webkit_glue::PasswordForm> password_form_data_; | 265 scoped_ptr<webkit_glue::PasswordForm> password_form_data_; |
| 254 scoped_ptr<webkit_glue::AltErrorPageResourceFetcher> alt_error_page_fetcher_; | 266 scoped_ptr<webkit_glue::AltErrorPageResourceFetcher> alt_error_page_fetcher_; |
| 255 std::string security_info_; | 267 std::string security_info_; |
| 256 bool postpone_loading_data_; | 268 bool postpone_loading_data_; |
| 257 std::string postponed_data_; | 269 std::string postponed_data_; |
| 258 | 270 |
| 259 bool cache_policy_override_set_; | 271 bool cache_policy_override_set_; |
| 260 WebKit::WebURLRequest::CachePolicy cache_policy_override_; | 272 WebKit::WebURLRequest::CachePolicy cache_policy_override_; |
| 261 | 273 |
| 262 scoped_ptr<UserScriptIdleScheduler> user_script_idle_scheduler_; | 274 scoped_ptr<UserScriptIdleScheduler> user_script_idle_scheduler_; |
| 263 | 275 |
| 264 bool was_fetched_via_spdy_; | 276 bool was_fetched_via_spdy_; |
| 265 | 277 |
| 266 bool was_translated_; | 278 bool was_translated_; |
| 267 | 279 |
| 268 DISALLOW_COPY_AND_ASSIGN(NavigationState); | 280 DISALLOW_COPY_AND_ASSIGN(NavigationState); |
| 269 }; | 281 }; |
| 270 | 282 |
| 271 #endif // CHROME_RENDERER_NAVIGATION_STATE_H_ | 283 #endif // CHROME_RENDERER_NAVIGATION_STATE_H_ |
| OLD | NEW |