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

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

Issue 5354006: Fix a problem with the delete-after-reboot code. Removing pending renames of ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 *write_pointer = L'\0'; // Explicitly set the final null char. 238 *write_pointer = L'\0'; // Explicitly set the final null char.
239 DCHECK(++write_pointer == end_pointer); 239 DCHECK(++write_pointer == end_pointer);
240 } 240 }
241 241
242 std::wstring GetShortPathName(const wchar_t* path) { 242 std::wstring GetShortPathName(const wchar_t* path) {
243 std::wstring short_path; 243 std::wstring short_path;
244 DWORD length = GetShortPathName(path, WriteInto(&short_path, MAX_PATH), 244 DWORD length = GetShortPathName(path, WriteInto(&short_path, MAX_PATH),
245 MAX_PATH); 245 MAX_PATH);
246 DLOG_IF(WARNING, length == 0) << __FUNCTION__ << " gle=" << GetLastError(); 246 DLOG_IF(WARNING, length == 0) << __FUNCTION__ << " gle=" << GetLastError();
247 if (length == 0) {
248 // GetShortPathName fails if the path is no longer present. Instead of
249 // returning an empty string, just return the original string. This will
250 // serve for our purposes.
251 return path;
252 }
253
247 short_path.resize(length); 254 short_path.resize(length);
248 return short_path; 255 return short_path;
249 } 256 }
250 257
251 HRESULT GetPendingMovesValue( 258 HRESULT GetPendingMovesValue(
252 std::vector<PendingMove>* pending_moves) { 259 std::vector<PendingMove>* pending_moves) {
253 DCHECK(pending_moves); 260 DCHECK(pending_moves);
254 pending_moves->clear(); 261 pending_moves->clear();
255 262
256 // Get the current value of the key 263 // Get the current value of the key
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 return session_manager_key.DeleteValue(kPendingFileRenameOps); 380 return session_manager_key.DeleteValue(kPendingFileRenameOps);
374 } 381 }
375 std::vector<char> buffer; 382 std::vector<char> buffer;
376 StringArrayToMultiSZBytes(strings_to_keep, &buffer); 383 StringArrayToMultiSZBytes(strings_to_keep, &buffer);
377 DCHECK(buffer.size() > 0); 384 DCHECK(buffer.size() > 0);
378 if (buffer.empty()) 385 if (buffer.empty())
379 return false; 386 return false;
380 return session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0], 387 return session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0],
381 buffer.size(), REG_MULTI_SZ); 388 buffer.size(), REG_MULTI_SZ);
382 } 389 }
OLDNEW
« no previous file with comments | « chrome/installer/util/delete_after_reboot_helper.h ('k') | chrome/installer/util/delete_after_reboot_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698