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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/password_manager/auto_signin_first_run_infobar_delegate .h"
6
7 #include "chrome/browser/infobars/infobar_service.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/profile_sync_service.h"
10 #include "chrome/browser/sync/profile_sync_service_factory.h"
11 #include "chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.h"
12 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
13 #include "chrome/grit/chromium_strings.h"
14 #include "chrome/grit/generated_resources.h"
15 #include "components/infobars/core/infobar.h"
16 #include "components/password_manager/core/browser/password_bubble_experiment.h"
17 #include "content/public/browser/web_contents.h"
18 #include "ui/base/l10n/l10n_util.h"
19
20 // static
21 void AutoSigninFirstRunInfobarDelegate::Create(
22 content::WebContents* web_contents,
23 const base::string16& message) {
24 Profile* profile =
25 Profile::FromBrowserContext(web_contents->GetBrowserContext());
26 bool is_smartlock_branding_enabled =
27 password_bubble_experiment::IsSmartLockBrandingEnabled(
28 ProfileSyncServiceFactory::GetForProfile(profile));
29 InfoBarService::FromWebContents(web_contents)
30 ->AddInfoBar(make_scoped_ptr(new AutoSigninFirstRunInfobar(
31 make_scoped_ptr(new AutoSigninFirstRunInfobarDelegate(
32 web_contents, is_smartlock_branding_enabled, message)))));
33 }
34
35 AutoSigninFirstRunInfobarDelegate::AutoSigninFirstRunInfobarDelegate(
36 content::WebContents* web_contents,
37 bool is_smartlock_branding_enabled,
38 const base::string16& message)
39 : PasswordManagerInfoBarDelegate(), web_contents_(web_contents) {
40 gfx::Range explanation_link_range;
41 GetAutoSigninPromptFirstRunExperienceExplanation(
42 is_smartlock_branding_enabled, &explanation_, &explanation_link_range);
43 SetMessageLinkRange(explanation_link_range);
44 SetMessage(message);
45 }
46
47 AutoSigninFirstRunInfobarDelegate::~AutoSigninFirstRunInfobarDelegate() {
48 Profile* profile =
49 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
50 password_bubble_experiment::RecordAutoSignInPromptFirstRunExperienceWasShown(
51 profile->GetPrefs());
52 }
53
54 base::string16 AutoSigninFirstRunInfobarDelegate::GetButtonLabel(
55 InfoBarButton button) const {
56 return l10n_util::GetStringUTF16(IDS_ONE_CLICK_SIGNIN_DIALOG_OK_BUTTON);
57 }
58
59 bool AutoSigninFirstRunInfobarDelegate::Accept() {
60 return true;
61 }
62
63 bool AutoSigninFirstRunInfobarDelegate::Cancel() {
64 return true;
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698