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

Unified Diff: chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.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/password_manager/auto_signin_first_run_infobar_delegate.cc
diff --git a/chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.cc b/chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..510da499ec1ddfb2be761e3d4a3c75175df68e67
--- /dev/null
+++ b/chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.cc
@@ -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.
+
+#include "chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.h"
+
+#include "chrome/browser/infobars/infobar_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.h"
+#include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
+#include "chrome/grit/chromium_strings.h"
+#include "chrome/grit/generated_resources.h"
+#include "components/infobars/core/infobar.h"
+#include "components/password_manager/core/browser/password_bubble_experiment.h"
+#include "content/public/browser/web_contents.h"
+#include "ui/base/l10n/l10n_util.h"
+
+// static
+void AutoSigninFirstRunInfoBarDelegate::Create(
+ content::WebContents* web_contents,
+ const base::string16& message) {
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ bool is_smartlock_branding_enabled =
+ password_bubble_experiment::IsSmartLockBrandingEnabled(
+ ProfileSyncServiceFactory::GetForProfile(profile));
+ InfoBarService::FromWebContents(web_contents)
+ ->AddInfoBar(make_scoped_ptr(new AutoSigninFirstRunInfoBar(
+ make_scoped_ptr(new AutoSigninFirstRunInfoBarDelegate(
+ web_contents, is_smartlock_branding_enabled, message)))));
+}
+
+AutoSigninFirstRunInfoBarDelegate::AutoSigninFirstRunInfoBarDelegate(
+ content::WebContents* web_contents,
+ bool is_smartlock_branding_enabled,
+ const base::string16& message)
+ : PasswordManagerInfoBarDelegate(), web_contents_(web_contents) {
+ gfx::Range explanation_link_range;
+ GetAutoSigninPromptFirstRunExperienceExplanation(
+ is_smartlock_branding_enabled, &explanation_, &explanation_link_range);
+ SetMessageLinkRange(explanation_link_range);
+ SetMessage(message);
+}
+
+AutoSigninFirstRunInfoBarDelegate::~AutoSigninFirstRunInfoBarDelegate() {
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents_->GetBrowserContext());
+ password_bubble_experiment::RecordAutoSignInPromptFirstRunExperienceWasShown(
+ profile->GetPrefs());
+}
+
+base::string16 AutoSigninFirstRunInfoBarDelegate::GetButtonLabel(
+ InfoBarButton button) const {
+ return l10n_util::GetStringUTF16(IDS_ONE_CLICK_SIGNIN_DIALOG_OK_BUTTON);
+}
+
+bool AutoSigninFirstRunInfoBarDelegate::Accept() {
+ return true;
+}
+
+bool AutoSigninFirstRunInfoBarDelegate::Cancel() {
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698