| 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> |
| 8 |
| 7 #include <algorithm> | 9 #include <algorithm> |
| 8 #include <limits> | 10 #include <limits> |
| 9 | 11 |
| 10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 13 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 14 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 15 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } | 384 } |
| 383 } | 385 } |
| 384 | 386 |
| 385 return succeeded; | 387 return succeeded; |
| 386 } | 388 } |
| 387 | 389 |
| 388 int GoogleUpdateSettings::GetLastRunTime() { | 390 int GoogleUpdateSettings::GetLastRunTime() { |
| 389 base::string16 time_s; | 391 base::string16 time_s; |
| 390 if (!ReadGoogleUpdateStrKey(google_update::kRegLastRunTimeField, &time_s)) | 392 if (!ReadGoogleUpdateStrKey(google_update::kRegLastRunTimeField, &time_s)) |
| 391 return -1; | 393 return -1; |
| 392 int64 time_i; | 394 int64_t time_i; |
| 393 if (!base::StringToInt64(time_s, &time_i)) | 395 if (!base::StringToInt64(time_s, &time_i)) |
| 394 return -1; | 396 return -1; |
| 395 base::TimeDelta td = | 397 base::TimeDelta td = |
| 396 base::Time::NowFromSystemTime() - base::Time::FromInternalValue(time_i); | 398 base::Time::NowFromSystemTime() - base::Time::FromInternalValue(time_i); |
| 397 return td.InDays(); | 399 return td.InDays(); |
| 398 } | 400 } |
| 399 | 401 |
| 400 bool GoogleUpdateSettings::SetLastRunTime() { | 402 bool GoogleUpdateSettings::SetLastRunTime() { |
| 401 int64 time = base::Time::NowFromSystemTime().ToInternalValue(); | 403 int64_t time = base::Time::NowFromSystemTime().ToInternalValue(); |
| 402 return WriteGoogleUpdateStrKey(google_update::kRegLastRunTimeField, | 404 return WriteGoogleUpdateStrKey(google_update::kRegLastRunTimeField, |
| 403 base::Int64ToString16(time)); | 405 base::Int64ToString16(time)); |
| 404 } | 406 } |
| 405 | 407 |
| 406 bool GoogleUpdateSettings::RemoveLastRunTime() { | 408 bool GoogleUpdateSettings::RemoveLastRunTime() { |
| 407 return RemoveGoogleUpdateStrKey(google_update::kRegLastRunTimeField); | 409 return RemoveGoogleUpdateStrKey(google_update::kRegLastRunTimeField); |
| 408 } | 410 } |
| 409 | 411 |
| 410 bool GoogleUpdateSettings::GetBrowser(base::string16* browser) { | 412 bool GoogleUpdateSettings::GetBrowser(base::string16* browser) { |
| 411 return ReadGoogleUpdateStrKey(google_update::kRegBrowserField, browser); | 413 return ReadGoogleUpdateStrKey(google_update::kRegBrowserField, browser); |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 } | 971 } |
| 970 | 972 |
| 971 // If the key or value was not present, return the empty string. | 973 // If the key or value was not present, return the empty string. |
| 972 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { | 974 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { |
| 973 experiment_labels->clear(); | 975 experiment_labels->clear(); |
| 974 return true; | 976 return true; |
| 975 } | 977 } |
| 976 | 978 |
| 977 return result == ERROR_SUCCESS; | 979 return result == ERROR_SUCCESS; |
| 978 } | 980 } |
| OLD | NEW |