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

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: +member comments 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
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..e96b9b290f5446dd35ce9e6295fa439cce26b0c8 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -296,16 +296,42 @@ 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() {
+ scoped_ptr<metrics::ClientInfo> client_info(new metrics::ClientInfo);
Ilya Sherman 2014/07/11 04:45:41 nit: Can this be moved down to just above line 308
gab 2014/07/11 20:33:40 Done.
+
+ base::string16 client_id_16;
+ if (!ReadGoogleUpdateStrKey(google_update::kRegMetricsId, &client_id_16) ||
+ client_id_16.empty()) {
+ return scoped_ptr<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) {
+ 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.

Powered by Google App Engine
This is Rietveld 408576698