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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/AutoSigninFirstRunInfoBar.java

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
« no previous file with comments | « no previous file | chrome/browser/android/chrome_jni_registrar.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/AutoSigninFirstRunInfoBar.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/AutoSigninFirstRunInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/AutoSigninFirstRunInfoBar.java
new file mode 100644
index 0000000000000000000000000000000000000000..6c563036c4713e1b9b47713162039bec6c0d95f7
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/AutoSigninFirstRunInfoBar.java
@@ -0,0 +1,65 @@
+// 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.
+
+package org.chromium.chrome.browser.infobar;
+
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.method.LinkMovementMethod;
+import android.text.style.ClickableSpan;
+import android.view.View;
+import android.widget.TextView;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.chrome.R;
+
+/**
+ * The auto sign-in first run experience infobar is shown instead of usual auto sign-in snackbar
+ * when user first time faces the auto sign-in feature. It contains information about which account
+ * was used for signing in and text which explains the feature.
+ */
+public class AutoSigninFirstRunInfoBar extends ConfirmInfoBar {
+ private final String mExplanation;
+ private final int mExplanationLinkStart;
+ private final int mExplanationLinkEnd;
+
+ @CalledByNative
+ private static InfoBar show(String message, String primaryButtonText, String explanation,
+ int explanationLinkStart, int explanationLinkEnd) {
+ return new AutoSigninFirstRunInfoBar(
+ message, primaryButtonText, explanation, explanationLinkStart, explanationLinkEnd);
+ }
+
+ private AutoSigninFirstRunInfoBar(String message, String primaryButtonText, String explanation,
+ int explanationLinkStart, int explanationLinkEnd) {
+ super(null, R.drawable.account_management_no_picture, null, message, null,
+ primaryButtonText, null);
+ mExplanation = explanation;
+ mExplanationLinkStart = explanationLinkStart;
+ mExplanationLinkEnd = explanationLinkEnd;
+ }
+
+ /**
+ * Adds text, which explains the auto sign-in feature.
+ */
+ @Override
+ public void createContent(InfoBarLayout layout) {
+ super.createContent(layout);
+ SpannableString explanation = new SpannableString(mExplanation);
+ if (mExplanationLinkEnd != mExplanationLinkStart && mExplanationLinkEnd != 0) {
+ explanation.setSpan(new ClickableSpan() {
+ @Override
+ public void onClick(View view) {
+ onLinkClicked();
+ }
+ }, mExplanationLinkStart, mExplanationLinkEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
+ // TODO(melandory): Implement correct (as in mocks) margin for the first run
+ // experience text.
+ TextView firstRunExperienceMessageView = new TextView(getContext());
+ firstRunExperienceMessageView.setText(explanation, TextView.BufferType.SPANNABLE);
+ firstRunExperienceMessageView.setMovementMethod(LinkMovementMethod.getInstance());
+ layout.setCustomContent(firstRunExperienceMessageView);
+ }
+}
« no previous file with comments | « no previous file | chrome/browser/android/chrome_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698