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