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

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: merge 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 8d833819b6293c952ffc0dd94df454d405edbc5e..9cb93ef6f5df745b0d08cc01ce24bccb92caec0c 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -298,16 +298,33 @@ bool GoogleUpdateSettings::SetCollectStatsConsentAtLevel(bool system_install,
return (result == ERROR_SUCCESS);
}
-bool GoogleUpdateSettings::RetrieveMetricsID(std::string* metrics_id) {
- std::wstring metrics_id_w;
- bool rv = ReadGoogleUpdateStrKey(google_update::kRegMetricsId, &metrics_id_w);
- *metrics_id = base::WideToUTF8(metrics_id_w);
- return rv;
+bool GoogleUpdateSettings::RetrieveMetricsInfo(std::string* metrics_id,
+ int64* installation_date) {
+ bool success = true;
+ if (metrics_id) {
Ilya Sherman 2014/07/08 01:10:21 Does it ever make sense to call this method with a
gab 2014/07/09 19:16:59 Not really, changed the model anyways as we want t
+ base::string16 metrics_id_16;
+ if (ReadGoogleUpdateStrKey(google_update::kRegMetricsId, &metrics_id_16))
+ *metrics_id = base::UTF16ToUTF8(metrics_id_16);
+ else
+ success = false;
+ }
+ if (installation_date) {
+ base::string16 installation_date_s;
Ilya Sherman 2014/07/08 01:10:21 Optional nit: I'd prefer "str" to just "s".
gab 2014/07/09 19:16:59 Done.
+ if (!ReadGoogleUpdateStrKey(google_update::kRegMetricsIdDate,
+ &installation_date_s) ||
+ !base::StringToInt64(installation_date_s, installation_date)) {
+ *installation_date = 0;
+ }
+ }
+ return success;
}
-bool GoogleUpdateSettings::SaveMetricsID(const std::string& metrics_id) {
- std::wstring metrics_id_w = base::UTF8ToWide(metrics_id);
- return WriteGoogleUpdateStrKey(google_update::kRegMetricsId, metrics_id_w);
+bool GoogleUpdateSettings::SaveMetricsInfo(const std::string& metrics_id,
+ int64 installation_date) {
+ return WriteGoogleUpdateStrKey(google_update::kRegMetricsId,
+ base::UTF8ToUTF16(metrics_id)) &&
+ WriteGoogleUpdateStrKey(google_update::kRegMetricsIdDate,
+ base::Int64ToString16(installation_date));
}
// EULA consent is only relevant for system-level installs.

Powered by Google App Engine
This is Rietveld 408576698