OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_METRICS_NAVIGATION_THROTTLE_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_NAVIGATION_THROTTLE_H_ |
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_NAVIGATION_THROTTLE_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_NAVIGATION_THROTTLE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/public/browser/navigation_throttle.h" | 11 #include "content/public/browser/navigation_throttle.h" |
12 | 12 |
13 namespace page_load_metrics { | 13 namespace page_load_metrics { |
14 | 14 |
15 // This class is used to forward calls to the MetricsWebContentsObserver. | 15 // This class is used to forward calls to the MetricsWebContentsObserver. |
16 // Namely, WillStartRequest() is called on NavigationThrottles, but not on | 16 // Namely, WillStartRequest() is called on NavigationThrottles, but not on |
17 // WebContentsObservers. Data from the NavigationHandle accessed at this point | 17 // WebContentsObservers. Data from the NavigationHandle accessed at this point |
18 // is used to obtain more reliable abort metrics (like page transition type). | 18 // is used to obtain more reliable abort metrics (like page transition type). |
19 class MetricsNavigationThrottle : public content::NavigationThrottle { | 19 class MetricsNavigationThrottle : public content::NavigationThrottle { |
20 public: | 20 public: |
21 static std::unique_ptr<content::NavigationThrottle> Create( | 21 static std::unique_ptr<content::NavigationThrottle> Create( |
22 content::NavigationHandle* handle); | 22 content::NavigationHandle* handle); |
23 ~MetricsNavigationThrottle() override; | 23 ~MetricsNavigationThrottle() override; |
24 | 24 |
25 // content::NavigationThrottle: | 25 // content::NavigationThrottle: |
26 content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override; | 26 content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override; |
27 content::NavigationThrottle::ThrottleCheckResult WillProcessResponse() | 27 content::NavigationThrottle::ThrottleCheckResult WillProcessResponse() |
28 override; | 28 override; |
| 29 const char* GetNameForLogging() override; |
29 | 30 |
30 private: | 31 private: |
31 explicit MetricsNavigationThrottle(content::NavigationHandle* handle); | 32 explicit MetricsNavigationThrottle(content::NavigationHandle* handle); |
32 | 33 |
33 DISALLOW_COPY_AND_ASSIGN(MetricsNavigationThrottle); | 34 DISALLOW_COPY_AND_ASSIGN(MetricsNavigationThrottle); |
34 }; | 35 }; |
35 | 36 |
36 } // namespace page_load_metrics | 37 } // namespace page_load_metrics |
37 | 38 |
38 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_NAVIGATION_THROTTLE_H_ | 39 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_METRICS_NAVIGATION_THROTTLE_H_ |
OLD | NEW |