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

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

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 helper methods used to schedule files for deletion 5 // This file defines helper methods used to schedule files for deletion
6 // on next reboot. The code here is heavily borrowed and simplified from 6 // on next reboot. The code here is heavily borrowed and simplified from
7 // http://code.google.com/p/omaha/source/browse/trunk/common/file.cc and 7 // http://code.google.com/p/omaha/source/browse/trunk/common/file.cc and
8 // http://code.google.com/p/omaha/source/browse/trunk/common/utils.cc 8 // http://code.google.com/p/omaha/source/browse/trunk/common/utils.cc
9 // 9 //
10 // This implementation really is not fast, so do not use it where that will 10 // This implementation really is not fast, so do not use it where that will
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 base::win::RegKey session_manager_key(HKEY_LOCAL_MACHINE, kSessionManagerKey, 372 base::win::RegKey session_manager_key(HKEY_LOCAL_MACHINE, kSessionManagerKey,
373 KEY_CREATE_SUB_KEY | KEY_SET_VALUE); 373 KEY_CREATE_SUB_KEY | KEY_SET_VALUE);
374 if (!session_manager_key.Handle()) { 374 if (!session_manager_key.Handle()) {
375 // Couldn't open / create the key. 375 // Couldn't open / create the key.
376 LOG(ERROR) << "Failed to open session manager key for writing."; 376 LOG(ERROR) << "Failed to open session manager key for writing.";
377 return false; 377 return false;
378 } 378 }
379 379
380 if (strings_to_keep.size() <= 1) { 380 if (strings_to_keep.size() <= 1) {
381 // We have only the trailing NULL string. Don't bother writing that. 381 // We have only the trailing NULL string. Don't bother writing that.
382 return session_manager_key.DeleteValue(kPendingFileRenameOps); 382 return (session_manager_key.DeleteValue(kPendingFileRenameOps) ==
383 ERROR_SUCCESS);
383 } 384 }
384 std::vector<char> buffer; 385 std::vector<char> buffer;
385 StringArrayToMultiSZBytes(strings_to_keep, &buffer); 386 StringArrayToMultiSZBytes(strings_to_keep, &buffer);
386 DCHECK(buffer.size() > 0); 387 DCHECK(buffer.size() > 0);
387 if (buffer.empty()) 388 if (buffer.empty())
388 return false; 389 return false;
389 return session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0], 390 return (session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0],
390 buffer.size(), REG_MULTI_SZ); 391 buffer.size(), REG_MULTI_SZ) == ERROR_SUCCESS);
391 } 392 }
OLDNEW
« no previous file with comments | « chrome/installer/util/create_reg_key_work_item_unittest.cc ('k') | chrome/installer/util/delete_reg_value_work_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698