OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/update_password_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/update_password_infobar.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
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 "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" | 12 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" |
13 #include "components/password_manager/core/common/credential_manager_types.h" | 13 #include "components/password_manager/core/common/credential_manager_types.h" |
14 #include "jni/UpdatePasswordInfoBar_jni.h" | 14 #include "jni/UpdatePasswordInfoBar_jni.h" |
15 | 15 |
16 UpdatePasswordInfoBar::UpdatePasswordInfoBar( | 16 UpdatePasswordInfoBar::UpdatePasswordInfoBar( |
17 std::unique_ptr<UpdatePasswordInfoBarDelegate> delegate) | 17 std::unique_ptr<UpdatePasswordInfoBarDelegate> delegate) |
18 : ConfirmInfoBar(std::move(delegate)) {} | 18 : ConfirmInfoBar(std::move(delegate)) {} |
19 | 19 |
20 UpdatePasswordInfoBar::~UpdatePasswordInfoBar() {} | 20 UpdatePasswordInfoBar::~UpdatePasswordInfoBar() {} |
21 | 21 |
22 bool UpdatePasswordInfoBar::Register(JNIEnv* env) { | |
23 return RegisterNativesImpl(env); | |
24 } | |
25 | |
26 int UpdatePasswordInfoBar::GetIdOfSelectedUsername() const { | 22 int UpdatePasswordInfoBar::GetIdOfSelectedUsername() const { |
27 return Java_UpdatePasswordInfoBar_getSelectedUsername( | 23 return Java_UpdatePasswordInfoBar_getSelectedUsername( |
28 base::android::AttachCurrentThread(), java_infobar_.obj()); | 24 base::android::AttachCurrentThread(), java_infobar_.obj()); |
29 } | 25 } |
30 | 26 |
31 base::android::ScopedJavaLocalRef<jobject> | 27 base::android::ScopedJavaLocalRef<jobject> |
32 UpdatePasswordInfoBar::CreateRenderInfoBar(JNIEnv* env) { | 28 UpdatePasswordInfoBar::CreateRenderInfoBar(JNIEnv* env) { |
33 using base::android::ConvertUTF16ToJavaString; | 29 using base::android::ConvertUTF16ToJavaString; |
34 using base::android::ScopedJavaLocalRef; | 30 using base::android::ScopedJavaLocalRef; |
35 UpdatePasswordInfoBarDelegate* update_password_delegate = | 31 UpdatePasswordInfoBarDelegate* update_password_delegate = |
(...skipping 23 matching lines...) Expand all Loading... |
59 update_password_delegate->is_smartlock_branding_enabled())); | 55 update_password_delegate->is_smartlock_branding_enabled())); |
60 | 56 |
61 java_infobar_.Reset(env, infobar.obj()); | 57 java_infobar_.Reset(env, infobar.obj()); |
62 return infobar; | 58 return infobar; |
63 } | 59 } |
64 | 60 |
65 void UpdatePasswordInfoBar::OnLinkClicked(JNIEnv* env, | 61 void UpdatePasswordInfoBar::OnLinkClicked(JNIEnv* env, |
66 const JavaParamRef<jobject>& obj) { | 62 const JavaParamRef<jobject>& obj) { |
67 GetDelegate()->LinkClicked(NEW_FOREGROUND_TAB); | 63 GetDelegate()->LinkClicked(NEW_FOREGROUND_TAB); |
68 } | 64 } |
OLD | NEW |