OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/installer/util/google_update_settings.h" | 5 #include "chrome/installer/util/google_update_settings.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 << google_update::kRegUsageStatsField << "; result: " << result; | 304 << google_update::kRegUsageStatsField << "; result: " << result; |
305 } else { | 305 } else { |
306 result = key.WriteValue(google_update::kRegUsageStatsField, value); | 306 result = key.WriteValue(google_update::kRegUsageStatsField, value); |
307 LOG_IF(ERROR, result != ERROR_SUCCESS) << "Failed setting " | 307 LOG_IF(ERROR, result != ERROR_SUCCESS) << "Failed setting " |
308 << google_update::kRegUsageStatsField << " in key " << reg_path | 308 << google_update::kRegUsageStatsField << " in key " << reg_path |
309 << "; result: " << result; | 309 << "; result: " << result; |
310 } | 310 } |
311 return (result == ERROR_SUCCESS); | 311 return (result == ERROR_SUCCESS); |
312 } | 312 } |
313 | 313 |
314 scoped_ptr<metrics::ClientInfo> GoogleUpdateSettings::LoadMetricsClientInfo() { | 314 std::unique_ptr<metrics::ClientInfo> |
| 315 GoogleUpdateSettings::LoadMetricsClientInfo() { |
315 base::string16 client_id_16; | 316 base::string16 client_id_16; |
316 if (!ReadGoogleUpdateStrKey(google_update::kRegMetricsId, &client_id_16) || | 317 if (!ReadGoogleUpdateStrKey(google_update::kRegMetricsId, &client_id_16) || |
317 client_id_16.empty()) { | 318 client_id_16.empty()) { |
318 return scoped_ptr<metrics::ClientInfo>(); | 319 return std::unique_ptr<metrics::ClientInfo>(); |
319 } | 320 } |
320 | 321 |
321 scoped_ptr<metrics::ClientInfo> client_info(new metrics::ClientInfo); | 322 std::unique_ptr<metrics::ClientInfo> client_info(new metrics::ClientInfo); |
322 client_info->client_id = base::UTF16ToUTF8(client_id_16); | 323 client_info->client_id = base::UTF16ToUTF8(client_id_16); |
323 | 324 |
324 base::string16 installation_date_str; | 325 base::string16 installation_date_str; |
325 if (ReadGoogleUpdateStrKey(google_update::kRegMetricsIdInstallDate, | 326 if (ReadGoogleUpdateStrKey(google_update::kRegMetricsIdInstallDate, |
326 &installation_date_str)) { | 327 &installation_date_str)) { |
327 base::StringToInt64(installation_date_str, &client_info->installation_date); | 328 base::StringToInt64(installation_date_str, &client_info->installation_date); |
328 } | 329 } |
329 | 330 |
330 base::string16 reporting_enbaled_date_date_str; | 331 base::string16 reporting_enbaled_date_date_str; |
331 if (ReadGoogleUpdateStrKey(google_update::kRegMetricsIdEnabledDate, | 332 if (ReadGoogleUpdateStrKey(google_update::kRegMetricsIdEnabledDate, |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 } | 999 } |
999 | 1000 |
1000 // If the key or value was not present, return the empty string. | 1001 // If the key or value was not present, return the empty string. |
1001 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { | 1002 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { |
1002 experiment_labels->clear(); | 1003 experiment_labels->clear(); |
1003 return true; | 1004 return true; |
1004 } | 1005 } |
1005 | 1006 |
1006 return result == ERROR_SUCCESS; | 1007 return result == ERROR_SUCCESS; |
1007 } | 1008 } |
OLD | NEW |