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

Side by Side Diff: content/browser/download/download_file_impl.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/browser/download/download_file_impl.h" 5 #include "content/browser/download/download_file_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return file_.AppendDataToFile(data, data_len); 101 return file_.AppendDataToFile(data, data_len);
102 } 102 }
103 103
104 void DownloadFileImpl::RenameAndUniquify( 104 void DownloadFileImpl::RenameAndUniquify(
105 const base::FilePath& full_path, 105 const base::FilePath& full_path,
106 const RenameCompletionCallback& callback) { 106 const RenameCompletionCallback& callback) {
107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
108 108
109 base::FilePath new_path(full_path); 109 base::FilePath new_path(full_path);
110 110
111 int uniquifier = 111 int uniquifier = file_util::GetUniquePathNumber(
112 file_util::GetUniquePathNumber(new_path, FILE_PATH_LITERAL("")); 112 new_path, base::FilePath::StringType());
113 if (uniquifier > 0) { 113 if (uniquifier > 0) {
114 new_path = new_path.InsertBeforeExtensionASCII( 114 new_path = new_path.InsertBeforeExtensionASCII(
115 base::StringPrintf(" (%d)", uniquifier)); 115 base::StringPrintf(" (%d)", uniquifier));
116 } 116 }
117 117
118 DownloadInterruptReason reason = file_.Rename(new_path); 118 DownloadInterruptReason reason = file_.Rename(new_path);
119 if (reason != DOWNLOAD_INTERRUPT_REASON_NONE) { 119 if (reason != DOWNLOAD_INTERRUPT_REASON_NONE) {
120 // Make sure our information is updated, since we're about to 120 // Make sure our information is updated, since we're about to
121 // error out. 121 // error out.
122 SendUpdate(); 122 SendUpdate();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 base::Bind(&DownloadDestinationObserver::DestinationUpdate, 308 base::Bind(&DownloadDestinationObserver::DestinationUpdate,
309 observer_, BytesSoFar(), CurrentSpeed(), GetHashState())); 309 observer_, BytesSoFar(), CurrentSpeed(), GetHashState()));
310 } 310 }
311 311
312 // static 312 // static
313 int DownloadFile::GetNumberOfDownloadFiles() { 313 int DownloadFile::GetNumberOfDownloadFiles() {
314 return number_active_objects_; 314 return number_active_objects_;
315 } 315 }
316 316
317 } // namespace content 317 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/base_file_unittest.cc ('k') | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698