| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 PrefService* pref_service, | 91 PrefService* pref_service, |
| 92 net::URLRequestContextGetter* request_context) { | 92 net::URLRequestContextGetter* request_context) { |
| 93 return make_scoped_ptr(new CastMetricsServiceClient( | 93 return make_scoped_ptr(new CastMetricsServiceClient( |
| 94 io_task_runner, pref_service, request_context)); | 94 io_task_runner, pref_service, request_context)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void CastMetricsServiceClient::RegisterPrefs(PrefRegistrySimple* registry) { | 97 void CastMetricsServiceClient::RegisterPrefs(PrefRegistrySimple* registry) { |
| 98 registry->RegisterStringPref(kMetricsOldClientID, std::string()); | 98 registry->RegisterStringPref(kMetricsOldClientID, std::string()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 ::metrics::MetricsService* CastMetricsServiceClient::GetMetricsService() { | |
| 102 return metrics_service_.get(); | |
| 103 } | |
| 104 | |
| 105 void CastMetricsServiceClient::SetMetricsClientId( | 101 void CastMetricsServiceClient::SetMetricsClientId( |
| 106 const std::string& client_id) { | 102 const std::string& client_id) { |
| 107 client_id_ = client_id; | 103 client_id_ = client_id; |
| 108 LOG(INFO) << "Metrics client ID set: " << client_id; | 104 LOG(INFO) << "Metrics client ID set: " << client_id; |
| 109 shell::CastBrowserProcess::GetInstance()->browser_client()-> | 105 shell::CastBrowserProcess::GetInstance()->browser_client()-> |
| 110 SetMetricsClientId(client_id); | 106 SetMetricsClientId(client_id); |
| 111 #if defined(OS_ANDROID) | 107 #if defined(OS_ANDROID) |
| 112 DumpstateWriter::AddDumpValue(kClientIdName, client_id); | 108 DumpstateWriter::AddDumpValue(kClientIdName, client_id); |
| 113 #endif | 109 #endif |
| 114 } | 110 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 #endif // defined(OS_LINUX) | 397 #endif // defined(OS_LINUX) |
| 402 metrics_service_->Stop(); | 398 metrics_service_->Stop(); |
| 403 } | 399 } |
| 404 | 400 |
| 405 bool CastMetricsServiceClient::IsReportingEnabled() { | 401 bool CastMetricsServiceClient::IsReportingEnabled() { |
| 406 return pref_service_->GetBoolean(prefs::kOptInStats); | 402 return pref_service_->GetBoolean(prefs::kOptInStats); |
| 407 } | 403 } |
| 408 | 404 |
| 409 } // namespace metrics | 405 } // namespace metrics |
| 410 } // namespace chromecast | 406 } // namespace chromecast |
| OLD | NEW |