| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/optional.h" | 11 #include "base/optional.h" |
| 12 #include "chrome/common/page_load_metrics/page_load_timing.h" | 12 #include "chrome/common/page_load_metrics/page_load_timing.h" |
| 13 #include "content/public/browser/navigation_handle.h" | 13 #include "content/public/browser/navigation_handle.h" |
| 14 #include "content/public/browser/web_contents_observer.h" |
| 14 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 15 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 16 | 17 |
| 17 namespace page_load_metrics { | 18 namespace page_load_metrics { |
| 18 | 19 |
| 19 // This enum represents how a page load ends. If the action occurs before the | 20 // This enum represents how a page load ends. If the action occurs before the |
| 20 // page load finishes (or reaches some point like first paint), then we consider | 21 // page load finishes (or reaches some point like first paint), then we consider |
| 21 // the load to be aborted. | 22 // the load to be aborted. |
| 22 enum PageEndReason { | 23 enum PageEndReason { |
| 23 // Page lifetime has not yet ended (page is still active). | 24 // Page lifetime has not yet ended (page is still active). |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 virtual void OnParseStart(const PageLoadTiming& timing, | 317 virtual void OnParseStart(const PageLoadTiming& timing, |
| 317 const PageLoadExtraInfo& extra_info) {} | 318 const PageLoadExtraInfo& extra_info) {} |
| 318 virtual void OnParseStop(const PageLoadTiming& timing, | 319 virtual void OnParseStop(const PageLoadTiming& timing, |
| 319 const PageLoadExtraInfo& extra_info) {} | 320 const PageLoadExtraInfo& extra_info) {} |
| 320 | 321 |
| 321 // Invoked when there is a change in either the main_frame_metadata or the | 322 // Invoked when there is a change in either the main_frame_metadata or the |
| 322 // child_frame_metadata's loading behavior_flags. | 323 // child_frame_metadata's loading behavior_flags. |
| 323 virtual void OnLoadingBehaviorObserved( | 324 virtual void OnLoadingBehaviorObserved( |
| 324 const page_load_metrics::PageLoadExtraInfo& extra_info) {} | 325 const page_load_metrics::PageLoadExtraInfo& extra_info) {} |
| 325 | 326 |
| 327 // Invoked when a media element starts playing. |
| 328 virtual void MediaStartedPlaying( |
| 329 const content::WebContentsObserver::MediaPlayerInfo& video_type, |
| 330 bool is_in_main_frame) {} |
| 331 |
| 326 // Invoked when the UMA metrics subsystem is persisting metrics as the | 332 // Invoked when the UMA metrics subsystem is persisting metrics as the |
| 327 // application goes into the background, on platforms where the browser | 333 // application goes into the background, on platforms where the browser |
| 328 // process may be killed after backgrounding (Android). Implementers should | 334 // process may be killed after backgrounding (Android). Implementers should |
| 329 // persist any metrics that have been buffered in memory in this callback, as | 335 // persist any metrics that have been buffered in memory in this callback, as |
| 330 // the application may be killed at any time after this method is invoked | 336 // the application may be killed at any time after this method is invoked |
| 331 // without further notification. Note that this may be called both for | 337 // without further notification. Note that this may be called both for |
| 332 // provisional loads as well as committed loads. Implementations that only | 338 // provisional loads as well as committed loads. Implementations that only |
| 333 // want to track committed loads should check whether extra_info.committed_url | 339 // want to track committed loads should check whether extra_info.committed_url |
| 334 // is empty to determine if the load had committed. If the implementation | 340 // is empty to determine if the load had committed. If the implementation |
| 335 // returns CONTINUE_OBSERVING, this method may be called multiple times per | 341 // returns CONTINUE_OBSERVING, this method may be called multiple times per |
| (...skipping 27 matching lines...) Expand all Loading... |
| 363 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 369 const FailedProvisionalLoadInfo& failed_provisional_load_info, |
| 364 const PageLoadExtraInfo& extra_info) {} | 370 const PageLoadExtraInfo& extra_info) {} |
| 365 | 371 |
| 366 // Called whenever a request is loaded for this page load. | 372 // Called whenever a request is loaded for this page load. |
| 367 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} | 373 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} |
| 368 }; | 374 }; |
| 369 | 375 |
| 370 } // namespace page_load_metrics | 376 } // namespace page_load_metrics |
| 371 | 377 |
| 372 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 378 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| OLD | NEW |