| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 base::TimeDelta time_to_failed_provisional_load; | 59 base::TimeDelta time_to_failed_provisional_load; |
| 60 net::Error error; | 60 net::Error error; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 struct PageLoadExtraInfo { | 63 struct PageLoadExtraInfo { |
| 64 PageLoadExtraInfo( | 64 PageLoadExtraInfo( |
| 65 const base::Optional<base::TimeDelta>& first_background_time, | 65 const base::Optional<base::TimeDelta>& first_background_time, |
| 66 const base::Optional<base::TimeDelta>& first_foreground_time, | 66 const base::Optional<base::TimeDelta>& first_foreground_time, |
| 67 bool started_in_foreground, | 67 bool started_in_foreground, |
| 68 bool user_gesture, |
| 68 const GURL& committed_url, | 69 const GURL& committed_url, |
| 69 const base::Optional<base::TimeDelta>& time_to_commit, | 70 const base::Optional<base::TimeDelta>& time_to_commit, |
| 70 UserAbortType abort_type, | 71 UserAbortType abort_type, |
| 72 bool abort_user_initiated, |
| 71 const base::Optional<base::TimeDelta>& time_to_abort, | 73 const base::Optional<base::TimeDelta>& time_to_abort, |
| 72 const PageLoadMetadata& metadata); | 74 const PageLoadMetadata& metadata); |
| 73 | 75 |
| 74 PageLoadExtraInfo(const PageLoadExtraInfo& other); | 76 PageLoadExtraInfo(const PageLoadExtraInfo& other); |
| 75 | 77 |
| 76 ~PageLoadExtraInfo(); | 78 ~PageLoadExtraInfo(); |
| 77 | 79 |
| 78 // The first time that the page was backgrounded since the navigation started. | 80 // The first time that the page was backgrounded since the navigation started. |
| 79 const base::Optional<base::TimeDelta> first_background_time; | 81 const base::Optional<base::TimeDelta> first_background_time; |
| 80 | 82 |
| 81 // The first time that the page was foregrounded since the navigation started. | 83 // The first time that the page was foregrounded since the navigation started. |
| 82 const base::Optional<base::TimeDelta> first_foreground_time; | 84 const base::Optional<base::TimeDelta> first_foreground_time; |
| 83 | 85 |
| 84 // True if the page load started in the foreground. | 86 // True if the page load started in the foreground. |
| 85 const bool started_in_foreground; | 87 const bool started_in_foreground; |
| 86 | 88 |
| 89 // True if this is either a browser initiated navigation or the user_gesture |
| 90 // bit is true in the renderer. |
| 91 const bool user_gesture; |
| 92 |
| 87 // Committed URL. If the page load did not commit, |committed_url| will be | 93 // Committed URL. If the page load did not commit, |committed_url| will be |
| 88 // empty. | 94 // empty. |
| 89 const GURL committed_url; | 95 const GURL committed_url; |
| 90 | 96 |
| 91 // Time from navigation start until commit. | 97 // Time from navigation start until commit. |
| 92 const base::Optional<base::TimeDelta> time_to_commit; | 98 const base::Optional<base::TimeDelta> time_to_commit; |
| 93 | 99 |
| 94 // The abort time and time to abort for this page load. If the page was not | 100 // The abort time and time to abort for this page load. If the page was not |
| 95 // aborted, |abort_type| will be |ABORT_NONE|. | 101 // aborted, |abort_type| will be |ABORT_NONE|. |
| 96 const UserAbortType abort_type; | 102 const UserAbortType abort_type; |
| 97 | 103 |
| 104 // TODO(csharrison): If more metadata for aborts is needed we should provide a |
| 105 // better abstraction. Note that this is an approximation. |
| 106 bool abort_user_initiated; |
| 107 |
| 98 const base::Optional<base::TimeDelta> time_to_abort; | 108 const base::Optional<base::TimeDelta> time_to_abort; |
| 99 | 109 |
| 100 // Extra information supplied to the page load metrics system from the | 110 // Extra information supplied to the page load metrics system from the |
| 101 // renderer. | 111 // renderer. |
| 102 const PageLoadMetadata metadata; | 112 const PageLoadMetadata metadata; |
| 103 }; | 113 }; |
| 104 | 114 |
| 105 // Interface for PageLoadMetrics observers. All instances of this class are | 115 // Interface for PageLoadMetrics observers. All instances of this class are |
| 106 // owned by the PageLoadTracker tracking a page load. | 116 // owned by the PageLoadTracker tracking a page load. |
| 107 class PageLoadMetricsObserver { | 117 class PageLoadMetricsObserver { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // loads that result in downloads or 204s are aborted by the system, and are | 215 // loads that result in downloads or 204s are aborted by the system, and are |
| 206 // also included as failed provisional loads. | 216 // also included as failed provisional loads. |
| 207 virtual void OnFailedProvisionalLoad( | 217 virtual void OnFailedProvisionalLoad( |
| 208 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 218 const FailedProvisionalLoadInfo& failed_provisional_load_info, |
| 209 const PageLoadExtraInfo& extra_info) {} | 219 const PageLoadExtraInfo& extra_info) {} |
| 210 }; | 220 }; |
| 211 | 221 |
| 212 } // namespace page_load_metrics | 222 } // namespace page_load_metrics |
| 213 | 223 |
| 214 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 224 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| OLD | NEW |