OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 5 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "chrome/browser/android/tab_android.h" | 9 #include "chrome/browser/android/tab_android.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
12 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 12 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "jni/AutoSigninSnackbarController_jni.h" | 14 #include "jni/AutoSigninSnackbarController_jni.h" |
15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
16 | 16 |
| 17 using base::android::ScopedJavaLocalRef; |
| 18 |
17 void ShowAutoSigninPrompt(content::WebContents* web_contents, | 19 void ShowAutoSigninPrompt(content::WebContents* web_contents, |
18 const base::string16& username) { | 20 const base::string16& username) { |
19 base::string16 message = l10n_util::GetStringFUTF16( | 21 base::string16 message = l10n_util::GetStringFUTF16( |
20 IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE, username); | 22 IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE, username); |
21 | 23 |
22 JNIEnv* env = base::android::AttachCurrentThread(); | 24 JNIEnv* env = base::android::AttachCurrentThread(); |
23 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); | 25 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); |
24 // TODO(melandory): https://crbug.com/590838 Introduce proper fix. | 26 // TODO(melandory): https://crbug.com/590838 Introduce proper fix. |
25 if (tab == nullptr) | 27 if (tab == nullptr) |
26 return; | 28 return; |
27 ScopedJavaLocalRef<jstring> java_message = | 29 ScopedJavaLocalRef<jstring> java_message = |
28 base::android::ConvertUTF16ToJavaString(env, message); | 30 base::android::ConvertUTF16ToJavaString(env, message); |
29 Java_AutoSigninSnackbarController_showSnackbar( | 31 Java_AutoSigninSnackbarController_showSnackbar( |
30 env, tab->GetJavaObject().obj(), java_message.obj()); | 32 env, tab->GetJavaObject().obj(), java_message.obj()); |
31 } | 33 } |
32 | 34 |
OLD | NEW |