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 COMPONENTS_DATA_USE_MEASUREMENT_CORE_URL_REQUEST_CLASSIFIER_H_ | 5 #ifndef COMPONENTS_DATA_USE_MEASUREMENT_CORE_URL_REQUEST_CLASSIFIER_H_ |
6 #define COMPONENTS_DATA_USE_MEASUREMENT_CORE_URL_REQUEST_CLASSIFIER_H_ | 6 #define COMPONENTS_DATA_USE_MEASUREMENT_CORE_URL_REQUEST_CLASSIFIER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include "components/data_use_measurement/core/data_use_user_data.h" | 10 #include "components/data_use_measurement/core/data_use_user_data.h" |
9 | 11 |
10 namespace net { | 12 namespace net { |
11 class HttpResponseHeaders; | 13 class HttpResponseHeaders; |
12 class URLRequest; | 14 class URLRequest; |
13 } | 15 } |
14 | 16 |
15 namespace data_use_measurement { | 17 namespace data_use_measurement { |
16 | 18 |
17 // Interface for a classifier that can classify URL requests. | 19 // Interface for a classifier that can classify URL requests. |
18 class URLRequestClassifier { | 20 class URLRequestClassifier { |
19 public: | 21 public: |
20 virtual ~URLRequestClassifier() {} | 22 virtual ~URLRequestClassifier() {} |
21 | 23 |
22 // Returns true if the URLRequest |request| is initiated by user traffic. | 24 // Returns true if the URLRequest |request| is initiated by user traffic. |
23 virtual bool IsUserRequest(const net::URLRequest& request) const = 0; | 25 virtual bool IsUserRequest(const net::URLRequest& request) const = 0; |
24 | 26 |
25 // Returns the content type of the URL request |request| with response headers | 27 // Returns the content type of the URL request |request| with response headers |
26 // |response_headers|. |is_app_foreground| and |is_tab_visible| indicate the | 28 // |response_headers|. |is_app_foreground| and |is_tab_visible| indicate the |
27 // current app and tab visibility state. | 29 // current app and tab visibility state. |
28 virtual DataUseUserData::DataUseContentType GetContentType( | 30 virtual DataUseUserData::DataUseContentType GetContentType( |
29 const net::URLRequest& request, | 31 const net::URLRequest& request, |
30 const net::HttpResponseHeaders& response_headers) const = 0; | 32 const net::HttpResponseHeaders& response_headers) const = 0; |
| 33 |
| 34 // Records the page transition histograms. |
| 35 virtual void RecordPageTransitionUMA(uint64_t page_transition, |
| 36 int64_t received_bytes) const = 0; |
31 }; | 37 }; |
32 | 38 |
33 } // namespace data_use_measurement | 39 } // namespace data_use_measurement |
34 | 40 |
35 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_URL_REQUEST_CLASSIFIER_H_ | 41 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_URL_REQUEST_CLASSIFIER_H_ |
OLD | NEW |