OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_OBSERVERS_ADS_PAGE_LOAD_METRICS_OBSERVE
R_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_ADS_PAGE_LOAD_METRICS_OBSERVE
R_H_ |
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_ADS_PAGE_LOAD_METRICS_OBSERVE
R_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_ADS_PAGE_LOAD_METRICS_OBSERVE
R_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" | 13 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" |
14 #include "net/http/http_response_info.h" | 14 #include "net/http/http_response_info.h" |
15 | 15 |
16 // This observer labels each sub-frame as an ad or not, and keeps track of | 16 // This observer labels each sub-frame as an ad or not, and keeps track of |
17 // relevant per-frame and whole-page byte statistics. | 17 // relevant per-frame and whole-page byte statistics. |
18 class AdsPageLoadMetricsObserver | 18 class AdsPageLoadMetricsObserver |
19 : public page_load_metrics::PageLoadMetricsObserver { | 19 : public page_load_metrics::PageLoadMetricsObserver { |
20 public: | 20 public: |
21 // Returns a new AdsPageLoadMetricObserver. If the feature is disabled it | 21 // Returns a new AdsPageLoadMetricObserver. If the feature is disabled it |
22 // returns nullptr. | 22 // returns nullptr. |
23 static std::unique_ptr<AdsPageLoadMetricsObserver> CreateIfNeeded(); | 23 static std::unique_ptr<AdsPageLoadMetricsObserver> CreateIfNeeded(); |
24 | 24 |
25 AdsPageLoadMetricsObserver(); | 25 AdsPageLoadMetricsObserver(); |
26 ~AdsPageLoadMetricsObserver() override; | 26 ~AdsPageLoadMetricsObserver() override; |
27 | 27 |
28 // page_load_metrics::PageLoadMetricsObserver | 28 // page_load_metrics::PageLoadMetricsObserver |
29 ObservePolicy OnCommit(content::NavigationHandle* navigation_handle) override; | 29 ObservePolicy OnCommit(content::NavigationHandle* navigation_handle) override; |
30 ObservePolicy OnDidFinishSubFrameNavigation( | 30 void OnDidFinishSubFrameNavigation( |
31 content::NavigationHandle* navigation_handle) override; | 31 content::NavigationHandle* navigation_handle) override; |
32 ObservePolicy FlushMetricsOnAppEnterBackground( | 32 ObservePolicy FlushMetricsOnAppEnterBackground( |
33 const page_load_metrics::PageLoadTiming& timing, | 33 const page_load_metrics::PageLoadTiming& timing, |
34 const page_load_metrics::PageLoadExtraInfo& extra_info) override; | 34 const page_load_metrics::PageLoadExtraInfo& extra_info) override; |
35 void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& | 35 void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& |
36 extra_request_info) override; | 36 extra_request_info) override; |
37 void OnComplete(const page_load_metrics::PageLoadTiming& timing, | 37 void OnComplete(const page_load_metrics::PageLoadTiming& timing, |
38 const page_load_metrics::PageLoadExtraInfo& info) override; | 38 const page_load_metrics::PageLoadExtraInfo& info) override; |
39 | 39 |
40 private: | 40 private: |
(...skipping 30 matching lines...) Expand all Loading... |
71 std::map<FrameTreeNodeId, page_load_metrics::ExtraRequestCompleteInfo> | 71 std::map<FrameTreeNodeId, page_load_metrics::ExtraRequestCompleteInfo> |
72 ongoing_navigation_resources_; | 72 ongoing_navigation_resources_; |
73 | 73 |
74 size_t page_bytes_ = 0u; | 74 size_t page_bytes_ = 0u; |
75 size_t uncached_page_bytes_ = 0u; | 75 size_t uncached_page_bytes_ = 0u; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(AdsPageLoadMetricsObserver); | 77 DISALLOW_COPY_AND_ASSIGN(AdsPageLoadMetricsObserver); |
78 }; | 78 }; |
79 | 79 |
80 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_ADS_PAGE_LOAD_METRICS_OBSE
RVER_H_ | 80 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_ADS_PAGE_LOAD_METRICS_OBSE
RVER_H_ |
OLD | NEW |