| 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 |
| 101 void CastMetricsServiceClient::SetMetricsClientId( | 105 void CastMetricsServiceClient::SetMetricsClientId( |
| 102 const std::string& client_id) { | 106 const std::string& client_id) { |
| 103 client_id_ = client_id; | 107 client_id_ = client_id; |
| 104 LOG(INFO) << "Metrics client ID set: " << client_id; | 108 LOG(INFO) << "Metrics client ID set: " << client_id; |
| 105 shell::CastBrowserProcess::GetInstance()->browser_client()-> | 109 shell::CastBrowserProcess::GetInstance()->browser_client()-> |
| 106 SetMetricsClientId(client_id); | 110 SetMetricsClientId(client_id); |
| 107 #if defined(OS_ANDROID) | 111 #if defined(OS_ANDROID) |
| 108 DumpstateWriter::AddDumpValue(kClientIdName, client_id); | 112 DumpstateWriter::AddDumpValue(kClientIdName, client_id); |
| 109 #endif | 113 #endif |
| 110 } | 114 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 #endif // defined(OS_LINUX) | 401 #endif // defined(OS_LINUX) |
| 398 metrics_service_->Stop(); | 402 metrics_service_->Stop(); |
| 399 } | 403 } |
| 400 | 404 |
| 401 bool CastMetricsServiceClient::IsReportingEnabled() { | 405 bool CastMetricsServiceClient::IsReportingEnabled() { |
| 402 return pref_service_->GetBoolean(prefs::kOptInStats); | 406 return pref_service_->GetBoolean(prefs::kOptInStats); |
| 403 } | 407 } |
| 404 | 408 |
| 405 } // namespace metrics | 409 } // namespace metrics |
| 406 } // namespace chromecast | 410 } // namespace chromecast |
| OLD | NEW |