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/snackbars/auto_signin_prompt_controller.h" | |
6 | |
7 #include "base/android/jni_android.h" | |
8 #include "base/android/jni_string.h" | |
9 #include "chrome/browser/android/tab_android.h" | |
10 #include "chrome/browser/password_manager/auto_signin_first_run_infobar_delegate .h" | |
11 #include "chrome/browser/profiles/profile.h" | |
12 #include "chrome/grit/generated_resources.h" | |
13 #include "components/password_manager/core/browser/password_bubble_experiment.h" | |
14 #include "content/public/browser/web_contents.h" | |
15 #include "jni/AutoSigninSnackbarController_jni.h" | |
16 #include "ui/base/l10n/l10n_util.h" | |
17 | |
18 void ShowAutoSigninPrompt(content::WebContents* web_contents, | |
19 const base::string16& username) { | |
20 LOG(ERROR) << "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa"; | |
gone
2015/11/03 18:39:00
Are these LOG(ERROR)s intentionally being submitte
melandory
2015/11/03 21:43:28
Sorry, removed.
| |
21 Profile* profile = | |
22 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | |
23 base::string16 message = l10n_util::GetStringFUTF16( | |
24 IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE, username); | |
25 | |
26 if (password_bubble_experiment::ShouldShowAutoSignInPromptFirstRunExperience( | |
27 profile->GetPrefs())) { | |
28 LOG(ERROR) << "About to create delegate"; | |
29 AutoSigninFirstRunInfobarDelegate::Create(web_contents, message); | |
30 LOG(ERROR) << "Delegare was created"; | |
31 } else { | |
32 JNIEnv* env = base::android::AttachCurrentThread(); | |
33 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); | |
34 ScopedJavaLocalRef<jstring> java_message = | |
35 base::android::ConvertUTF16ToJavaString(env, message); | |
36 Java_AutoSigninSnackbarController_showSnackbar( | |
37 env, tab->GetJavaObject().obj(), java_message.obj()); | |
38 } | |
39 } | |
40 | |
41 bool RegisterAutoSigninSnackbarController(JNIEnv* env) { | |
42 return RegisterNativesImpl(env); | |
43 } | |
OLD | NEW |