| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ | 6 #define CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "content/common/page_transition_types.h" | 14 #include "content/public/common/page_transition_types.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| 17 | 17 |
| 18 namespace webkit_glue { | 18 namespace webkit_glue { |
| 19 struct PasswordForm; | 19 struct PasswordForm; |
| 20 class AltErrorPageResourceFetcher; | 20 class AltErrorPageResourceFetcher; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 LINK_LOAD_CACHE_STALE_OK, // back/forward or encoding change. | 39 LINK_LOAD_CACHE_STALE_OK, // back/forward or encoding change. |
| 40 LINK_LOAD_CACHE_ONLY, // Allow stale data (avoid doing a re-post) | 40 LINK_LOAD_CACHE_ONLY, // Allow stale data (avoid doing a re-post) |
| 41 kLoadTypeMax // Bounding value for this enum. | 41 kLoadTypeMax // Bounding value for this enum. |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 virtual ~NavigationState(); | 44 virtual ~NavigationState(); |
| 45 | 45 |
| 46 static NavigationState* CreateBrowserInitiated( | 46 static NavigationState* CreateBrowserInitiated( |
| 47 int32 pending_page_id, | 47 int32 pending_page_id, |
| 48 int pending_history_list_offset, | 48 int pending_history_list_offset, |
| 49 PageTransition::Type transition_type, | 49 content::PageTransition transition_type, |
| 50 base::Time request_time) { | 50 base::Time request_time) { |
| 51 return new NavigationState(transition_type, request_time, false, | 51 return new NavigationState(transition_type, request_time, false, |
| 52 pending_page_id, | 52 pending_page_id, |
| 53 pending_history_list_offset); | 53 pending_history_list_offset); |
| 54 } | 54 } |
| 55 | 55 |
| 56 static NavigationState* CreateContentInitiated() { | 56 static NavigationState* CreateContentInitiated() { |
| 57 // We assume navigations initiated by content are link clicks. | 57 // We assume navigations initiated by content are link clicks. |
| 58 return new NavigationState(PageTransition::LINK, base::Time(), true, -1, | 58 return new NavigationState( |
| 59 -1); | 59 content::PAGE_TRANSITION_LINK, base::Time(), true, -1, -1); |
| 60 } | 60 } |
| 61 | 61 |
| 62 static NavigationState* FromDataSource(WebKit::WebDataSource* ds) { | 62 static NavigationState* FromDataSource(WebKit::WebDataSource* ds) { |
| 63 return static_cast<NavigationState*>(ds->extraData()); | 63 return static_cast<NavigationState*>(ds->extraData()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Contains the page_id for this navigation or -1 if there is none yet. | 66 // Contains the page_id for this navigation or -1 if there is none yet. |
| 67 int32 pending_page_id() const { return pending_page_id_; } | 67 int32 pending_page_id() const { return pending_page_id_; } |
| 68 | 68 |
| 69 // If pending_page_id() is not -1, then this contains the corresponding | 69 // If pending_page_id() is not -1, then this contains the corresponding |
| 70 // offset of the page in the back/forward history list. | 70 // offset of the page in the back/forward history list. |
| 71 int pending_history_list_offset() const { | 71 int pending_history_list_offset() const { |
| 72 return pending_history_list_offset_; | 72 return pending_history_list_offset_; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Contains the transition type that the browser specified when it | 75 // Contains the transition type that the browser specified when it |
| 76 // initiated the load. | 76 // initiated the load. |
| 77 PageTransition::Type transition_type() const { return transition_type_; } | 77 content::PageTransition transition_type() const { return transition_type_; } |
| 78 void set_transition_type(PageTransition::Type type) { | 78 void set_transition_type(content::PageTransition type) { |
| 79 transition_type_ = type; | 79 transition_type_ = type; |
| 80 } | 80 } |
| 81 | 81 |
| 82 // Record the nature of this load, for use when histogramming page load times. | 82 // Record the nature of this load, for use when histogramming page load times. |
| 83 LoadType load_type() const { return load_type_; } | 83 LoadType load_type() const { return load_type_; } |
| 84 void set_load_type(LoadType load_type) { load_type_ = load_type; } | 84 void set_load_type(LoadType load_type) { load_type_ = load_type; } |
| 85 | 85 |
| 86 // The time that this navigation was requested. | 86 // The time that this navigation was requested. |
| 87 const base::Time& request_time() const { | 87 const base::Time& request_time() const { |
| 88 return request_time_; | 88 return request_time_; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 bool was_prefetcher() const { return was_prefetcher_; } | 257 bool was_prefetcher() const { return was_prefetcher_; } |
| 258 | 258 |
| 259 void set_was_referred_by_prefetcher(bool value) { | 259 void set_was_referred_by_prefetcher(bool value) { |
| 260 was_referred_by_prefetcher_ = value; | 260 was_referred_by_prefetcher_ = value; |
| 261 } | 261 } |
| 262 bool was_referred_by_prefetcher() const { | 262 bool was_referred_by_prefetcher() const { |
| 263 return was_referred_by_prefetcher_; | 263 return was_referred_by_prefetcher_; |
| 264 } | 264 } |
| 265 | 265 |
| 266 private: | 266 private: |
| 267 NavigationState(PageTransition::Type transition_type, | 267 NavigationState(content::PageTransition transition_type, |
| 268 const base::Time& request_time, | 268 const base::Time& request_time, |
| 269 bool is_content_initiated, | 269 bool is_content_initiated, |
| 270 int32 pending_page_id, | 270 int32 pending_page_id, |
| 271 int pending_history_list_offset); | 271 int pending_history_list_offset); |
| 272 | 272 |
| 273 PageTransition::Type transition_type_; | 273 content::PageTransition transition_type_; |
| 274 LoadType load_type_; | 274 LoadType load_type_; |
| 275 base::Time request_time_; | 275 base::Time request_time_; |
| 276 base::Time start_load_time_; | 276 base::Time start_load_time_; |
| 277 base::Time commit_load_time_; | 277 base::Time commit_load_time_; |
| 278 base::Time finish_document_load_time_; | 278 base::Time finish_document_load_time_; |
| 279 base::Time finish_load_time_; | 279 base::Time finish_load_time_; |
| 280 base::Time first_paint_time_; | 280 base::Time first_paint_time_; |
| 281 base::Time first_paint_after_load_time_; | 281 base::Time first_paint_after_load_time_; |
| 282 bool load_histograms_recorded_; | 282 bool load_histograms_recorded_; |
| 283 bool web_timing_histograms_recorded_; | 283 bool web_timing_histograms_recorded_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 308 // A prefetcher is a page that contains link rel=prefetch elements. | 308 // A prefetcher is a page that contains link rel=prefetch elements. |
| 309 bool was_prefetcher_; | 309 bool was_prefetcher_; |
| 310 bool was_referred_by_prefetcher_; | 310 bool was_referred_by_prefetcher_; |
| 311 | 311 |
| 312 DISALLOW_COPY_AND_ASSIGN(NavigationState); | 312 DISALLOW_COPY_AND_ASSIGN(NavigationState); |
| 313 }; | 313 }; |
| 314 | 314 |
| 315 #endif // CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ | 315 #endif // CONTENT_PUBLIC_RENDERER_NAVIGATION_STATE_H_ |
| 316 | 316 |
| 317 } // namespace content | 317 } // namespace content |
| OLD | NEW |