| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/optional.h" | 9 #include "base/optional.h" |
| 10 #include "chrome/common/page_load_metrics/page_load_timing.h" | 10 #include "chrome/common/page_load_metrics/page_load_timing.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 base::TimeDelta time_to_failed_provisional_load; | 64 base::TimeDelta time_to_failed_provisional_load; |
| 65 net::Error error; | 65 net::Error error; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 struct PageLoadExtraInfo { | 68 struct PageLoadExtraInfo { |
| 69 PageLoadExtraInfo( | 69 PageLoadExtraInfo( |
| 70 const base::Optional<base::TimeDelta>& first_background_time, | 70 const base::Optional<base::TimeDelta>& first_background_time, |
| 71 const base::Optional<base::TimeDelta>& first_foreground_time, | 71 const base::Optional<base::TimeDelta>& first_foreground_time, |
| 72 bool started_in_foreground, | 72 bool started_in_foreground, |
| 73 bool user_gesture, | 73 bool user_initiated, |
| 74 const GURL& committed_url, | 74 const GURL& committed_url, |
| 75 const GURL& start_url, | 75 const GURL& start_url, |
| 76 UserAbortType abort_type, | 76 UserAbortType abort_type, |
| 77 bool abort_user_initiated, | |
| 78 const base::Optional<base::TimeDelta>& time_to_abort, | 77 const base::Optional<base::TimeDelta>& time_to_abort, |
| 79 int num_cache_requests, | 78 int num_cache_requests, |
| 80 int num_network_requests, | 79 int num_network_requests, |
| 81 const PageLoadMetadata& metadata); | 80 const PageLoadMetadata& metadata); |
| 82 | 81 |
| 83 PageLoadExtraInfo(const PageLoadExtraInfo& other); | 82 PageLoadExtraInfo(const PageLoadExtraInfo& other); |
| 84 | 83 |
| 85 ~PageLoadExtraInfo(); | 84 ~PageLoadExtraInfo(); |
| 86 | 85 |
| 87 // The first time that the page was backgrounded since the navigation started. | 86 // The first time that the page was backgrounded since the navigation started. |
| 88 const base::Optional<base::TimeDelta> first_background_time; | 87 const base::Optional<base::TimeDelta> first_background_time; |
| 89 | 88 |
| 90 // The first time that the page was foregrounded since the navigation started. | 89 // The first time that the page was foregrounded since the navigation started. |
| 91 const base::Optional<base::TimeDelta> first_foreground_time; | 90 const base::Optional<base::TimeDelta> first_foreground_time; |
| 92 | 91 |
| 93 // True if the page load started in the foreground. | 92 // True if the page load started in the foreground. |
| 94 const bool started_in_foreground; | 93 const bool started_in_foreground; |
| 95 | 94 |
| 96 // True if this is either a browser initiated navigation or the user_gesture | 95 // True if this is either a browser initiated navigation or the user_gesture |
| 97 // bit is true in the renderer. | 96 // bit is true in the renderer. |
| 98 const bool user_gesture; | 97 const bool user_initiated; |
| 99 | 98 |
| 100 // Committed URL. If the page load did not commit, |committed_url| will be | 99 // Committed URL. If the page load did not commit, |committed_url| will be |
| 101 // empty. | 100 // empty. |
| 102 const GURL committed_url; | 101 const GURL committed_url; |
| 103 | 102 |
| 104 // The URL that started the navigation, before redirects. | 103 // The URL that started the navigation, before redirects. |
| 105 const GURL start_url; | 104 const GURL start_url; |
| 106 | 105 |
| 107 // The abort time and time to abort for this page load. If the page was not | 106 // The abort time and time to abort for this page load. If the page was not |
| 108 // aborted, |abort_type| will be |ABORT_NONE|. | 107 // aborted, |abort_type| will be |ABORT_NONE|. |
| 109 const UserAbortType abort_type; | 108 const UserAbortType abort_type; |
| 110 | 109 |
| 111 // TODO(csharrison): If more metadata for aborts is needed we should provide a | |
| 112 // better abstraction. Note that this is an approximation. | |
| 113 bool abort_user_initiated; | |
| 114 | |
| 115 const base::Optional<base::TimeDelta> time_to_abort; | 110 const base::Optional<base::TimeDelta> time_to_abort; |
| 116 | 111 |
| 117 // Note: these are only approximations, based on WebContents attribution from | 112 // Note: these are only approximations, based on WebContents attribution from |
| 118 // ResourceRequestInfo objects while this is the currently committed load in | 113 // ResourceRequestInfo objects while this is the currently committed load in |
| 119 // the WebContents. | 114 // the WebContents. |
| 120 int num_cache_requests; | 115 int num_cache_requests; |
| 121 int num_network_requests; | 116 int num_network_requests; |
| 122 | 117 |
| 123 // Extra information supplied to the page load metrics system from the | 118 // Extra information supplied to the page load metrics system from the |
| 124 // renderer. | 119 // renderer. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 // OnFailedProvisionalLoad is invoked for tracked page loads that did not | 256 // OnFailedProvisionalLoad is invoked for tracked page loads that did not |
| 262 // commit, immediately before the observer is deleted. | 257 // commit, immediately before the observer is deleted. |
| 263 virtual void OnFailedProvisionalLoad( | 258 virtual void OnFailedProvisionalLoad( |
| 264 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 259 const FailedProvisionalLoadInfo& failed_provisional_load_info, |
| 265 const PageLoadExtraInfo& extra_info) {} | 260 const PageLoadExtraInfo& extra_info) {} |
| 266 }; | 261 }; |
| 267 | 262 |
| 268 } // namespace page_load_metrics | 263 } // namespace page_load_metrics |
| 269 | 264 |
| 270 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 265 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| OLD | NEW |