| 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/ui/android/infobars/download_overwrite_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/download_overwrite_infobar.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
| 10 #include "base/android/jni_weak_ref.h" | 12 #include "base/android/jni_weak_ref.h" |
| 11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 12 #include "chrome/browser/android/download/download_overwrite_infobar_delegate.h" | 14 #include "chrome/browser/android/download/download_overwrite_infobar_delegate.h" |
| 13 #include "jni/DownloadOverwriteInfoBar_jni.h" | 15 #include "jni/DownloadOverwriteInfoBar_jni.h" |
| 14 | 16 |
| 15 using chrome::android::DownloadOverwriteInfoBarDelegate; | 17 using chrome::android::DownloadOverwriteInfoBarDelegate; |
| 16 | 18 |
| 17 // static | 19 // static |
| 18 scoped_ptr<infobars::InfoBar> DownloadOverwriteInfoBar::CreateInfoBar( | 20 scoped_ptr<infobars::InfoBar> DownloadOverwriteInfoBar::CreateInfoBar( |
| 19 scoped_ptr<DownloadOverwriteInfoBarDelegate> delegate) { | 21 scoped_ptr<DownloadOverwriteInfoBarDelegate> delegate) { |
| 20 return make_scoped_ptr(new DownloadOverwriteInfoBar(delegate.Pass())); | 22 return make_scoped_ptr(new DownloadOverwriteInfoBar(std::move(delegate))); |
| 21 } | 23 } |
| 22 | 24 |
| 23 DownloadOverwriteInfoBar::~DownloadOverwriteInfoBar() { | 25 DownloadOverwriteInfoBar::~DownloadOverwriteInfoBar() { |
| 24 } | 26 } |
| 25 | 27 |
| 26 DownloadOverwriteInfoBar::DownloadOverwriteInfoBar( | 28 DownloadOverwriteInfoBar::DownloadOverwriteInfoBar( |
| 27 scoped_ptr<DownloadOverwriteInfoBarDelegate> delegate) | 29 scoped_ptr<DownloadOverwriteInfoBarDelegate> delegate) |
| 28 : InfoBarAndroid(delegate.Pass()) { | 30 : InfoBarAndroid(std::move(delegate)) {} |
| 29 } | |
| 30 | 31 |
| 31 base::android::ScopedJavaLocalRef<jobject> | 32 base::android::ScopedJavaLocalRef<jobject> |
| 32 DownloadOverwriteInfoBar::CreateRenderInfoBar(JNIEnv* env) { | 33 DownloadOverwriteInfoBar::CreateRenderInfoBar(JNIEnv* env) { |
| 33 DownloadOverwriteInfoBarDelegate* delegate = GetDelegate(); | 34 DownloadOverwriteInfoBarDelegate* delegate = GetDelegate(); |
| 34 | 35 |
| 35 ScopedJavaLocalRef<jstring> j_file_name = | 36 ScopedJavaLocalRef<jstring> j_file_name = |
| 36 base::android::ConvertUTF8ToJavaString(env, delegate->GetFileName()); | 37 base::android::ConvertUTF8ToJavaString(env, delegate->GetFileName()); |
| 37 ScopedJavaLocalRef<jstring> j_dir_name = | 38 ScopedJavaLocalRef<jstring> j_dir_name = |
| 38 base::android::ConvertUTF8ToJavaString(env, delegate->GetDirName()); | 39 base::android::ConvertUTF8ToJavaString(env, delegate->GetDirName()); |
| 39 ScopedJavaLocalRef<jstring> j_dir_full_path = | 40 ScopedJavaLocalRef<jstring> j_dir_full_path = |
| (...skipping 22 matching lines...) Expand all Loading... |
| 62 | 63 |
| 63 DownloadOverwriteInfoBarDelegate* DownloadOverwriteInfoBar::GetDelegate() { | 64 DownloadOverwriteInfoBarDelegate* DownloadOverwriteInfoBar::GetDelegate() { |
| 64 return static_cast<DownloadOverwriteInfoBarDelegate*>(delegate()); | 65 return static_cast<DownloadOverwriteInfoBarDelegate*>(delegate()); |
| 65 } | 66 } |
| 66 | 67 |
| 67 // Native JNI methods --------------------------------------------------------- | 68 // Native JNI methods --------------------------------------------------------- |
| 68 | 69 |
| 69 bool RegisterDownloadOverwriteInfoBarDelegate(JNIEnv* env) { | 70 bool RegisterDownloadOverwriteInfoBarDelegate(JNIEnv* env) { |
| 70 return RegisterNativesImpl(env); | 71 return RegisterNativesImpl(env); |
| 71 } | 72 } |
| OLD | NEW |