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