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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 CastMetricsServiceClient::CastMetricsServiceClient( | 171 CastMetricsServiceClient::CastMetricsServiceClient( |
172 base::TaskRunner* io_task_runner, | 172 base::TaskRunner* io_task_runner, |
173 PrefService* pref_service, | 173 PrefService* pref_service, |
174 net::URLRequestContextGetter* request_context) | 174 net::URLRequestContextGetter* request_context) |
175 : io_task_runner_(io_task_runner), | 175 : io_task_runner_(io_task_runner), |
176 pref_service_(pref_service), | 176 pref_service_(pref_service), |
177 cast_service_(NULL), | 177 cast_service_(NULL), |
| 178 #if !defined(OS_ANDROID) |
178 external_metrics_(NULL), | 179 external_metrics_(NULL), |
| 180 #endif // !defined(OS_ANDROID) |
179 metrics_service_loop_(base::MessageLoopProxy::current()), | 181 metrics_service_loop_(base::MessageLoopProxy::current()), |
180 request_context_(request_context) { | 182 request_context_(request_context) { |
181 } | 183 } |
182 | 184 |
183 CastMetricsServiceClient::~CastMetricsServiceClient() { | 185 CastMetricsServiceClient::~CastMetricsServiceClient() { |
| 186 #if !defined(OS_ANDROID) |
184 DCHECK(!external_metrics_); | 187 DCHECK(!external_metrics_); |
| 188 #endif // !defined(OS_ANDROID) |
185 } | 189 } |
186 | 190 |
187 void CastMetricsServiceClient::Initialize(CastService* cast_service) { | 191 void CastMetricsServiceClient::Initialize(CastService* cast_service) { |
188 DCHECK(cast_service); | 192 DCHECK(cast_service); |
189 DCHECK(!cast_service_); | 193 DCHECK(!cast_service_); |
190 cast_service_ = cast_service; | 194 cast_service_ = cast_service; |
191 | 195 |
192 metrics_state_manager_ = ::metrics::MetricsStateManager::Create( | 196 metrics_state_manager_ = ::metrics::MetricsStateManager::Create( |
193 pref_service_, | 197 pref_service_, |
194 base::Bind(&CastMetricsServiceClient::IsReportingEnabled, | 198 base::Bind(&CastMetricsServiceClient::IsReportingEnabled, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 #endif // defined(OS_LINUX) | 264 #endif // defined(OS_LINUX) |
261 metrics_service_->Stop(); | 265 metrics_service_->Stop(); |
262 } | 266 } |
263 | 267 |
264 bool CastMetricsServiceClient::IsReportingEnabled() { | 268 bool CastMetricsServiceClient::IsReportingEnabled() { |
265 return PlatformIsReportingEnabled(cast_service_); | 269 return PlatformIsReportingEnabled(cast_service_); |
266 } | 270 } |
267 | 271 |
268 } // namespace metrics | 272 } // namespace metrics |
269 } // namespace chromecast | 273 } // namespace chromecast |
OLD | NEW |