| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/android/download/chrome_download_manager_overwrite_info
bar_delegate.h" | 5 #include "chrome/browser/android/download/chrome_download_manager_overwrite_info
bar_delegate.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 ChromeDownloadManagerOverwriteInfoBarDelegate:: | 35 ChromeDownloadManagerOverwriteInfoBarDelegate:: |
| 36 ChromeDownloadManagerOverwriteInfoBarDelegate( | 36 ChromeDownloadManagerOverwriteInfoBarDelegate( |
| 37 const base::FilePath& suggested_download_path, | 37 const base::FilePath& suggested_download_path, |
| 38 const DownloadTargetDeterminerDelegate::FileSelectedCallback& | 38 const DownloadTargetDeterminerDelegate::FileSelectedCallback& |
| 39 file_selected_callback) | 39 file_selected_callback) |
| 40 : suggested_download_path_(suggested_download_path), | 40 : suggested_download_path_(suggested_download_path), |
| 41 file_selected_callback_(file_selected_callback) { | 41 file_selected_callback_(file_selected_callback) { |
| 42 } | 42 } |
| 43 | 43 |
| 44 std::string |
| 45 ChromeDownloadManagerOverwriteInfoBarDelegate::GetIdentifier() const { |
| 46 return "ChromeDownloadManagerOverwriteInfoBarDelegate"; |
| 47 } |
| 48 |
| 44 bool ChromeDownloadManagerOverwriteInfoBarDelegate::OverwriteExistingFile() { | 49 bool ChromeDownloadManagerOverwriteInfoBarDelegate::OverwriteExistingFile() { |
| 45 file_selected_callback_.Run(suggested_download_path_); | 50 file_selected_callback_.Run(suggested_download_path_); |
| 46 return true; | 51 return true; |
| 47 } | 52 } |
| 48 | 53 |
| 49 bool ChromeDownloadManagerOverwriteInfoBarDelegate::CreateNewFile() { | 54 bool ChromeDownloadManagerOverwriteInfoBarDelegate::CreateNewFile() { |
| 50 content::BrowserThread::PostTask( | 55 content::BrowserThread::PostTask( |
| 51 content::BrowserThread::FILE, FROM_HERE, | 56 content::BrowserThread::FILE, FROM_HERE, |
| 52 base::Bind( | 57 base::Bind( |
| 53 &ChromeDownloadManagerOverwriteInfoBarDelegate::CreateNewFileInternal, | 58 &ChromeDownloadManagerOverwriteInfoBarDelegate::CreateNewFileInternal, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 82 if (uniquifier > 0) { | 87 if (uniquifier > 0) { |
| 83 new_path = suggested_download_path.InsertBeforeExtensionASCII( | 88 new_path = suggested_download_path.InsertBeforeExtensionASCII( |
| 84 base::StringPrintf(" (%d)", uniquifier)); | 89 base::StringPrintf(" (%d)", uniquifier)); |
| 85 } | 90 } |
| 86 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 91 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 87 base::Bind(callback, new_path)); | 92 base::Bind(callback, new_path)); |
| 88 } | 93 } |
| 89 | 94 |
| 90 } // namespace android | 95 } // namespace android |
| 91 } // namespace chrome | 96 } // namespace chrome |
| OLD | NEW |