| 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" |
| 11 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 12 | 13 |
| 13 namespace page_load_metrics { | 14 namespace page_load_metrics { |
| 14 | 15 |
| 15 // This enum represents how a page load ends. If the action occurs before the | 16 // This enum represents how a page load ends. If the action occurs before the |
| 16 // page load finishes (or reaches some point like first paint), then we consider | 17 // page load finishes (or reaches some point like first paint), then we consider |
| 17 // the load to be aborted. | 18 // the load to be aborted. |
| 18 enum UserAbortType { | 19 enum UserAbortType { |
| 19 // Represents no abort. | 20 // Represents no abort. |
| 20 ABORT_NONE, | 21 ABORT_NONE, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 147 |
| 147 // OnComplete is triggered when we are ready to record metrics for this page | 148 // OnComplete is triggered when we are ready to record metrics for this page |
| 148 // load. This will happen some time after commit. The PageLoadTiming struct | 149 // load. This will happen some time after commit. The PageLoadTiming struct |
| 149 // contains timing data and the PageLoadExtraInfo struct contains other useful | 150 // contains timing data and the PageLoadExtraInfo struct contains other useful |
| 150 // data collected over the course of the page load. If the load did not | 151 // data collected over the course of the page load. If the load did not |
| 151 // receive any timing information, |timing.IsEmpty()| will be true. | 152 // receive any timing information, |timing.IsEmpty()| will be true. |
| 152 // After this call, the object will be deleted. | 153 // After this call, the object will be deleted. |
| 153 virtual void OnComplete(const PageLoadTiming& timing, | 154 virtual void OnComplete(const PageLoadTiming& timing, |
| 154 const PageLoadExtraInfo& extra_info) {} | 155 const PageLoadExtraInfo& extra_info) {} |
| 155 | 156 |
| 157 // OnUserInput is triggered when a new user input is passed in to |
| 158 // web_contents. Contains a TimeDelta from navigation start. |
| 159 virtual void OnUserInput(const blink::WebInputEvent& event) {} |
| 160 |
| 156 // The following methods are invoked at most once, when the timing for the | 161 // The following methods are invoked at most once, when the timing for the |
| 157 // associated event first becomes available. | 162 // associated event first becomes available. |
| 158 virtual void OnDomContentLoadedEventStart( | 163 virtual void OnDomContentLoadedEventStart( |
| 159 const PageLoadTiming& timing, | 164 const PageLoadTiming& timing, |
| 160 const PageLoadExtraInfo& extra_info) {} | 165 const PageLoadExtraInfo& extra_info) {} |
| 161 virtual void OnLoadEventStart(const PageLoadTiming& timing, | 166 virtual void OnLoadEventStart(const PageLoadTiming& timing, |
| 162 const PageLoadExtraInfo& extra_info) {} | 167 const PageLoadExtraInfo& extra_info) {} |
| 163 virtual void OnFirstLayout(const PageLoadTiming& timing, | 168 virtual void OnFirstLayout(const PageLoadTiming& timing, |
| 164 const PageLoadExtraInfo& extra_info) {} | 169 const PageLoadExtraInfo& extra_info) {} |
| 165 virtual void OnFirstPaint(const PageLoadTiming& timing, | 170 virtual void OnFirstPaint(const PageLoadTiming& timing, |
| 166 const PageLoadExtraInfo& extra_info) {} | 171 const PageLoadExtraInfo& extra_info) {} |
| 167 virtual void OnFirstTextPaint(const PageLoadTiming& timing, | 172 virtual void OnFirstTextPaint(const PageLoadTiming& timing, |
| 168 const PageLoadExtraInfo& extra_info) {} | 173 const PageLoadExtraInfo& extra_info) {} |
| 169 virtual void OnFirstImagePaint(const PageLoadTiming& timing, | 174 virtual void OnFirstImagePaint(const PageLoadTiming& timing, |
| 170 const PageLoadExtraInfo& extra_info) {} | 175 const PageLoadExtraInfo& extra_info) {} |
| 171 virtual void OnFirstContentfulPaint(const PageLoadTiming& timing, | 176 virtual void OnFirstContentfulPaint(const PageLoadTiming& timing, |
| 172 const PageLoadExtraInfo& extra_info) {} | 177 const PageLoadExtraInfo& extra_info) {} |
| 173 virtual void OnParseStart(const PageLoadTiming& timing, | 178 virtual void OnParseStart(const PageLoadTiming& timing, |
| 174 const PageLoadExtraInfo& extra_info) {} | 179 const PageLoadExtraInfo& extra_info) {} |
| 175 virtual void OnParseStop(const PageLoadTiming& timing, | 180 virtual void OnParseStop(const PageLoadTiming& timing, |
| 176 const PageLoadExtraInfo& extra_info) {} | 181 const PageLoadExtraInfo& extra_info) {} |
| 177 }; | 182 }; |
| 178 | 183 |
| 179 } // namespace page_load_metrics | 184 } // namespace page_load_metrics |
| 180 | 185 |
| 181 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ | 186 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ |
| OLD | NEW |