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 "components/page_load_metrics/common/page_load_timing.h" | 8 #include "components/page_load_metrics/common/page_load_timing.h" |
9 #include "content/public/browser/navigation_handle.h" | 9 #include "content/public/browser/navigation_handle.h" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 // OnCommit to be fired without a subsequent OnComplete (i.e. if an error | 33 // OnCommit to be fired without a subsequent OnComplete (i.e. if an error |
34 // occurs or we don't have any metrics to log). PageLoadMetricsObservers are | 34 // occurs or we don't have any metrics to log). PageLoadMetricsObservers are |
35 // required to stop observing (call PageLoadMetricsObservable::RemoveObserver) | 35 // required to stop observing (call PageLoadMetricsObservable::RemoveObserver) |
36 // some time before the OnPageLoadMetricsGoingAway trigger finishes. If this | 36 // some time before the OnPageLoadMetricsGoingAway trigger finishes. If this |
37 // class is destroyed before the PageLoadMetricsObservable, it should call | 37 // class is destroyed before the PageLoadMetricsObservable, it should call |
38 // RemoveObserver in its destructor. | 38 // RemoveObserver in its destructor. |
39 class PageLoadMetricsObserver { | 39 class PageLoadMetricsObserver { |
40 public: | 40 public: |
41 virtual ~PageLoadMetricsObserver() {} | 41 virtual ~PageLoadMetricsObserver() {} |
42 | 42 |
| 43 // OnRedirect is triggered when a page load redirects to another URL. |
| 44 // The navigation handle holds relevant data for the navigation, but will |
| 45 // be destroyed soon after this call. Don't hold a reference to it. |
| 46 virtual void OnRedirect(content::NavigationHandle* navigation_handle) {} |
| 47 |
43 // OnCommit is triggered when a page load commits, i.e. when we receive the | 48 // OnCommit is triggered when a page load commits, i.e. when we receive the |
44 // first data for the request. The navigation handle holds relevant data for | 49 // first data for the request. The navigation handle holds relevant data for |
45 // the navigation, but will be destroyed soon after this call. Don't hold a | 50 // the navigation, but will be destroyed soon after this call. Don't hold a |
46 // reference to it. | 51 // reference to it. |
47 virtual void OnCommit(content::NavigationHandle* navigation_handle) {} | 52 virtual void OnCommit(content::NavigationHandle* navigation_handle) {} |
48 | 53 |
49 // OnComplete is triggered when we are ready to record metrics for this page | 54 // OnComplete is triggered when we are ready to record metrics for this page |
50 // load. This will happen some time after commit, and will be triggered as | 55 // load. This will happen some time after commit, and will be triggered as |
51 // long as we've received some data about the page load. The | 56 // long as we've received some data about the page load. The |
52 // PageLoadTiming struct contains timing data and the PageLoadExtraInfo struct | 57 // PageLoadTiming struct contains timing data and the PageLoadExtraInfo struct |
(...skipping 12 matching lines...) Expand all Loading... |
65 class PageLoadMetricsObservable { | 70 class PageLoadMetricsObservable { |
66 public: | 71 public: |
67 virtual ~PageLoadMetricsObservable() {} | 72 virtual ~PageLoadMetricsObservable() {} |
68 virtual void AddObserver(PageLoadMetricsObserver* observer) = 0; | 73 virtual void AddObserver(PageLoadMetricsObserver* observer) = 0; |
69 virtual void RemoveObserver(PageLoadMetricsObserver* observer) = 0; | 74 virtual void RemoveObserver(PageLoadMetricsObserver* observer) = 0; |
70 }; | 75 }; |
71 | 76 |
72 } // namespace page_load_metrics | 77 } // namespace page_load_metrics |
73 | 78 |
74 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ | 79 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ |
OLD | NEW |