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

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

Issue 1223983002: Move WriteInto to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « chrome/browser/signin/local_auth.cc ('k') | chrome/installer/util/install_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // We should never run off the end while in this loop. 241 // We should never run off the end while in this loop.
242 DCHECK(write_pointer < end_pointer); 242 DCHECK(write_pointer < end_pointer);
243 } 243 }
244 *write_pointer = L'\0'; // Explicitly set the final null char. 244 *write_pointer = L'\0'; // Explicitly set the final null char.
245 DCHECK(++write_pointer == end_pointer); 245 DCHECK(++write_pointer == end_pointer);
246 } 246 }
247 247
248 base::FilePath GetShortPathName(const base::FilePath& path) { 248 base::FilePath GetShortPathName(const base::FilePath& path) {
249 std::wstring short_path; 249 std::wstring short_path;
250 DWORD length = GetShortPathName(path.value().c_str(), 250 DWORD length = GetShortPathName(path.value().c_str(),
251 WriteInto(&short_path, MAX_PATH), 251 base::WriteInto(&short_path, MAX_PATH),
252 MAX_PATH); 252 MAX_PATH);
253 DWORD last_error = ::GetLastError(); 253 DWORD last_error = ::GetLastError();
254 DLOG_IF(WARNING, length == 0 && last_error != ERROR_PATH_NOT_FOUND) 254 DLOG_IF(WARNING, length == 0 && last_error != ERROR_PATH_NOT_FOUND)
255 << __FUNCTION__ << " gle=" << last_error; 255 << __FUNCTION__ << " gle=" << last_error;
256 if (length == 0) { 256 if (length == 0) {
257 // GetShortPathName fails if the path is no longer present. Instead of 257 // GetShortPathName fails if the path is no longer present. Instead of
258 // returning an empty string, just return the original string. This will 258 // returning an empty string, just return the original string. This will
259 // serve our purposes. 259 // serve our purposes.
260 return path; 260 return path;
261 } 261 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 ERROR_SUCCESS); 397 ERROR_SUCCESS);
398 } 398 }
399 std::vector<char> buffer; 399 std::vector<char> buffer;
400 StringArrayToMultiSZBytes(strings_to_keep, &buffer); 400 StringArrayToMultiSZBytes(strings_to_keep, &buffer);
401 DCHECK_GT(buffer.size(), 0U); 401 DCHECK_GT(buffer.size(), 0U);
402 if (buffer.empty()) 402 if (buffer.empty())
403 return false; 403 return false;
404 return (session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0], 404 return (session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0],
405 buffer.size(), REG_MULTI_SZ) == ERROR_SUCCESS); 405 buffer.size(), REG_MULTI_SZ) == ERROR_SUCCESS);
406 } 406 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/local_auth.cc ('k') | chrome/installer/util/install_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698