OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/metrics/cast_metrics_service_client.h" | 5 #include "chromecast/browser/metrics/cast_metrics_service_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/guid.h" | 8 #include "base/guid.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 void CastMetricsServiceClient::InitializeSystemProfileMetrics( | 225 void CastMetricsServiceClient::InitializeSystemProfileMetrics( |
226 const base::Closure& done_callback) { | 226 const base::Closure& done_callback) { |
227 done_callback.Run(); | 227 done_callback.Run(); |
228 } | 228 } |
229 | 229 |
230 void CastMetricsServiceClient::CollectFinalMetricsForLog( | 230 void CastMetricsServiceClient::CollectFinalMetricsForLog( |
231 const base::Closure& done_callback) { | 231 const base::Closure& done_callback) { |
232 done_callback.Run(); | 232 done_callback.Run(); |
233 } | 233 } |
234 | 234 |
235 std::unique_ptr<::metrics::MetricsLogUploader> | 235 std::string CastMetricsServiceClient::GetMetricsServerUrl() { |
236 CastMetricsServiceClient::CreateUploader( | |
237 const base::Callback<void(int)>& on_upload_complete) { | |
238 std::string uma_server_url(::metrics::kDefaultMetricsServerUrl); | 236 std::string uma_server_url(::metrics::kDefaultMetricsServerUrl); |
239 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 237 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
240 if (command_line->HasSwitch(switches::kOverrideMetricsUploadUrl)) { | 238 if (command_line->HasSwitch(switches::kOverrideMetricsUploadUrl)) { |
241 uma_server_url.assign( | 239 uma_server_url.assign( |
242 command_line->GetSwitchValueASCII(switches::kOverrideMetricsUploadUrl)); | 240 command_line->GetSwitchValueASCII(switches::kOverrideMetricsUploadUrl)); |
243 } | 241 } |
244 DCHECK(!uma_server_url.empty()); | 242 DCHECK(!uma_server_url.empty()); |
| 243 return uma_server_url; |
| 244 } |
| 245 |
| 246 std::unique_ptr<::metrics::MetricsLogUploader> |
| 247 CastMetricsServiceClient::CreateUploader( |
| 248 const std::string& server_url, |
| 249 const std::string& mime_type, |
| 250 const base::Callback<void(int)>& on_upload_complete) { |
245 return std::unique_ptr<::metrics::MetricsLogUploader>( | 251 return std::unique_ptr<::metrics::MetricsLogUploader>( |
246 new ::metrics::NetMetricsLogUploader(request_context_, uma_server_url, | 252 new ::metrics::NetMetricsLogUploader(request_context_, server_url, |
247 ::metrics::kDefaultMetricsMimeType, | 253 mime_type, on_upload_complete)); |
248 on_upload_complete)); | |
249 } | 254 } |
250 | 255 |
251 base::TimeDelta CastMetricsServiceClient::GetStandardUploadInterval() { | 256 base::TimeDelta CastMetricsServiceClient::GetStandardUploadInterval() { |
252 return base::TimeDelta::FromMinutes(kStandardUploadIntervalMinutes); | 257 return base::TimeDelta::FromMinutes(kStandardUploadIntervalMinutes); |
253 } | 258 } |
254 | 259 |
255 bool CastMetricsServiceClient::IsConsentGiven() { | 260 bool CastMetricsServiceClient::IsConsentGiven() { |
256 return pref_service_->GetBoolean(prefs::kOptInStats); | 261 return pref_service_->GetBoolean(prefs::kOptInStats); |
257 } | 262 } |
258 | 263 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 external_metrics_->StopAndDestroy(); | 404 external_metrics_->StopAndDestroy(); |
400 external_metrics_ = nullptr; | 405 external_metrics_ = nullptr; |
401 platform_metrics_->StopAndDestroy(); | 406 platform_metrics_->StopAndDestroy(); |
402 platform_metrics_ = nullptr; | 407 platform_metrics_ = nullptr; |
403 #endif // defined(OS_LINUX) | 408 #endif // defined(OS_LINUX) |
404 metrics_service_->Stop(); | 409 metrics_service_->Stop(); |
405 } | 410 } |
406 | 411 |
407 } // namespace metrics | 412 } // namespace metrics |
408 } // namespace chromecast | 413 } // namespace chromecast |
OLD | NEW |