| 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/android_download_manager_overwrite_inf
obar_delegate.h" | 5 #include "chrome/browser/android/download/android_download_manager_overwrite_inf
obar_delegate.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 jobject chrome_download_delegate, | 46 jobject chrome_download_delegate, |
| 47 jobject download_info) | 47 jobject download_info) |
| 48 : file_name_(file_name), | 48 : file_name_(file_name), |
| 49 dir_name_(dir_name), | 49 dir_name_(dir_name), |
| 50 dir_full_path_(dir_full_path) { | 50 dir_full_path_(dir_full_path) { |
| 51 JNIEnv* env = base::android::AttachCurrentThread(); | 51 JNIEnv* env = base::android::AttachCurrentThread(); |
| 52 chrome_download_delegate_.Reset(env, chrome_download_delegate); | 52 chrome_download_delegate_.Reset(env, chrome_download_delegate); |
| 53 download_info_.Reset(env, download_info); | 53 download_info_.Reset(env, download_info); |
| 54 } | 54 } |
| 55 | 55 |
| 56 std::string |
| 57 AndroidDownloadManagerOverwriteInfoBarDelegate::GetIdentifier() const { |
| 58 return "AndroidDownloadManagerOverwriteInfoBarDelegate"; |
| 59 } |
| 60 |
| 56 bool AndroidDownloadManagerOverwriteInfoBarDelegate::OverwriteExistingFile() { | 61 bool AndroidDownloadManagerOverwriteInfoBarDelegate::OverwriteExistingFile() { |
| 57 bool tab_closed = ChromeDownloadDelegate::EnqueueDownloadManagerRequest( | 62 bool tab_closed = ChromeDownloadDelegate::EnqueueDownloadManagerRequest( |
| 58 chrome_download_delegate_.obj(), true, download_info_.obj()); | 63 chrome_download_delegate_.obj(), true, download_info_.obj()); |
| 59 return !tab_closed; | 64 return !tab_closed; |
| 60 } | 65 } |
| 61 | 66 |
| 62 bool AndroidDownloadManagerOverwriteInfoBarDelegate::CreateNewFile() { | 67 bool AndroidDownloadManagerOverwriteInfoBarDelegate::CreateNewFile() { |
| 63 bool tab_closed = ChromeDownloadDelegate::EnqueueDownloadManagerRequest( | 68 bool tab_closed = ChromeDownloadDelegate::EnqueueDownloadManagerRequest( |
| 64 chrome_download_delegate_.obj(), false, download_info_.obj()); | 69 chrome_download_delegate_.obj(), false, download_info_.obj()); |
| 65 return !tab_closed; | 70 return !tab_closed; |
| 66 } | 71 } |
| 67 | 72 |
| 68 std::string AndroidDownloadManagerOverwriteInfoBarDelegate::GetFileName() | 73 std::string AndroidDownloadManagerOverwriteInfoBarDelegate::GetFileName() |
| 69 const { | 74 const { |
| 70 return file_name_; | 75 return file_name_; |
| 71 } | 76 } |
| 72 | 77 |
| 73 std::string AndroidDownloadManagerOverwriteInfoBarDelegate::GetDirName() const { | 78 std::string AndroidDownloadManagerOverwriteInfoBarDelegate::GetDirName() const { |
| 74 return dir_name_; | 79 return dir_name_; |
| 75 } | 80 } |
| 76 | 81 |
| 77 std::string AndroidDownloadManagerOverwriteInfoBarDelegate::GetDirFullPath() | 82 std::string AndroidDownloadManagerOverwriteInfoBarDelegate::GetDirFullPath() |
| 78 const { | 83 const { |
| 79 return dir_full_path_; | 84 return dir_full_path_; |
| 80 } | 85 } |
| 81 | 86 |
| 82 } // namespace android | 87 } // namespace android |
| 83 } // namespace chrome | 88 } // namespace chrome |
| OLD | NEW |