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

Side by Side Diff: chrome/browser/ui/passwords/password_dialog_controller_impl.cc

Issue 1992633003: Add "Sign In" button to the account chooser on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/passwords/password_dialog_controller_impl.h" 5 #include "chrome/browser/ui/passwords/password_dialog_controller_impl.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sync/profile_sync_service_factory.h" 8 #include "chrome/browser/sync/profile_sync_service_factory.h"
9 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" 9 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
10 #include "chrome/browser/ui/passwords/password_dialog_prompts.h" 10 #include "chrome/browser/ui/passwords/password_dialog_prompts.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 PasswordDialogControllerImpl::GetAccoutChooserTitle() const { 77 PasswordDialogControllerImpl::GetAccoutChooserTitle() const {
78 std::pair<base::string16, gfx::Range> result; 78 std::pair<base::string16, gfx::Range> result;
79 GetAccountChooserDialogTitleTextAndLinkRange( 79 GetAccountChooserDialogTitleTextAndLinkRange(
80 IsSmartLockBrandingEnabled(profile_), 80 IsSmartLockBrandingEnabled(profile_),
81 local_credentials_.size() > 1, 81 local_credentials_.size() > 1,
82 &result.first, 82 &result.first,
83 &result.second); 83 &result.second);
84 return result; 84 return result;
85 } 85 }
86 86
87 bool PasswordDialogControllerImpl::ShouldShowSignInButton() const {
88 return local_credentials_.size() == 1;
89 }
90
87 base::string16 PasswordDialogControllerImpl::GetAutoSigninPromoTitle() const { 91 base::string16 PasswordDialogControllerImpl::GetAutoSigninPromoTitle() const {
88 int message_id = IsSyncingAutosignSetting(profile_) 92 int message_id = IsSyncingAutosignSetting(profile_)
89 ? IDS_AUTO_SIGNIN_FIRST_RUN_TITLE_MANY_DEVICES 93 ? IDS_AUTO_SIGNIN_FIRST_RUN_TITLE_MANY_DEVICES
90 : IDS_AUTO_SIGNIN_FIRST_RUN_TITLE_LOCAL_DEVICE; 94 : IDS_AUTO_SIGNIN_FIRST_RUN_TITLE_LOCAL_DEVICE;
91 return l10n_util::GetStringUTF16(message_id); 95 return l10n_util::GetStringUTF16(message_id);
92 } 96 }
93 97
94 std::pair<base::string16, gfx::Range> 98 std::pair<base::string16, gfx::Range>
95 PasswordDialogControllerImpl::GetAutoSigninText() const { 99 PasswordDialogControllerImpl::GetAutoSigninText() const {
96 std::pair<base::string16, gfx::Range> result; 100 std::pair<base::string16, gfx::Range> result;
(...skipping 10 matching lines...) Expand all
107 111
108 void PasswordDialogControllerImpl::OnChooseCredentials( 112 void PasswordDialogControllerImpl::OnChooseCredentials(
109 const autofill::PasswordForm& password_form, 113 const autofill::PasswordForm& password_form,
110 password_manager::CredentialType credential_type) { 114 password_manager::CredentialType credential_type) {
111 password_manager::metrics_util::LogAccountChooserUserAction( 115 password_manager::metrics_util::LogAccountChooserUserAction(
112 password_manager::metrics_util::ACCOUNT_CHOOSER_CREDENTIAL_CHOSEN); 116 password_manager::metrics_util::ACCOUNT_CHOOSER_CREDENTIAL_CHOSEN);
113 ResetDialog(); 117 ResetDialog();
114 delegate_->ChooseCredential(password_form, credential_type); 118 delegate_->ChooseCredential(password_form, credential_type);
115 } 119 }
116 120
121 void PasswordDialogControllerImpl::OnSignInClicked() {
122 DCHECK_EQ(1u, local_credentials_.size());
123 password_manager::metrics_util::LogAccountChooserUserAction(
124 password_manager::metrics_util::ACCOUNT_CHOOSER_SIGN_IN);
125 ResetDialog();
126 delegate_->ChooseCredential(
127 *local_credentials_[0],
128 password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
129 }
130
117 void PasswordDialogControllerImpl::OnAutoSigninOK() { 131 void PasswordDialogControllerImpl::OnAutoSigninOK() {
118 password_bubble_experiment::RecordAutoSignInPromptFirstRunExperienceWasShown( 132 password_bubble_experiment::RecordAutoSignInPromptFirstRunExperienceWasShown(
119 profile_->GetPrefs()); 133 profile_->GetPrefs());
120 password_manager::metrics_util::LogAutoSigninPromoUserAction( 134 password_manager::metrics_util::LogAutoSigninPromoUserAction(
121 password_manager::metrics_util::AUTO_SIGNIN_OK_GOT_IT); 135 password_manager::metrics_util::AUTO_SIGNIN_OK_GOT_IT);
122 ResetDialog(); 136 ResetDialog();
123 OnCloseDialog(); 137 OnCloseDialog();
124 } 138 }
125 139
126 void PasswordDialogControllerImpl::OnAutoSigninTurnOff() { 140 void PasswordDialogControllerImpl::OnAutoSigninTurnOff() {
(...skipping 24 matching lines...) Expand all
151 void PasswordDialogControllerImpl::ResetDialog() { 165 void PasswordDialogControllerImpl::ResetDialog() {
152 if (account_chooser_dialog_) { 166 if (account_chooser_dialog_) {
153 account_chooser_dialog_->ControllerGone(); 167 account_chooser_dialog_->ControllerGone();
154 account_chooser_dialog_ = nullptr; 168 account_chooser_dialog_ = nullptr;
155 } 169 }
156 if (autosignin_dialog_) { 170 if (autosignin_dialog_) {
157 autosignin_dialog_->ControllerGone(); 171 autosignin_dialog_->ControllerGone();
158 autosignin_dialog_ = nullptr; 172 autosignin_dialog_ = nullptr;
159 } 173 }
160 } 174 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698