| OLD | NEW |
| 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/drag_download_util.h" | 5 #include "content/browser/download/drag_download_util.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 if (url) | 53 if (url) |
| 54 *url = parsed_url; | 54 *url = parsed_url; |
| 55 | 55 |
| 56 return true; | 56 return true; |
| 57 } | 57 } |
| 58 | 58 |
| 59 FileStream* CreateFileStreamForDrop(FilePath* file_path) { | 59 FileStream* CreateFileStreamForDrop(FilePath* file_path) { |
| 60 DCHECK(file_path && !file_path->empty()); | 60 DCHECK(file_path && !file_path->empty()); |
| 61 | 61 |
| 62 scoped_ptr<FileStream> file_stream(new FileStream); | 62 scoped_ptr<FileStream> file_stream(new FileStream(NULL)); |
| 63 const int kMaxSeq = 99; | 63 const int kMaxSeq = 99; |
| 64 for (int seq = 0; seq <= kMaxSeq; seq++) { | 64 for (int seq = 0; seq <= kMaxSeq; seq++) { |
| 65 FilePath new_file_path; | 65 FilePath new_file_path; |
| 66 if (seq == 0) { | 66 if (seq == 0) { |
| 67 new_file_path = *file_path; | 67 new_file_path = *file_path; |
| 68 } else { | 68 } else { |
| 69 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
| 70 string16 suffix = ASCIIToUTF16("-") + base::IntToString16(seq); | 70 string16 suffix = ASCIIToUTF16("-") + base::IntToString16(seq); |
| 71 #else | 71 #else |
| 72 std::string suffix = std::string("-") + base::IntToString(seq); | 72 std::string suffix = std::string("-") + base::IntToString(seq); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 base::Bind(&PromiseFileFinalizer::Cleanup, this)); | 108 base::Bind(&PromiseFileFinalizer::Cleanup, this)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void PromiseFileFinalizer::OnDownloadAborted() { | 111 void PromiseFileFinalizer::OnDownloadAborted() { |
| 112 BrowserThread::PostTask( | 112 BrowserThread::PostTask( |
| 113 BrowserThread::UI, FROM_HERE, | 113 BrowserThread::UI, FROM_HERE, |
| 114 base::Bind(&PromiseFileFinalizer::Cleanup, this)); | 114 base::Bind(&PromiseFileFinalizer::Cleanup, this)); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace drag_download_util | 117 } // namespace drag_download_util |
| OLD | NEW |