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_CORE_DATA_USE_USER_DATA_H_ | 5 #ifndef COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_USER_DATA_H_ |
6 #define COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_USER_DATA_H_ | 6 #define COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_USER_DATA_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 class URLFetcher; | 15 class URLFetcher; |
15 } | 16 } |
16 | 17 |
17 namespace data_use_measurement { | 18 namespace data_use_measurement { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 TYPE_MAX = 13, | 90 TYPE_MAX = 13, |
90 }; | 91 }; |
91 | 92 |
92 // The state of the application. Only available on Android and on other | 93 // The state of the application. Only available on Android and on other |
93 // platforms it is always FOREGROUND. | 94 // platforms it is always FOREGROUND. |
94 enum AppState { UNKNOWN, BACKGROUND, FOREGROUND }; | 95 enum AppState { UNKNOWN, BACKGROUND, FOREGROUND }; |
95 | 96 |
96 DataUseUserData(ServiceName service_name, AppState app_state); | 97 DataUseUserData(ServiceName service_name, AppState app_state); |
97 ~DataUseUserData() override; | 98 ~DataUseUserData() override; |
98 | 99 |
99 // Helper function to create DataUseUserData. The caller takes the ownership | 100 // Helper function to create DataUseUserData. |
100 // of the returned object. | 101 static std::unique_ptr<base::SupportsUserData::Data> Create( |
101 static base::SupportsUserData::Data* Create( | |
102 DataUseUserData::ServiceName service); | 102 DataUseUserData::ServiceName service); |
103 | 103 |
104 // Return the service name of the ServiceName enum. | 104 // Return the service name of the ServiceName enum. |
105 static std::string GetServiceNameAsString(ServiceName service); | 105 static std::string GetServiceNameAsString(ServiceName service); |
106 | 106 |
107 // Services should use this function to attach their |service_name| to the | 107 // Services should use this function to attach their |service_name| to the |
108 // URLFetcher serving them. | 108 // URLFetcher serving them. |
109 static void AttachToFetcher(net::URLFetcher* fetcher, | 109 static void AttachToFetcher(net::URLFetcher* fetcher, |
110 ServiceName service_name); | 110 ServiceName service_name); |
111 | 111 |
(...skipping 19 matching lines...) Expand all Loading... |
131 AppState app_state_; | 131 AppState app_state_; |
132 | 132 |
133 DataUseContentType content_type_; | 133 DataUseContentType content_type_; |
134 | 134 |
135 DISALLOW_COPY_AND_ASSIGN(DataUseUserData); | 135 DISALLOW_COPY_AND_ASSIGN(DataUseUserData); |
136 }; | 136 }; |
137 | 137 |
138 } // namespace data_use_measurement | 138 } // namespace data_use_measurement |
139 | 139 |
140 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_USER_DATA_H_ | 140 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_USER_DATA_H_ |
OLD | NEW |