OLD | NEW |
---|---|
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 Loading... | |
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); | |
grt (UTC plus 2)
2011/01/16 04:19:48
Wrapping and indentation.
amit
2011/01/16 07:54:28
Done.
| |
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); |
grt (UTC plus 2)
2011/01/16 04:19:48
Should this be indented 4 spaces from the open par
amit
2011/01/16 07:54:28
If it fits in one line. It does not and it will ma
| |
391 } | 392 } |
OLD | NEW |