OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CONTENT_DATA_USE_MEASUREMENT_H_ | 5 #ifndef COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_ |
6 #define COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_ | 6 #define COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Records the data use of the |request|, thus |request| must be non-null. | 38 // Records the data use of the |request|, thus |request| must be non-null. |
39 void ReportDataUseUMA(const net::URLRequest* request) const; | 39 void ReportDataUseUMA(const net::URLRequest* request) const; |
40 | 40 |
41 #if defined(OS_ANDROID) | 41 #if defined(OS_ANDROID) |
42 // This function should just be used for testing purposes. A change in | 42 // This function should just be used for testing purposes. A change in |
43 // application state can be simulated by calling this function. | 43 // application state can be simulated by calling this function. |
44 void OnApplicationStateChangeForTesting( | 44 void OnApplicationStateChangeForTesting( |
45 base::android::ApplicationState application_state); | 45 base::android::ApplicationState application_state); |
46 #endif | 46 #endif |
47 | |
48 private: | 47 private: |
49 // Specifies that data is received or sent, respectively. | 48 // Specifies that data is received or sent, respectively. |
50 enum TrafficDirection { DOWNSTREAM, UPSTREAM }; | 49 enum TrafficDirection { DOWNSTREAM, UPSTREAM }; |
51 | 50 |
52 // The state of the application. Only available on Android and on other | 51 // The state of the application. Only available on Android and on other |
53 // platforms it is always FOREGROUND. | 52 // platforms it is always FOREGROUND. |
54 enum AppState { BACKGROUND, FOREGROUND }; | 53 enum AppState { BACKGROUND, FOREGROUND }; |
55 | 54 |
56 // Returns the current application state (Foreground or Background). It always | 55 // Returns the current application state (Foreground or Background). It always |
57 // returns Foreground if Chrome is not running on Android. | 56 // returns Foreground if Chrome is not running on Android. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // foreground or in the background. It is owned by DataUseMeasurement. | 89 // foreground or in the background. It is owned by DataUseMeasurement. |
91 scoped_ptr<base::android::ApplicationStatusListener> app_listener_; | 90 scoped_ptr<base::android::ApplicationStatusListener> app_listener_; |
92 #endif | 91 #endif |
93 | 92 |
94 DISALLOW_COPY_AND_ASSIGN(DataUseMeasurement); | 93 DISALLOW_COPY_AND_ASSIGN(DataUseMeasurement); |
95 }; | 94 }; |
96 | 95 |
97 } // namespace data_use_measurement | 96 } // namespace data_use_measurement |
98 | 97 |
99 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_ | 98 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CONTENT_DATA_USE_MEASUREMENT_H_ |
OLD | NEW |