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

Side by Side Diff: chrome/installer/util/google_update_settings.cc

Issue 8337006: base/win: small improvement to RegKey API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apply grt comments Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 std::wstring value; 95 std::wstring value;
96 if (key.ReadValue(name, &value) != ERROR_SUCCESS) 96 if (key.ReadValue(name, &value) != ERROR_SUCCESS)
97 return false; 97 return false;
98 return (key.WriteValue(name, L"") == ERROR_SUCCESS); 98 return (key.WriteValue(name, L"") == ERROR_SUCCESS);
99 } 99 }
100 100
101 bool RemoveGoogleUpdateStrKey(const wchar_t* const name) { 101 bool RemoveGoogleUpdateStrKey(const wchar_t* const name) {
102 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 102 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
103 std::wstring reg_path = dist->GetStateKey(); 103 std::wstring reg_path = dist->GetStateKey();
104 RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE); 104 RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE);
105 if (!key.ValueExists(name)) 105 if (!key.HasValue(name))
106 return true; 106 return true;
107 return (key.DeleteValue(name) == ERROR_SUCCESS); 107 return (key.DeleteValue(name) == ERROR_SUCCESS);
108 } 108 }
109 109
110 EulaSearchResult HasEULASetting(HKEY root, const std::wstring& state_key, 110 EulaSearchResult HasEULASetting(HKEY root, const std::wstring& state_key,
111 bool setting) { 111 bool setting) {
112 RegKey key; 112 RegKey key;
113 DWORD previous_value = setting ? 1 : 0; 113 DWORD previous_value = setting ? 1 : 0;
114 if (key.Open(root, state_key.c_str(), KEY_QUERY_VALUE) != ERROR_SUCCESS) 114 if (key.Open(root, state_key.c_str(), KEY_QUERY_VALUE) != ERROR_SUCCESS)
115 return NO_SETTING; 115 return NO_SETTING;
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 GetUpdatePolicyFromDword(value, &update_policy); 519 GetUpdatePolicyFromDword(value, &update_policy);
520 } 520 }
521 } 521 }
522 #endif // defined(GOOGLE_CHROME_BUILD) 522 #endif // defined(GOOGLE_CHROME_BUILD)
523 523
524 if (is_overridden != NULL) 524 if (is_overridden != NULL)
525 *is_overridden = found_override; 525 *is_overridden = found_override;
526 526
527 return update_policy; 527 return update_policy;
528 } 528 }
OLDNEW
« no previous file with comments | « chrome/installer/util/delete_reg_value_work_item_unittest.cc ('k') | chrome/installer/util/install_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698