Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chromecast/browser/metrics/cast_metrics_service_client.cc

Issue 1161133004: Delete code corresponding to old UMA prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore enable date pref set and update Chromecast code. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/metrics/metrics_pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // backup client_id or reset to empty. 63 // backup client_id or reset to empty.
64 SetMetricsClientId(client_id); 64 SetMetricsClientId(client_id);
65 } 65 }
66 66
67 scoped_ptr< ::metrics::ClientInfo> CastMetricsServiceClient::LoadClientInfo() { 67 scoped_ptr< ::metrics::ClientInfo> CastMetricsServiceClient::LoadClientInfo() {
68 scoped_ptr< ::metrics::ClientInfo> client_info(new ::metrics::ClientInfo); 68 scoped_ptr< ::metrics::ClientInfo> client_info(new ::metrics::ClientInfo);
69 69
70 // kMetricsIsNewClientID would be missing if either the device was just 70 // kMetricsIsNewClientID would be missing if either the device was just
71 // FDR'ed, or it is on pre-v1.2 build. 71 // FDR'ed, or it is on pre-v1.2 build.
72 if (!pref_service_->GetBoolean(prefs::kMetricsIsNewClientID)) { 72 if (!pref_service_->GetBoolean(prefs::kMetricsIsNewClientID)) {
73 // If the old client id exists, the device must be on pre-v1.2 build, 73 client_info->client_id = base::GenerateGUID();
74 // instead of just being FDR'ed. 74 pref_service_->SetBoolean(prefs::kMetricsIsNewClientID, true);
75 if (!pref_service_->GetString(::metrics::prefs::kMetricsOldClientID) 75 return client_info.Pass();
gfhuang 2015/05/29 19:54:03 can you keep this logic and just make a local "co
Alexei Svitkine (slow) 2015/05/29 20:13:23 Done.
76 .empty()) {
77 // Force old client id to be regenerated. See b/9487011.
78 client_info->client_id = base::GenerateGUID();
79 pref_service_->SetBoolean(prefs::kMetricsIsNewClientID, true);
80 return client_info.Pass();
81 }
82 // else the device was just FDR'ed, pass through.
83 } 76 }
84 77
85 const std::string client_id(GetPlatformClientID(cast_service_)); 78 const std::string client_id(GetPlatformClientID(cast_service_));
86 if (!client_id.empty() && base::IsValidGUID(client_id)) { 79 if (!client_id.empty() && base::IsValidGUID(client_id)) {
87 client_info->client_id = client_id; 80 client_info->client_id = client_id;
88 return client_info.Pass(); 81 return client_info.Pass();
89 } else { 82 } else {
90 if (client_id.empty()) { 83 if (client_id.empty()) {
91 LOG(WARNING) << "Empty client id from platform," 84 LOG(WARNING) << "Empty client id from platform,"
92 << " assuming this is the first boot up of a new device."; 85 << " assuming this is the first boot up of a new device.";
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 #endif // defined(OS_LINUX) 266 #endif // defined(OS_LINUX)
274 metrics_service_->Stop(); 267 metrics_service_->Stop();
275 } 268 }
276 269
277 bool CastMetricsServiceClient::IsReportingEnabled() { 270 bool CastMetricsServiceClient::IsReportingEnabled() {
278 return PlatformIsReportingEnabled(cast_service_); 271 return PlatformIsReportingEnabled(cast_service_);
279 } 272 }
280 273
281 } // namespace metrics 274 } // namespace metrics
282 } // namespace chromecast 275 } // namespace chromecast
OLDNEW
« no previous file with comments | « no previous file | components/metrics/metrics_pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698