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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 // The navigation handle holds relevant data for the navigation, but will | 113 // The navigation handle holds relevant data for the navigation, but will |
114 // be destroyed soon after this call. Don't hold a reference to it. This can | 114 // be destroyed soon after this call. Don't hold a reference to it. This can |
115 // be called multiple times. | 115 // be called multiple times. |
116 virtual void OnRedirect(content::NavigationHandle* navigation_handle) {} | 116 virtual void OnRedirect(content::NavigationHandle* navigation_handle) {} |
117 | 117 |
118 // OnCommit is triggered when a page load commits, i.e. when we receive the | 118 // OnCommit is triggered when a page load commits, i.e. when we receive the |
119 // first data for the request. The navigation handle holds relevant data for | 119 // first data for the request. The navigation handle holds relevant data for |
120 // the navigation, but will be destroyed soon after this call. Don't hold a | 120 // the navigation, but will be destroyed soon after this call. Don't hold a |
121 // reference to it. | 121 // reference to it. |
122 // Note that this does not get called for same page navigations. | 122 // Note that this does not get called for same page navigations. |
123 virtual void OnCommit(content::NavigationHandle* navigation_handle) {} | 123 virtual void OnCommit(content::NavigationHandle* navigation_handle, |
124 bool started_in_foreground) {} | |
Charlie Harrison
2016/04/25 13:20:08
It makes more sense to thread this in OnStart. In
felt
2016/04/25 21:30:04
Do you mean making PageLoadMetricsObserver no long
Charlie Harrison
2016/04/25 21:49:11
Yeah that's what I meant. I wouldn't be opposed to
Bryan McQuade
2016/04/25 22:00:04
I'm open to either providing a getter for the curr
felt
2016/04/26 01:46:28
I personally prefer moving the boolean to OnStart,
| |
124 | 125 |
125 // OnFailedProvisionalLoad is triggered when a provisional load failed and did | 126 // OnFailedProvisionalLoad is triggered when a provisional load failed and did |
126 // not commit. Note that provisional loads that result in downloads or 204s | 127 // not commit. Note that provisional loads that result in downloads or 204s |
127 // are aborted by the system, and thus considered failed provisional loads. | 128 // are aborted by the system, and thus considered failed provisional loads. |
128 virtual void OnFailedProvisionalLoad( | 129 virtual void OnFailedProvisionalLoad( |
129 content::NavigationHandle* navigation_handle) {} | 130 content::NavigationHandle* navigation_handle) {} |
130 | 131 |
132 // OnHidden is triggered when a page leaves the foreground. It does not fire | |
133 // when a foreground page is permanently closed; for that, listen to | |
134 // OnComplete instead. | |
135 virtual void OnHidden() {} | |
136 | |
137 // OnShown is triggered when a page is brought to the foreground. It does not | |
138 // fire when the page first loads; for that, listen for OnCommit instead. | |
Bryan McQuade
2016/04/25 22:00:04
if we move the boolean to OnStart let's update thi
felt
2016/04/26 01:46:29
Done.
| |
139 virtual void OnShown() {} | |
140 | |
131 // OnComplete is triggered when we are ready to record metrics for this page | 141 // OnComplete is triggered when we are ready to record metrics for this page |
132 // load. This will happen some time after commit. The PageLoadTiming struct | 142 // load. This will happen some time after commit. The PageLoadTiming struct |
133 // contains timing data and the PageLoadExtraInfo struct contains other useful | 143 // contains timing data and the PageLoadExtraInfo struct contains other useful |
134 // data collected over the course of the page load. If the load did not | 144 // data collected over the course of the page load. If the load did not |
135 // receive any timing information, |timing.IsEmpty()| will be true. | 145 // receive any timing information, |timing.IsEmpty()| will be true. |
136 // After this call, the object will be deleted. | 146 // After this call, the object will be deleted. |
137 virtual void OnComplete(const PageLoadTiming& timing, | 147 virtual void OnComplete(const PageLoadTiming& timing, |
138 const PageLoadExtraInfo& extra_info) {} | 148 const PageLoadExtraInfo& extra_info) {} |
139 }; | 149 }; |
140 | 150 |
141 } // namespace page_load_metrics | 151 } // namespace page_load_metrics |
142 | 152 |
143 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ | 153 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ |
OLD | NEW |