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 | |
17 // relevant per-frame and whole-page byte statistics. | |
18 class AdsPageLoadMetricsObserver | 16 class AdsPageLoadMetricsObserver |
19 : public page_load_metrics::PageLoadMetricsObserver { | 17 : public page_load_metrics::PageLoadMetricsObserver { |
20 public: | 18 public: |
21 // Returns a new AdsPageLoadMetricObserver. If the feature is disabled it | 19 // Returns a new AdsPageLoadMetricObserver. If the feature is disabled it |
22 // returns nullptr. | 20 // returns nullptr. |
23 static std::unique_ptr<AdsPageLoadMetricsObserver> CreateIfNeeded(); | 21 static std::unique_ptr<AdsPageLoadMetricsObserver> CreateIfNeeded(); |
24 | 22 |
25 AdsPageLoadMetricsObserver(); | 23 AdsPageLoadMetricsObserver(); |
26 ~AdsPageLoadMetricsObserver() override; | 24 ~AdsPageLoadMetricsObserver() override; |
27 | 25 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 73 |
76 size_t page_bytes_ = 0u; | 74 size_t page_bytes_ = 0u; |
77 size_t uncached_page_bytes_ = 0u; | 75 size_t uncached_page_bytes_ = 0u; |
78 int top_level_subframe_count_ = 0; | 76 int top_level_subframe_count_ = 0; |
79 int top_level_ad_frame_count_ = 0; | 77 int top_level_ad_frame_count_ = 0; |
80 | 78 |
81 DISALLOW_COPY_AND_ASSIGN(AdsPageLoadMetricsObserver); | 79 DISALLOW_COPY_AND_ASSIGN(AdsPageLoadMetricsObserver); |
82 }; | 80 }; |
83 | 81 |
84 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_ADS_PAGE_LOAD_METRICS_OBSE
RVER_H_ | 82 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_ADS_PAGE_LOAD_METRICS_OBSE
RVER_H_ |
OLD | NEW |