| 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 "content/public/browser/web_contents.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 class PageLoadMetricsObservable; | 16 class PageLoadMetricsObservable; |
| 16 | 17 |
| 17 // This enum represents how a page load ends. If the action occurs before the | 18 // This enum represents how a page load ends. If the action occurs before the |
| 18 // page load finishes (or reaches some point like first paint), then we consider | 19 // page load finishes (or reaches some point like first paint), then we consider |
| 19 // the load to be aborted. | 20 // the load to be aborted. |
| 20 enum UserAbortType { | 21 enum UserAbortType { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 101 |
| 101 // The page load started, with the given navigation handle. Note that OnStart | 102 // The page load started, with the given navigation handle. Note that OnStart |
| 102 // is called for same-page navigations. Implementers of OnStart that only want | 103 // is called for same-page navigations. Implementers of OnStart that only want |
| 103 // to process non-same-page navigations should also check to see that the page | 104 // to process non-same-page navigations should also check to see that the page |
| 104 // load committed via OnCommit or committed_url in | 105 // load committed via OnCommit or committed_url in |
| 105 // PageLoadExtraInfo. currently_committed_url contains the URL of the | 106 // PageLoadExtraInfo. currently_committed_url contains the URL of the |
| 106 // committed page load at the time the navigation for navigation_handle was | 107 // committed page load at the time the navigation for navigation_handle was |
| 107 // initiated, or the empty URL if there was no committed page load at the time | 108 // initiated, or the empty URL if there was no committed page load at the time |
| 108 // the navigation was initiated. | 109 // the navigation was initiated. |
| 109 virtual void OnStart(content::NavigationHandle* navigation_handle, | 110 virtual void OnStart(content::NavigationHandle* navigation_handle, |
| 111 content::WebContents* web_contents, |
| 110 const GURL& currently_committed_url) {} | 112 const GURL& currently_committed_url) {} |
| 111 | 113 |
| 112 // OnRedirect is triggered when a page load redirects to another URL. | 114 // OnRedirect is triggered when a page load redirects to another URL. |
| 113 // The navigation handle holds relevant data for the navigation, but will | 115 // 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 | 116 // be destroyed soon after this call. Don't hold a reference to it. This can |
| 115 // be called multiple times. | 117 // be called multiple times. |
| 116 virtual void OnRedirect(content::NavigationHandle* navigation_handle) {} | 118 virtual void OnRedirect(content::NavigationHandle* navigation_handle) {} |
| 117 | 119 |
| 118 // OnCommit is triggered when a page load commits, i.e. when we receive the | 120 // 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 | 121 // first data for the request. The navigation handle holds relevant data for |
| (...skipping 14 matching lines...) Expand all Loading... |
| 134 // data collected over the course of the page load. If the load did not | 136 // data collected over the course of the page load. If the load did not |
| 135 // receive any timing information, |timing.IsEmpty()| will be true. | 137 // receive any timing information, |timing.IsEmpty()| will be true. |
| 136 // After this call, the object will be deleted. | 138 // After this call, the object will be deleted. |
| 137 virtual void OnComplete(const PageLoadTiming& timing, | 139 virtual void OnComplete(const PageLoadTiming& timing, |
| 138 const PageLoadExtraInfo& extra_info) {} | 140 const PageLoadExtraInfo& extra_info) {} |
| 139 }; | 141 }; |
| 140 | 142 |
| 141 } // namespace page_load_metrics | 143 } // namespace page_load_metrics |
| 142 | 144 |
| 143 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ | 145 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_OBSERVER_H_ |
| OLD | NEW |