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

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

Issue 189333004: Move more file_util functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return file_.AppendDataToFile(data, data_len); 103 return file_.AppendDataToFile(data, data_len);
104 } 104 }
105 105
106 void DownloadFileImpl::RenameAndUniquify( 106 void DownloadFileImpl::RenameAndUniquify(
107 const base::FilePath& full_path, 107 const base::FilePath& full_path,
108 const RenameCompletionCallback& callback) { 108 const RenameCompletionCallback& callback) {
109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
110 110
111 base::FilePath new_path(full_path); 111 base::FilePath new_path(full_path);
112 112
113 int uniquifier = file_util::GetUniquePathNumber( 113 int uniquifier = base::GetUniquePathNumber(
114 new_path, base::FilePath::StringType()); 114 new_path, base::FilePath::StringType());
115 if (uniquifier > 0) { 115 if (uniquifier > 0) {
116 new_path = new_path.InsertBeforeExtensionASCII( 116 new_path = new_path.InsertBeforeExtensionASCII(
117 base::StringPrintf(" (%d)", uniquifier)); 117 base::StringPrintf(" (%d)", uniquifier));
118 } 118 }
119 119
120 DownloadInterruptReason reason = file_.Rename(new_path); 120 DownloadInterruptReason reason = file_.Rename(new_path);
121 if (reason != DOWNLOAD_INTERRUPT_REASON_NONE) { 121 if (reason != DOWNLOAD_INTERRUPT_REASON_NONE) {
122 // Make sure our information is updated, since we're about to 122 // Make sure our information is updated, since we're about to
123 // error out. 123 // error out.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 observer_, file_.bytes_so_far(), CurrentSpeed(), 312 observer_, file_.bytes_so_far(), CurrentSpeed(),
313 GetHashState())); 313 GetHashState()));
314 } 314 }
315 315
316 // static 316 // static
317 int DownloadFile::GetNumberOfDownloadFiles() { 317 int DownloadFile::GetNumberOfDownloadFiles() {
318 return number_active_objects_; 318 return number_active_objects_;
319 } 319 }
320 320
321 } // namespace content 321 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/web_applications/web_app_win.cc ('k') | content/browser/indexed_db/indexed_db_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698