| Index: chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.cc
|
| diff --git a/chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.cc b/chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..368ce35360091f7455ade8663d467ec09b26dc3e
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.cc
|
| @@ -0,0 +1,51 @@
|
| +// 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/auto_signin_first_run_infobar.h"
|
| +
|
| +#include "base/android/jni_android.h"
|
| +#include "base/android/jni_array.h"
|
| +#include "base/android/jni_string.h"
|
| +#include "components/password_manager/core/common/credential_manager_types.h"
|
| +#include "jni/AutoSigninFirstRunInfobar_jni.h"
|
| +
|
| +AutoSigninFirstRunInfobar::AutoSigninFirstRunInfobar(
|
| + scoped_ptr<AutoSigninFirstRunInfobarDelegate> delegate)
|
| + : ConfirmInfoBar(delegate.Pass()) {}
|
| +
|
| +AutoSigninFirstRunInfobar::~AutoSigninFirstRunInfobar() {}
|
| +
|
| +base::android::ScopedJavaLocalRef<jobject>
|
| +AutoSigninFirstRunInfobar::CreateRenderInfoBar(JNIEnv* env) {
|
| + using base::android::ConvertUTF16ToJavaString;
|
| + using base::android::ScopedJavaLocalRef;
|
| + AutoSigninFirstRunInfobarDelegate* auto_signin_infobar_delegate =
|
| + static_cast<AutoSigninFirstRunInfobarDelegate*>(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> explanation_text = ConvertUTF16ToJavaString(
|
| + env, auto_signin_infobar_delegate->GetExplanation());
|
| + ScopedJavaLocalRef<jstring> message_text = ConvertUTF16ToJavaString(
|
| + env, auto_signin_infobar_delegate->GetMessageText());
|
| +
|
| + return Java_AutoSigninFirstRunInfobar_show(
|
| + env, message_text.obj(), ok_button_text.obj(), explanation_text.obj(),
|
| + auto_signin_infobar_delegate->message_link_range().start(),
|
| + auto_signin_infobar_delegate->message_link_range().end());
|
| +}
|
| +
|
| +void AutoSigninFirstRunInfobar::OnLinkClicked(JNIEnv* env, jobject obj) {
|
| + GetDelegate()->LinkClicked(NEW_FOREGROUND_TAB);
|
| +}
|
| +
|
| +bool AutoSigninFirstRunInfobar::Register(JNIEnv* env) {
|
| + return RegisterNativesImpl(env);
|
| +}
|
| +
|
| +scoped_ptr<infobars::InfoBar> CreateAutoSigninFirstRunInfobar(
|
| + scoped_ptr<AutoSigninFirstRunInfobarDelegate> delegate) {
|
| + return make_scoped_ptr(new AutoSigninFirstRunInfobar(delegate.Pass()));
|
| +}
|
|
|