Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/android/infobars/save_password_infobar.h" | |
| 6 | |
| 7 #include "base/android/jni_android.h" | |
| 8 #include "base/android/jni_string.h" | |
| 9 #include "jni/SavePasswordInfoBar_jni.h" | |
| 10 | |
| 11 SavePasswordInfoBar::SavePasswordInfoBar( | |
| 12 scoped_ptr<SavePasswordInfoBarDelegate> delegate) | |
| 13 : ConfirmInfoBar(delegate.Pass()) { | |
| 14 } | |
| 15 | |
| 16 SavePasswordInfoBar::~SavePasswordInfoBar() { | |
| 17 } | |
| 18 | |
| 19 base::android::ScopedJavaLocalRef<jobject> | |
| 20 SavePasswordInfoBar::CreateRenderInfoBar(JNIEnv* env) { | |
| 21 using base::android::ConvertUTF16ToJavaString; | |
| 22 base::android::ScopedJavaLocalRef<jstring> ok_button_text = | |
| 23 ConvertUTF16ToJavaString(env, | |
| 24 GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK)); | |
| 25 base::android::ScopedJavaLocalRef<jstring> cancel_button_text = | |
| 26 ConvertUTF16ToJavaString( | |
| 27 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL)); | |
| 28 SavePasswordInfoBarDelegate* delegate = GetDelegate(); | |
| 29 base::android::ScopedJavaLocalRef<jstring> message_text = | |
| 30 ConvertUTF16ToJavaString(env, delegate->GetMessageText()); | |
| 31 | |
| 32 return Java_SavePasswordInfoBar_show( | |
| 33 env, reinterpret_cast<intptr_t>(this), GetEnumeratedIconId(), | |
| 34 message_text.obj(), ok_button_text.obj(), cancel_button_text.obj(), | |
| 35 delegate->ShouldShowMoreButton()); | |
| 36 } | |
| 37 | |
| 38 SavePasswordInfoBarDelegate* SavePasswordInfoBar::GetDelegate() { | |
| 39 return static_cast<SavePasswordInfoBarDelegate*>(delegate()); | |
|
Bernhard Bauer
2015/03/02 10:28:09
You can probably inline this method; it's private
melandory
2015/03/03 11:55:46
Actually twice, also for GetMessage.
| |
| 40 } | |
| 41 | |
| 42 bool RegisterSavePasswordInfoBar(JNIEnv* env) { | |
| 43 return RegisterNativesImpl(env); | |
| 44 } | |
| OLD | NEW |