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

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

Issue 8372073: Merge 8401001 r107836 into branch 912: Fix history importing by delaying DownloadManager creation. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/912/src/
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "content/browser/download/download_file.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
50 return download_manager_.get(); 50 return download_manager_.get();
51 } 51 }
52 52
53 std::string DownloadFile::DebugString() const { 53 std::string DownloadFile::DebugString() const {
54 return base::StringPrintf("{" 54 return base::StringPrintf("{"
55 " id_ = " "%d" 55 " id_ = " "%d"
56 " request_handle = %s" 56 " request_handle = %s"
57 " Base File = %s" 57 " Base File = %s"
58 " }", 58 " }",
59 id_, 59 id_.local(),
60 request_handle_.DebugString().c_str(), 60 request_handle_.DebugString().c_str(),
61 BaseFile::DebugString().c_str()); 61 BaseFile::DebugString().c_str());
62 } 62 }
63 63
64 void DownloadFile::AppendNumberToPath(FilePath* path, int number) { 64 void DownloadFile::AppendNumberToPath(FilePath* path, int number) {
65 *path = path->InsertBeforeExtensionASCII(StringPrintf(" (%d)", number)); 65 *path = path->InsertBeforeExtensionASCII(StringPrintf(" (%d)", number));
66 } 66 }
67 67
68 int DownloadFile::GetUniquePathNumber(const FilePath& path) { 68 int DownloadFile::GetUniquePathNumber(const FilePath& path) {
69 if (!file_util::PathExists(path)) 69 if (!file_util::PathExists(path))
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 new_path = FilePath(path); 103 new_path = FilePath(path);
104 AppendNumberToPath(&new_path, count); 104 AppendNumberToPath(&new_path, count);
105 105
106 if (!file_util::PathExists(new_path) && 106 if (!file_util::PathExists(new_path) &&
107 !file_util::PathExists(AppendSuffixToPath(new_path, suffix))) 107 !file_util::PathExists(AppendSuffixToPath(new_path, suffix)))
108 return count; 108 return count;
109 } 109 }
110 110
111 return -1; 111 return -1;
112 } 112 }
OLDNEW
« no previous file with comments | « content/browser/download/download_file.h ('k') | content/browser/download/download_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698