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

Unified Diff: chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.cc
diff --git a/chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.cc b/chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2edc8a5385b393b0815516f564ada0fc92f0c493
--- /dev/null
+++ b/chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.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/snackbars/auto_signin_prompt_controller.h"
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "chrome/browser/android/tab_android.h"
+#include "chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/grit/generated_resources.h"
+#include "components/password_manager/core/browser/password_bubble_experiment.h"
+#include "content/public/browser/web_contents.h"
+#include "jni/AutoSigninSnackbarController_jni.h"
+#include "ui/base/l10n/l10n_util.h"
+
+void ShowAutoSigninPrompt(content::WebContents* web_contents,
+ const base::string16& username) {
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ base::string16 message = l10n_util::GetStringFUTF16(
+ IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE, username);
+
+ if (password_bubble_experiment::ShouldShowAutoSignInPromptFirstRunExperience(
+ profile->GetPrefs())) {
+ AutoSigninFirstRunInfoBarDelegate::Create(web_contents, message);
+ } else {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ TabAndroid* tab = TabAndroid::FromWebContents(web_contents);
+ ScopedJavaLocalRef<jstring> java_message =
+ base::android::ConvertUTF16ToJavaString(env, message);
+ Java_AutoSigninSnackbarController_showSnackbar(
+ env, tab->GetJavaObject().obj(), java_message.obj());
+ }
+}
+
+bool RegisterAutoSigninSnackbarController(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}

Powered by Google App Engine
This is Rietveld 408576698