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

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: 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..b71ee9acf02a25cb3fa32960431702c9dec6d164
--- /dev/null
+++ b/chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.cc
@@ -0,0 +1,43 @@
+// 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) {
+ 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.
+ 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())) {
+ LOG(ERROR) << "About to create delegate";
+ AutoSigninFirstRunInfobarDelegate::Create(web_contents, message);
+ LOG(ERROR) << "Delegare was created";
+ } 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