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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 // callbacks to indicate whether the observer would like to continue observing | 263 // callbacks to indicate whether the observer would like to continue observing |
264 // metric callbacks. Observers that wish to continue observing metric | 264 // metric callbacks. Observers that wish to continue observing metric |
265 // callbacks should return CONTINUE_OBSERVING; observers that wish to stop | 265 // callbacks should return CONTINUE_OBSERVING; observers that wish to stop |
266 // observing callbacks should return STOP_OBSERVING. Observers that return | 266 // observing callbacks should return STOP_OBSERVING. Observers that return |
267 // STOP_OBSERVING may be deleted. | 267 // STOP_OBSERVING may be deleted. |
268 enum ObservePolicy { | 268 enum ObservePolicy { |
269 CONTINUE_OBSERVING, | 269 CONTINUE_OBSERVING, |
270 STOP_OBSERVING, | 270 STOP_OBSERVING, |
271 }; | 271 }; |
272 | 272 |
273 typedef int FrameTreeNodeId; | |
jkarlin
2017/05/08 13:00:41
using FrameTreeNodeId = int;
Bryan McQuade
2017/05/08 15:26:32
Done
| |
274 | |
273 virtual ~PageLoadMetricsObserver() {} | 275 virtual ~PageLoadMetricsObserver() {} |
274 | 276 |
275 // The page load started, with the given navigation handle. | 277 // The page load started, with the given navigation handle. |
276 // currently_committed_url contains the URL of the committed page load at the | 278 // currently_committed_url contains the URL of the committed page load at the |
277 // time the navigation for navigation_handle was initiated, or the empty URL | 279 // time the navigation for navigation_handle was initiated, or the empty URL |
278 // if there was no committed page load at the time the navigation was | 280 // if there was no committed page load at the time the navigation was |
279 // initiated. | 281 // initiated. |
280 virtual ObservePolicy OnStart(content::NavigationHandle* navigation_handle, | 282 virtual ObservePolicy OnStart(content::NavigationHandle* navigation_handle, |
281 const GURL& currently_committed_url, | 283 const GURL& currently_committed_url, |
282 bool started_in_foreground); | 284 bool started_in_foreground); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 // callbacks below. | 330 // callbacks below. |
329 | 331 |
330 // OnTimingUpdate is triggered when an updated PageLoadTiming is | 332 // OnTimingUpdate is triggered when an updated PageLoadTiming is |
331 // available. This method may be called multiple times over the course of the | 333 // available. This method may be called multiple times over the course of the |
332 // page load. This method is currently only intended for use in testing. Most | 334 // page load. This method is currently only intended for use in testing. Most |
333 // implementers should implement one of the On* callbacks, such as | 335 // implementers should implement one of the On* callbacks, such as |
334 // OnFirstContentfulPaint or OnDomContentLoadedEventStart. Please email | 336 // OnFirstContentfulPaint or OnDomContentLoadedEventStart. Please email |
335 // loading-dev@chromium.org if you intend to override this method. | 337 // loading-dev@chromium.org if you intend to override this method. |
336 virtual void OnTimingUpdate(const PageLoadTiming& timing, | 338 virtual void OnTimingUpdate(const PageLoadTiming& timing, |
337 const PageLoadExtraInfo& extra_info) {} | 339 const PageLoadExtraInfo& extra_info) {} |
340 | |
341 // OnSubFrameTimingUpdate is triggered when an updated PageLoadTiming or | |
342 // PageLoadMetadata is available for a child frame of the current page | |
jkarlin
2017/05/08 13:00:41
Need ||'s around the argument names.
Bryan McQuade
2017/05/08 15:26:32
Done
| |
343 // load. The FrameTreeNodeId identifies the frame that navigation_start, | |
344 // child_timing, and child_metadata are associated with. The PageLoadExtraInfo | |
345 // contains the extra info associated with the page. navigation_start_offset | |
346 // reports the offset of the subframe's navigation start from the main frame's | |
347 // navigation_start. The timings reported in child_timing are relative to the | |
348 // frame's navigation_start. | |
349 virtual void OnSubFrameTimingUpdate(FrameTreeNodeId child_frame_id, | |
350 base::TimeDelta navigation_start_offset, | |
351 const PageLoadTiming& child_timing, | |
352 const PageLoadMetadata& child_metadata, | |
353 const PageLoadExtraInfo& extra_info) {} | |
354 | |
338 // OnUserInput is triggered when a new user input is passed in to | 355 // OnUserInput is triggered when a new user input is passed in to |
339 // web_contents. Contains a TimeDelta from navigation start. | 356 // web_contents. Contains a TimeDelta from navigation start. |
340 virtual void OnUserInput(const blink::WebInputEvent& event) {} | 357 virtual void OnUserInput(const blink::WebInputEvent& event) {} |
341 | 358 |
342 // The following methods are invoked at most once, when the timing for the | 359 // The following methods are invoked at most once, when the timing for the |
343 // associated event first becomes available. | 360 // associated event first becomes available. |
344 virtual void OnDomContentLoadedEventStart( | 361 virtual void OnDomContentLoadedEventStart( |
345 const PageLoadTiming& timing, | 362 const PageLoadTiming& timing, |
346 const PageLoadExtraInfo& extra_info) {} | 363 const PageLoadExtraInfo& extra_info) {} |
347 virtual void OnLoadEventStart(const PageLoadTiming& timing, | 364 virtual void OnLoadEventStart(const PageLoadTiming& timing, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 // Called whenever a request is loaded for this page load. This comes | 443 // Called whenever a request is loaded for this page load. This comes |
427 // unfiltered from the ResourceDispatcherHost and may include blob requests | 444 // unfiltered from the ResourceDispatcherHost and may include blob requests |
428 // and data uris. | 445 // and data uris. |
429 virtual void OnLoadedResource( | 446 virtual void OnLoadedResource( |
430 const ExtraRequestCompleteInfo& extra_request_complete_info) {} | 447 const ExtraRequestCompleteInfo& extra_request_complete_info) {} |
431 }; | 448 }; |
432 | 449 |
433 } // namespace page_load_metrics | 450 } // namespace page_load_metrics |
434 | 451 |
435 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 452 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
OLD | NEW |