| 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 #include "android_webview/browser/aw_metrics_service_client.h" | 5 #include "android_webview/browser/aw_metrics_service_client.h" |
| 6 | 6 |
| 7 #include "android_webview/common/aw_version_info_values.h" | 7 #include "android_webview/common/aw_version_info_values.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 void AwMetricsServiceClient::SetMetricsClientId(const std::string& client_id) {} | 158 void AwMetricsServiceClient::SetMetricsClientId(const std::string& client_id) {} |
| 159 | 159 |
| 160 void AwMetricsServiceClient::OnRecordingDisabled() {} | 160 void AwMetricsServiceClient::OnRecordingDisabled() {} |
| 161 | 161 |
| 162 bool AwMetricsServiceClient::IsOffTheRecordSessionActive() { | 162 bool AwMetricsServiceClient::IsOffTheRecordSessionActive() { |
| 163 // WebView has no incognito mode. | 163 // WebView has no incognito mode. |
| 164 return false; | 164 return false; |
| 165 } | 165 } |
| 166 | 166 |
| 167 int32_t AwMetricsServiceClient::GetProduct() { | 167 int32_t AwMetricsServiceClient::GetProduct() { |
| 168 // TODO(paulmiller) Switch this to a WebView product once we have a log source | 168 return ::metrics::ChromeUserMetricsExtension::ANDROID_WEBVIEW; |
| 169 // for WebView. | |
| 170 return ::metrics::ChromeUserMetricsExtension::CHROME; | |
| 171 } | 169 } |
| 172 | 170 |
| 173 std::string AwMetricsServiceClient::GetApplicationLocale() { | 171 std::string AwMetricsServiceClient::GetApplicationLocale() { |
| 174 return base::i18n::GetConfiguredLocale(); | 172 return base::i18n::GetConfiguredLocale(); |
| 175 } | 173 } |
| 176 | 174 |
| 177 bool AwMetricsServiceClient::GetBrand(std::string* brand_code) { | 175 bool AwMetricsServiceClient::GetBrand(std::string* brand_code) { |
| 178 // WebView doesn't use brand codes. | 176 // WebView doesn't use brand codes. |
| 179 return false; | 177 return false; |
| 180 } | 178 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 199 void AwMetricsServiceClient::CollectFinalMetricsForLog( | 197 void AwMetricsServiceClient::CollectFinalMetricsForLog( |
| 200 const base::Closure& done_callback) { | 198 const base::Closure& done_callback) { |
| 201 done_callback.Run(); | 199 done_callback.Run(); |
| 202 } | 200 } |
| 203 | 201 |
| 204 scoped_ptr<metrics::MetricsLogUploader> AwMetricsServiceClient::CreateUploader( | 202 scoped_ptr<metrics::MetricsLogUploader> AwMetricsServiceClient::CreateUploader( |
| 205 const base::Callback<void(int)>& on_upload_complete) { | 203 const base::Callback<void(int)>& on_upload_complete) { |
| 206 return scoped_ptr<::metrics::MetricsLogUploader>( | 204 return scoped_ptr<::metrics::MetricsLogUploader>( |
| 207 new metrics::NetMetricsLogUploader( | 205 new metrics::NetMetricsLogUploader( |
| 208 request_context_, | 206 request_context_, |
| 209 // TODO(paulmiller): Switch this to metrics::kDefaultMetricsServerUrl | 207 metrics::kDefaultMetricsServerUrl, |
| 210 // once we have a log source for WebView. | 208 metrics::kDefaultMetricsMimeType, |
| 211 "http://localhost:10000/uma/v2", metrics::kDefaultMetricsMimeType, | |
| 212 on_upload_complete)); | 209 on_upload_complete)); |
| 213 } | 210 } |
| 214 | 211 |
| 215 base::TimeDelta AwMetricsServiceClient::GetStandardUploadInterval() { | 212 base::TimeDelta AwMetricsServiceClient::GetStandardUploadInterval() { |
| 216 return base::TimeDelta::FromMinutes(kUploadIntervalMinutes); | 213 return base::TimeDelta::FromMinutes(kUploadIntervalMinutes); |
| 217 } | 214 } |
| 218 | 215 |
| 219 AwMetricsServiceClient::AwMetricsServiceClient() | 216 AwMetricsServiceClient::AwMetricsServiceClient() |
| 220 : is_initialized_(false), | 217 : is_initialized_(false), |
| 221 is_enabled_(false), | 218 is_enabled_(false), |
| 222 pref_service_(nullptr), | 219 pref_service_(nullptr), |
| 223 request_context_(nullptr) {} | 220 request_context_(nullptr) {} |
| 224 | 221 |
| 225 AwMetricsServiceClient::~AwMetricsServiceClient() {} | 222 AwMetricsServiceClient::~AwMetricsServiceClient() {} |
| 226 | 223 |
| 227 bool AwMetricsServiceClient::is_reporting_enabled() { | 224 bool AwMetricsServiceClient::is_reporting_enabled() { |
| 228 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 225 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 229 return is_enabled_; | 226 return is_enabled_; |
| 230 } | 227 } |
| 231 | 228 |
| 232 } // namespace android_webview | 229 } // namespace android_webview |
| OLD | NEW |