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

Unified Diff: chrome/installer/util/google_update_settings.cc

Issue 372473004: Retrieve client_id from GoogleUpdateSettings when its missing from Local State. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits:grt Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/google_update_settings.h ('k') | components/metrics.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/google_update_settings.cc
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index 4d53ecac94977db4553432fea4117b2a31286843..3c4cba6662885c745cbf166ca1fa6813dc6b0e6d 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -296,16 +296,43 @@ bool GoogleUpdateSettings::SetCollectStatsConsentAtLevel(bool system_install,
return (result == ERROR_SUCCESS);
}
-bool GoogleUpdateSettings::LoadMetricsClientId(std::string* metrics_id) {
- base::string16 metrics_id16;
- bool rv = ReadGoogleUpdateStrKey(google_update::kRegMetricsId, &metrics_id16);
- *metrics_id = base::UTF16ToUTF8(metrics_id16);
- return rv;
+scoped_ptr<metrics::ClientInfo> GoogleUpdateSettings::LoadMetricsClientInfo() {
+ base::string16 client_id_16;
+ if (!ReadGoogleUpdateStrKey(google_update::kRegMetricsId, &client_id_16) ||
+ client_id_16.empty()) {
+ return scoped_ptr<metrics::ClientInfo>();
+ }
+
+ scoped_ptr<metrics::ClientInfo> client_info(new metrics::ClientInfo);
+ client_info->client_id = base::UTF16ToUTF8(client_id_16);
+
+ base::string16 installation_date_str;
+ if (ReadGoogleUpdateStrKey(google_update::kRegMetricsIdInstallDate,
+ &installation_date_str)) {
+ base::StringToInt64(installation_date_str, &client_info->installation_date);
+ }
+
+ base::string16 reporting_enbaled_date_date_str;
+ if (ReadGoogleUpdateStrKey(google_update::kRegMetricsIdEnabledDate,
+ &reporting_enbaled_date_date_str)) {
+ base::StringToInt64(reporting_enbaled_date_date_str,
+ &client_info->reporting_enabled_date);
+ }
+
+ return client_info.Pass();
}
-bool GoogleUpdateSettings::StoreMetricsClientId(const std::string& metrics_id) {
- base::string16 metrics_id16 = base::UTF8ToUTF16(metrics_id);
- return WriteGoogleUpdateStrKey(google_update::kRegMetricsId, metrics_id16);
+void GoogleUpdateSettings::StoreMetricsClientInfo(
+ const metrics::ClientInfo& client_info) {
+ // Attempt a best-effort at backing |client_info| in the registry (but don't
+ // handle/report failures).
+ WriteGoogleUpdateStrKey(google_update::kRegMetricsId,
+ base::UTF8ToUTF16(client_info.client_id));
+ WriteGoogleUpdateStrKey(google_update::kRegMetricsIdInstallDate,
+ base::Int64ToString16(client_info.installation_date));
+ WriteGoogleUpdateStrKey(
+ google_update::kRegMetricsIdEnabledDate,
+ base::Int64ToString16(client_info.reporting_enabled_date));
}
// EULA consent is only relevant for system-level installs.
« no previous file with comments | « chrome/installer/util/google_update_settings.h ('k') | components/metrics.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698