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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return suggested_download_path_.DirName().value(); | 66 return suggested_download_path_.DirName().value(); |
67 } | 67 } |
68 | 68 |
69 void ChromeDownloadManagerOverwriteInfoBarDelegate::InfoBarDismissed() { | 69 void ChromeDownloadManagerOverwriteInfoBarDelegate::InfoBarDismissed() { |
70 file_selected_callback_.Run(base::FilePath()); | 70 file_selected_callback_.Run(base::FilePath()); |
71 } | 71 } |
72 | 72 |
73 void ChromeDownloadManagerOverwriteInfoBarDelegate::CreateNewFileInternal( | 73 void ChromeDownloadManagerOverwriteInfoBarDelegate::CreateNewFileInternal( |
74 const base::FilePath& suggested_download_path, | 74 const base::FilePath& suggested_download_path, |
75 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { | 75 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { |
76 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 76 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); |
77 int uniquifier = base::GetUniquePathNumber(suggested_download_path, | 77 int uniquifier = base::GetUniquePathNumber(suggested_download_path, |
78 base::FilePath::StringType()); | 78 base::FilePath::StringType()); |
79 base::FilePath new_path = suggested_download_path; | 79 base::FilePath new_path = suggested_download_path; |
80 if (uniquifier > 0) { | 80 if (uniquifier > 0) { |
81 new_path = suggested_download_path.InsertBeforeExtensionASCII( | 81 new_path = suggested_download_path.InsertBeforeExtensionASCII( |
82 base::StringPrintf(" (%d)", uniquifier)); | 82 base::StringPrintf(" (%d)", uniquifier)); |
83 } | 83 } |
84 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 84 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
85 base::Bind(callback, new_path)); | 85 base::Bind(callback, new_path)); |
86 } | 86 } |
87 | 87 |
88 } // namespace android | 88 } // namespace android |
89 } // namespace chrome | 89 } // namespace chrome |
OLD | NEW |