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

Unified Diff: components/update_client/updater_state_win.cc

Issue 2863993003: Refactor windows dependency out of UpdaterState class. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « components/update_client/updater_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/updater_state_win.cc
diff --git a/components/update_client/updater_state_win.cc b/components/update_client/updater_state_win.cc
index ae1cecbcf9be3c5e0fde47131c15876f25b3f617..a1660132822363c6d9bdd3f1ee5f89a1aa40a119 100644
--- a/components/update_client/updater_state_win.cc
+++ b/components/update_client/updater_state_win.cc
@@ -42,6 +42,21 @@ const wchar_t kRegValueGoogleUpdatePv[] = L"pv";
const wchar_t kRegValueLastStartedAU[] = L"LastStartedAU";
const wchar_t kRegValueLastChecked[] = L"LastChecked";
+base::Time GetUpdaterTimeValue(bool is_machine, const wchar_t* value_name) {
+ const HKEY root_key = is_machine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ base::win::RegKey update_key;
+
+ if (update_key.Open(root_key, kRegPathGoogleUpdate,
+ KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) {
+ DWORD value(0);
+ if (update_key.ReadValueDW(value_name, &value) == ERROR_SUCCESS) {
+ return base::Time::FromTimeT(value);
+ }
+ }
+
+ return base::Time();
+}
+
} // namespace
std::string UpdaterState::GetUpdaterName() {
@@ -70,22 +85,6 @@ base::Time UpdaterState::GetUpdaterLastChecked(bool is_machine) {
return GetUpdaterTimeValue(is_machine, kRegValueLastChecked);
}
-base::Time UpdaterState::GetUpdaterTimeValue(bool is_machine,
- const wchar_t* value_name) {
- const HKEY root_key = is_machine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
- base::win::RegKey update_key;
-
- if (update_key.Open(root_key, kRegPathGoogleUpdate,
- KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) {
- DWORD value(0);
- if (update_key.ReadValueDW(value_name, &value) == ERROR_SUCCESS) {
- return base::Time::FromTimeT(value);
- }
- }
-
- return base::Time();
-}
-
bool UpdaterState::IsAutoupdateCheckEnabled() {
// Check the auto-update check period override. If it is 0 or exceeds the
// maximum timeout, then for all intents and purposes auto updates are
« no previous file with comments | « components/update_client/updater_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698