| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 // kMetricsIsNewClientID would be missing if either the device was just | 132 // kMetricsIsNewClientID would be missing if either the device was just |
| 133 // FDR'ed, or it is on pre-v1.2 build. | 133 // FDR'ed, or it is on pre-v1.2 build. |
| 134 if (!pref_service_->GetBoolean(prefs::kMetricsIsNewClientID)) { | 134 if (!pref_service_->GetBoolean(prefs::kMetricsIsNewClientID)) { |
| 135 // If the old client id exists, the device must be on pre-v1.2 build, | 135 // If the old client id exists, the device must be on pre-v1.2 build, |
| 136 // instead of just being FDR'ed. | 136 // instead of just being FDR'ed. |
| 137 if (!pref_service_->GetString(kMetricsOldClientID).empty()) { | 137 if (!pref_service_->GetString(kMetricsOldClientID).empty()) { |
| 138 // Force old client id to be regenerated. See b/9487011. | 138 // Force old client id to be regenerated. See b/9487011. |
| 139 client_info->client_id = base::GenerateGUID(); | 139 client_info->client_id = base::GenerateGUID(); |
| 140 pref_service_->SetBoolean(prefs::kMetricsIsNewClientID, true); | 140 pref_service_->SetBoolean(prefs::kMetricsIsNewClientID, true); |
| 141 return client_info.Pass(); | 141 return client_info; |
| 142 } | 142 } |
| 143 // else the device was just FDR'ed, pass through. | 143 // else the device was just FDR'ed, pass through. |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Use "forced" client ID if available. | 146 // Use "forced" client ID if available. |
| 147 if (!force_client_id_.empty() && base::IsValidGUID(force_client_id_)) { | 147 if (!force_client_id_.empty() && base::IsValidGUID(force_client_id_)) { |
| 148 client_info->client_id = force_client_id_; | 148 client_info->client_id = force_client_id_; |
| 149 return client_info.Pass(); | 149 return client_info; |
| 150 } | 150 } |
| 151 | 151 |
| 152 if (force_client_id_.empty()) { | 152 if (force_client_id_.empty()) { |
| 153 LOG(WARNING) << "Empty client id from platform," | 153 LOG(WARNING) << "Empty client id from platform," |
| 154 << " assuming this is the first boot up of a new device."; | 154 << " assuming this is the first boot up of a new device."; |
| 155 } else { | 155 } else { |
| 156 LOG(ERROR) << "Invalid client id from platform: " << force_client_id_ | 156 LOG(ERROR) << "Invalid client id from platform: " << force_client_id_ |
| 157 << " from platform."; | 157 << " from platform."; |
| 158 } | 158 } |
| 159 return scoped_ptr< ::metrics::ClientInfo>(); | 159 return scoped_ptr< ::metrics::ClientInfo>(); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 #endif // defined(OS_LINUX) | 408 #endif // defined(OS_LINUX) |
| 409 metrics_service_->Stop(); | 409 metrics_service_->Stop(); |
| 410 } | 410 } |
| 411 | 411 |
| 412 bool CastMetricsServiceClient::IsReportingEnabled() { | 412 bool CastMetricsServiceClient::IsReportingEnabled() { |
| 413 return pref_service_->GetBoolean(prefs::kOptInStats); | 413 return pref_service_->GetBoolean(prefs::kOptInStats); |
| 414 } | 414 } |
| 415 | 415 |
| 416 } // namespace metrics | 416 } // namespace metrics |
| 417 } // namespace chromecast | 417 } // namespace chromecast |
| OLD | NEW |