OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/data_reduction_proxy_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/data_reduction_proxy_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_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 DataReductionProxyInfoBarDelegateAndroid::Create( | 25 DataReductionProxyInfoBarDelegateAndroid::Create( |
26 web_contents, base::android::ConvertJavaStringToUTF8(env, jlink_url)); | 26 web_contents, base::android::ConvertJavaStringToUTF8(env, jlink_url)); |
27 } | 27 } |
28 | 28 |
29 // static | 29 // static |
30 bool DataReductionProxyInfoBar::Register(JNIEnv* env) { | 30 bool DataReductionProxyInfoBar::Register(JNIEnv* env) { |
31 return RegisterNativesImpl(env); | 31 return RegisterNativesImpl(env); |
32 } | 32 } |
33 | 33 |
34 DataReductionProxyInfoBar::DataReductionProxyInfoBar( | 34 DataReductionProxyInfoBar::DataReductionProxyInfoBar( |
35 scoped_ptr<DataReductionProxyInfoBarDelegateAndroid> delegate) | 35 std::unique_ptr<DataReductionProxyInfoBarDelegateAndroid> delegate) |
36 : ConfirmInfoBar(std::move(delegate)), | 36 : ConfirmInfoBar(std::move(delegate)), |
37 java_data_reduction_proxy_delegate_() {} | 37 java_data_reduction_proxy_delegate_() {} |
38 | 38 |
39 DataReductionProxyInfoBar::~DataReductionProxyInfoBar() { | 39 DataReductionProxyInfoBar::~DataReductionProxyInfoBar() { |
40 } | 40 } |
41 | 41 |
42 base::android::ScopedJavaLocalRef<jobject> | 42 base::android::ScopedJavaLocalRef<jobject> |
43 DataReductionProxyInfoBar::CreateRenderInfoBar(JNIEnv* env) { | 43 DataReductionProxyInfoBar::CreateRenderInfoBar(JNIEnv* env) { |
44 java_data_reduction_proxy_delegate_.Reset( | 44 java_data_reduction_proxy_delegate_.Reset( |
45 Java_DataReductionProxyInfoBarDelegate_create(env)); | 45 Java_DataReductionProxyInfoBarDelegate_create(env)); |
46 | 46 |
47 return Java_DataReductionProxyInfoBarDelegate_showDataReductionProxyInfoBar( | 47 return Java_DataReductionProxyInfoBarDelegate_showDataReductionProxyInfoBar( |
48 env, java_data_reduction_proxy_delegate_.obj(), GetEnumeratedIconId()); | 48 env, java_data_reduction_proxy_delegate_.obj(), GetEnumeratedIconId()); |
49 } | 49 } |
50 | 50 |
51 DataReductionProxyInfoBarDelegateAndroid* | 51 DataReductionProxyInfoBarDelegateAndroid* |
52 DataReductionProxyInfoBar::GetDelegate() { | 52 DataReductionProxyInfoBar::GetDelegate() { |
53 return static_cast<DataReductionProxyInfoBarDelegateAndroid*>(delegate()); | 53 return static_cast<DataReductionProxyInfoBarDelegateAndroid*>(delegate()); |
54 } | 54 } |
55 | 55 |
56 // DataReductionProxyInfoBarDelegate: | 56 // DataReductionProxyInfoBarDelegate: |
57 | 57 |
58 // static | 58 // static |
59 scoped_ptr<infobars::InfoBar> | 59 std::unique_ptr<infobars::InfoBar> |
60 DataReductionProxyInfoBarDelegateAndroid::CreateInfoBar( | 60 DataReductionProxyInfoBarDelegateAndroid::CreateInfoBar( |
61 infobars::InfoBarManager* infobar_manager, | 61 infobars::InfoBarManager* infobar_manager, |
62 scoped_ptr<DataReductionProxyInfoBarDelegateAndroid> delegate) { | 62 std::unique_ptr<DataReductionProxyInfoBarDelegateAndroid> delegate) { |
63 return scoped_ptr<infobars::InfoBar>( | 63 return std::unique_ptr<infobars::InfoBar>( |
64 new DataReductionProxyInfoBar(std::move(delegate))); | 64 new DataReductionProxyInfoBar(std::move(delegate))); |
65 } | 65 } |
66 | 66 |
67 // JNI for DataReductionProxyInfoBarDelegate. | 67 // JNI for DataReductionProxyInfoBarDelegate. |
68 void Launch(JNIEnv* env, | 68 void Launch(JNIEnv* env, |
69 const JavaParamRef<jclass>& clazz, | 69 const JavaParamRef<jclass>& clazz, |
70 const JavaParamRef<jobject>& jweb_contents, | 70 const JavaParamRef<jobject>& jweb_contents, |
71 const JavaParamRef<jstring>& jlink_url) { | 71 const JavaParamRef<jstring>& jlink_url) { |
72 DataReductionProxyInfoBar::Launch(env, clazz, jweb_contents, jlink_url); | 72 DataReductionProxyInfoBar::Launch(env, clazz, jweb_contents, jlink_url); |
73 } | 73 } |
OLD | NEW |