| 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..7704e3c3ef101c075619cf488e09e05a59925776
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/android/infobars/save_password_infobar.cc
|
| @@ -0,0 +1,40 @@
|
| +// 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;
|
| + using base::android::ScopedJavaLocalRef;
|
| + SavePasswordInfoBarDelegate* save_password_delegate =
|
| + static_cast<SavePasswordInfoBarDelegate*>(delegate());
|
| + ScopedJavaLocalRef<jstring> ok_button_text = ConvertUTF16ToJavaString(
|
| + env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK));
|
| + ScopedJavaLocalRef<jstring> cancel_button_text = ConvertUTF16ToJavaString(
|
| + env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL));
|
| + ScopedJavaLocalRef<jstring> message_text = ConvertUTF16ToJavaString(
|
| + env, save_password_delegate->GetMessageText());
|
| +
|
| + return Java_SavePasswordInfoBar_show(
|
| + env, reinterpret_cast<intptr_t>(this), GetEnumeratedIconId(),
|
| + message_text.obj(), ok_button_text.obj(), cancel_button_text.obj(),
|
| + save_password_delegate->ShouldShowMoreButton());
|
| +}
|
| +
|
| +bool SavePasswordInfoBar::Register(JNIEnv* env) {
|
| + return RegisterNativesImpl(env);
|
| +}
|
|
|