Chromium Code Reviews| 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..115cd0d7eb88187fb1e0950d32b80efc32285f1f 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() { |
| + |
|
Alexei Svitkine (slow)
2014/07/15 12:53:25
Nit: Remove empty line.
gab
2014/07/15 20:50:05
Done.
|
| + 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)) { |
|
Alexei Svitkine (slow)
2014/07/15 12:53:25
Nit: Align.
gab
2014/07/15 20:50:05
Done.
|
| + 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)) { |
|
Alexei Svitkine (slow)
2014/07/15 12:53:25
Nit: Align.
gab
2014/07/15 20:50:05
Done.
|
| + 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, |
|
Alexei Svitkine (slow)
2014/07/15 12:53:25
Is it okay to not check for errors for these? If s
gab
2014/07/15 20:50:06
The method used to return bool, but no callers wou
|
| + 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. |