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

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

Issue 8344004: base/win: Add documentation to RegKey::Read/Write functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indentation 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 // This file defines functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include "chrome/installer/util/shell_util.h" 10 #include "chrome/installer/util/shell_util.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 RegKey key(HKEY_LOCAL_MACHINE, _key_path.c_str(), KEY_READ); 245 RegKey key(HKEY_LOCAL_MACHINE, _key_path.c_str(), KEY_READ);
246 bool found = false; 246 bool found = false;
247 if (_is_string) { 247 if (_is_string) {
248 std::wstring read_value; 248 std::wstring read_value;
249 found = (key.ReadValue(_name.c_str(), &read_value) == ERROR_SUCCESS) && 249 found = (key.ReadValue(_name.c_str(), &read_value) == ERROR_SUCCESS) &&
250 (read_value.size() == _value.size()) && 250 (read_value.size() == _value.size()) &&
251 (std::equal(_value.begin(), _value.end(), read_value.begin(), 251 (std::equal(_value.begin(), _value.end(), read_value.begin(),
252 base::CaseInsensitiveCompare<wchar_t>())); 252 base::CaseInsensitiveCompare<wchar_t>()));
253 } else { 253 } else {
254 DWORD read_value; 254 DWORD read_value;
255 found = (key.ReadValueDW(_name.c_str(), &read_value) == ERROR_SUCCESS) && 255 found = (key.ReadValue(_name.c_str(), &read_value) == ERROR_SUCCESS) &&
256 (read_value == _int_value); 256 (read_value == _int_value);
257 } 257 }
258 key.Close(); 258 key.Close();
259 return found; 259 return found;
260 } 260 }
261 261
262 // Checks if the current registry entry exists in HKLM registry 262 // Checks if the current registry entry exists in HKLM registry
263 // (only the name). 263 // (only the name).
264 bool NameExistsInHKLM() const { 264 bool NameExistsInHKLM() const {
265 RegKey key(HKEY_LOCAL_MACHINE, _key_path.c_str(), KEY_READ); 265 RegKey key(HKEY_LOCAL_MACHINE, _key_path.c_str(), KEY_READ);
266 bool found = false; 266 bool found = false;
267 if (_is_string) { 267 if (_is_string) {
268 std::wstring read_value; 268 std::wstring read_value;
269 found = key.ReadValue(_name.c_str(), &read_value) == ERROR_SUCCESS; 269 found = key.ReadValue(_name.c_str(), &read_value) == ERROR_SUCCESS;
270 } else { 270 } else {
271 DWORD read_value; 271 DWORD read_value;
272 found = key.ReadValueDW(_name.c_str(), &read_value) == ERROR_SUCCESS; 272 found = key.ReadValue(_name.c_str(), &read_value) == ERROR_SUCCESS;
273 } 273 }
274 key.Close(); 274 key.Close();
275 return found; 275 return found;
276 } 276 }
277 277
278 private: 278 private:
279 DISALLOW_COPY_AND_ASSIGN(RegistryEntry); 279 DISALLOW_COPY_AND_ASSIGN(RegistryEntry);
280 280
281 // Create a object that represent default value of a key 281 // Create a object that represent default value of a key
282 RegistryEntry(const std::wstring& key_path, const std::wstring& value) 282 RegistryEntry(const std::wstring& key_path, const std::wstring& value)
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 chrome_exe.c_str(), // target 1013 chrome_exe.c_str(), // target
1014 shortcut.c_str(), // shortcut 1014 shortcut.c_str(), // shortcut
1015 chrome_path.c_str(), // working dir 1015 chrome_path.c_str(), // working dir
1016 NULL, // arguments 1016 NULL, // arguments
1017 description.c_str(), // description 1017 description.c_str(), // description
1018 chrome_exe.c_str(), // icon file 1018 chrome_exe.c_str(), // icon file
1019 icon_index, // icon index 1019 icon_index, // icon index
1020 dist->GetBrowserAppId().c_str()); // app id 1020 dist->GetBrowserAppId().c_str()); // app id
1021 } 1021 }
1022 } 1022 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698