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 COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ | 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ |
6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ | 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/page_load_metrics/common/page_load_timing.h" | 9 #include "components/page_load_metrics/common/page_load_timing.h" |
10 #include "content/public/browser/navigation_handle.h" | 10 #include "content/public/browser/navigation_handle.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 ABORT_LAST_ENTRY | 50 ABORT_LAST_ENTRY |
51 }; | 51 }; |
52 | 52 |
53 struct PageLoadExtraInfo { | 53 struct PageLoadExtraInfo { |
54 PageLoadExtraInfo(base::TimeDelta first_background_time, | 54 PageLoadExtraInfo(base::TimeDelta first_background_time, |
55 base::TimeDelta first_foreground_time, | 55 base::TimeDelta first_foreground_time, |
56 bool started_in_foreground, | 56 bool started_in_foreground, |
57 const GURL& committed_url, | 57 const GURL& committed_url, |
58 base::TimeDelta time_to_commit, | 58 base::TimeDelta time_to_commit, |
59 UserAbortType abort_type, | 59 UserAbortType abort_type, |
60 base::TimeDelta time_to_abort); | 60 base::TimeDelta time_to_abort, |
| 61 const PageLoadMetadata& metadata); |
61 | 62 |
62 // The first time that the page was backgrounded since the navigation started. | 63 // The first time that the page was backgrounded since the navigation started. |
63 // If the page has not been backgrounded this will be base::TimeDelta(). | 64 // If the page has not been backgrounded this will be base::TimeDelta(). |
64 const base::TimeDelta first_background_time; | 65 const base::TimeDelta first_background_time; |
65 | 66 |
66 // The first time that the page was foregrounded since the navigation started. | 67 // The first time that the page was foregrounded since the navigation started. |
67 // If the page has not been foregrounded this will be base::TimeDelta(). | 68 // If the page has not been foregrounded this will be base::TimeDelta(). |
68 const base::TimeDelta first_foreground_time; | 69 const base::TimeDelta first_foreground_time; |
69 | 70 |
70 // True if the page load started in the foreground. | 71 // True if the page load started in the foreground. |
71 const bool started_in_foreground; | 72 const bool started_in_foreground; |
72 | 73 |
73 // Committed URL. If the page load did not commit, |committed_url| will be | 74 // Committed URL. If the page load did not commit, |committed_url| will be |
74 // empty. | 75 // empty. |
75 const GURL committed_url; | 76 const GURL committed_url; |
76 | 77 |
77 // Time from navigation start until commit. If the page load did not commit, | 78 // Time from navigation start until commit. If the page load did not commit, |
78 // |time_to_commit| will be zero. | 79 // |time_to_commit| will be zero. |
79 const base::TimeDelta time_to_commit; | 80 const base::TimeDelta time_to_commit; |
80 | 81 |
81 // The abort time and time to abort for this page load. If the page was not | 82 // The abort time and time to abort for this page load. If the page was not |
82 // aborted, |abort_type| will be |ABORT_NONE| and |time_to_abort| will be | 83 // aborted, |abort_type| will be |ABORT_NONE| and |time_to_abort| will be |
83 // |base::TimeDelta()|. | 84 // |base::TimeDelta()|. |
84 const UserAbortType abort_type; | 85 const UserAbortType abort_type; |
85 const base::TimeDelta time_to_abort; | 86 const base::TimeDelta time_to_abort; |
| 87 |
| 88 // Extra information supplied to the page load metrics system from the |
| 89 // renderer. |
| 90 const PageLoadMetadata metadata; |
86 }; | 91 }; |
87 | 92 |
88 // Interface for PageLoadMetrics observers. All instances of this class are | 93 // Interface for PageLoadMetrics observers. All instances of this class are |
89 // owned by the PageLoadTracker tracking a page load. They will be deleted after | 94 // owned by the PageLoadTracker tracking a page load. They will be deleted after |
90 // calling OnComplete. | 95 // calling OnComplete. |
91 class PageLoadMetricsObserver { | 96 class PageLoadMetricsObserver { |
92 public: | 97 public: |
93 virtual ~PageLoadMetricsObserver() {} | 98 virtual ~PageLoadMetricsObserver() {} |
94 | 99 |
95 // The page load started, with the given navigation handle. | 100 // The page load started, with the given navigation handle. |
(...skipping 24 matching lines...) Expand all Loading... |
120 // data collected over the course of the page load. If the load did not | 125 // data collected over the course of the page load. If the load did not |
121 // receive any timing information, |timing.IsEmpty()| will be true. | 126 // receive any timing information, |timing.IsEmpty()| will be true. |
122 // After this call, the object will be deleted. | 127 // After this call, the object will be deleted. |
123 virtual void OnComplete(const PageLoadTiming& timing, | 128 virtual void OnComplete(const PageLoadTiming& timing, |
124 const PageLoadExtraInfo& extra_info) {} | 129 const PageLoadExtraInfo& extra_info) {} |
125 }; | 130 }; |
126 | 131 |
127 } // namespace page_load_metrics | 132 } // namespace page_load_metrics |
128 | 133 |
129 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ | 134 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ |
OLD | NEW |