Chromium Code Reviews| Index: chrome/browser/ui/android/infobars/save_password_infobar.cc |
| diff --git a/chrome/browser/ui/android/infobars/save_password_infobar.cc b/chrome/browser/ui/android/infobars/save_password_infobar.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..26bb4d8788188bdf0b370648b1bb18793b9597ba |
| --- /dev/null |
| +++ b/chrome/browser/ui/android/infobars/save_password_infobar.cc |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/android/infobars/save_password_infobar.h" |
| + |
| +#include "base/android/jni_android.h" |
| +#include "base/android/jni_string.h" |
| +#include "jni/SavePasswordInfoBar_jni.h" |
| + |
| +SavePasswordInfoBar::SavePasswordInfoBar( |
| + scoped_ptr<SavePasswordInfoBarDelegate> delegate) |
| + : ConfirmInfoBar(delegate.Pass()) { |
| +} |
| + |
| +SavePasswordInfoBar::~SavePasswordInfoBar() { |
| +} |
| + |
| +base::android::ScopedJavaLocalRef<jobject> |
| +SavePasswordInfoBar::CreateRenderInfoBar(JNIEnv* env) { |
| + using base::android::ConvertUTF16ToJavaString; |
| + base::android::ScopedJavaLocalRef<jstring> ok_button_text = |
| + ConvertUTF16ToJavaString(env, |
| + GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK)); |
| + base::android::ScopedJavaLocalRef<jstring> cancel_button_text = |
| + ConvertUTF16ToJavaString( |
| + env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL)); |
| + SavePasswordInfoBarDelegate* delegate = GetDelegate(); |
| + base::android::ScopedJavaLocalRef<jstring> message_text = |
| + ConvertUTF16ToJavaString(env, delegate->GetMessageText()); |
| + |
| + return Java_SavePasswordInfoBar_show( |
| + env, reinterpret_cast<intptr_t>(this), GetEnumeratedIconId(), |
| + message_text.obj(), ok_button_text.obj(), cancel_button_text.obj(), |
| + delegate->ShouldShowMoreButton()); |
| +} |
| + |
| +SavePasswordInfoBarDelegate* SavePasswordInfoBar::GetDelegate() { |
| + 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.
|
| +} |
| + |
| +bool RegisterSavePasswordInfoBar(JNIEnv* env) { |
| + return RegisterNativesImpl(env); |
| +} |