Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Side by Side Diff: chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.cc

Issue 1379153003: [Smart Lock, UI] First run expience for Auto sign-in prompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: AutoSigninFirstRunInfoBar.java Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/auto_signin_first_run_infobar.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h"
10 #include "components/password_manager/core/common/credential_manager_types.h"
11 #include "jni/AutoSigninFirstRunInfoBar_jni.h"
12
13 AutoSigninFirstRunInfoBar::AutoSigninFirstRunInfoBar(
14 scoped_ptr<AutoSigninFirstRunInfoBarDelegate> delegate)
15 : ConfirmInfoBar(delegate.Pass()) {}
16
17 AutoSigninFirstRunInfoBar::~AutoSigninFirstRunInfoBar() {}
18
19 base::android::ScopedJavaLocalRef<jobject>
20 AutoSigninFirstRunInfoBar::CreateRenderInfoBar(JNIEnv* env) {
21 using base::android::ConvertUTF16ToJavaString;
22 using base::android::ScopedJavaLocalRef;
23 AutoSigninFirstRunInfoBarDelegate* auto_signin_infobar_delegate =
24 static_cast<AutoSigninFirstRunInfoBarDelegate*>(delegate());
25 ScopedJavaLocalRef<jstring> ok_button_text = ConvertUTF16ToJavaString(
26 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK));
27 ScopedJavaLocalRef<jstring> cancel_button_text = ConvertUTF16ToJavaString(
28 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL));
29 ScopedJavaLocalRef<jstring> explanation_text = ConvertUTF16ToJavaString(
30 env, auto_signin_infobar_delegate->GetExplanation());
31 ScopedJavaLocalRef<jstring> message_text = ConvertUTF16ToJavaString(
32 env, auto_signin_infobar_delegate->GetMessageText());
33
34 return Java_AutoSigninFirstRunInfoBar_show(
35 env, message_text.obj(), ok_button_text.obj(), explanation_text.obj(),
36 auto_signin_infobar_delegate->message_link_range().start(),
37 auto_signin_infobar_delegate->message_link_range().end());
38 }
39
40 void AutoSigninFirstRunInfoBar::OnLinkClicked(JNIEnv* env, jobject obj) {
41 GetDelegate()->LinkClicked(NEW_FOREGROUND_TAB);
42 }
43
44 bool AutoSigninFirstRunInfoBar::Register(JNIEnv* env) {
45 return RegisterNativesImpl(env);
46 }
47
48 scoped_ptr<infobars::InfoBar> CreateAutoSigninFirstRunInfoBar(
49 scoped_ptr<AutoSigninFirstRunInfoBarDelegate> delegate) {
50 return make_scoped_ptr(new AutoSigninFirstRunInfoBar(delegate.Pass()));
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698