| OLD | NEW |
| 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 25 matching lines...) Expand all Loading... |
| 36 account_chooser_dialog_(nullptr), | 36 account_chooser_dialog_(nullptr), |
| 37 autosignin_dialog_(nullptr) { | 37 autosignin_dialog_(nullptr) { |
| 38 } | 38 } |
| 39 | 39 |
| 40 PasswordDialogControllerImpl::~PasswordDialogControllerImpl() { | 40 PasswordDialogControllerImpl::~PasswordDialogControllerImpl() { |
| 41 ResetDialog(); | 41 ResetDialog(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void PasswordDialogControllerImpl::ShowAccountChooser( | 44 void PasswordDialogControllerImpl::ShowAccountChooser( |
| 45 AccountChooserPrompt* dialog, | 45 AccountChooserPrompt* dialog, |
| 46 std::vector<std::unique_ptr<autofill::PasswordForm>> locals, | 46 std::vector<std::unique_ptr<autofill::PasswordForm>> locals) { |
| 47 std::vector<std::unique_ptr<autofill::PasswordForm>> federations) { | |
| 48 DCHECK(!account_chooser_dialog_); | 47 DCHECK(!account_chooser_dialog_); |
| 49 DCHECK(!autosignin_dialog_); | 48 DCHECK(!autosignin_dialog_); |
| 50 DCHECK(dialog); | 49 DCHECK(dialog); |
| 51 local_credentials_.swap(locals); | 50 local_credentials_.swap(locals); |
| 52 federated_credentials_.swap(federations); | |
| 53 account_chooser_dialog_ = dialog; | 51 account_chooser_dialog_ = dialog; |
| 54 account_chooser_dialog_->ShowAccountChooser(); | 52 account_chooser_dialog_->ShowAccountChooser(); |
| 55 } | 53 } |
| 56 | 54 |
| 57 void PasswordDialogControllerImpl::ShowAutosigninPrompt( | 55 void PasswordDialogControllerImpl::ShowAutosigninPrompt( |
| 58 AutoSigninFirstRunPrompt* dialog) { | 56 AutoSigninFirstRunPrompt* dialog) { |
| 59 DCHECK(!account_chooser_dialog_); | 57 DCHECK(!account_chooser_dialog_); |
| 60 DCHECK(!autosignin_dialog_); | 58 DCHECK(!autosignin_dialog_); |
| 61 DCHECK(dialog); | 59 DCHECK(dialog); |
| 62 autosignin_dialog_ = dialog; | 60 autosignin_dialog_ = dialog; |
| 63 autosignin_dialog_->ShowAutoSigninPrompt(); | 61 autosignin_dialog_->ShowAutoSigninPrompt(); |
| 64 } | 62 } |
| 65 | 63 |
| 66 const PasswordDialogController::FormsVector& | 64 const PasswordDialogController::FormsVector& |
| 67 PasswordDialogControllerImpl::GetLocalForms() const { | 65 PasswordDialogControllerImpl::GetLocalForms() const { |
| 68 return local_credentials_; | 66 return local_credentials_; |
| 69 } | 67 } |
| 70 | 68 |
| 71 const PasswordDialogController::FormsVector& | |
| 72 PasswordDialogControllerImpl::GetFederationsForms() const { | |
| 73 return federated_credentials_; | |
| 74 } | |
| 75 | |
| 76 std::pair<base::string16, gfx::Range> | 69 std::pair<base::string16, gfx::Range> |
| 77 PasswordDialogControllerImpl::GetAccoutChooserTitle() const { | 70 PasswordDialogControllerImpl::GetAccoutChooserTitle() const { |
| 78 std::pair<base::string16, gfx::Range> result; | 71 std::pair<base::string16, gfx::Range> result; |
| 79 GetAccountChooserDialogTitleTextAndLinkRange( | 72 GetAccountChooserDialogTitleTextAndLinkRange( |
| 80 IsSmartLockBrandingEnabled(profile_), | 73 IsSmartLockBrandingEnabled(profile_), |
| 81 local_credentials_.size() > 1, | 74 local_credentials_.size() > 1, |
| 82 &result.first, | 75 &result.first, |
| 83 &result.second); | 76 &result.second); |
| 84 return result; | 77 return result; |
| 85 } | 78 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 void PasswordDialogControllerImpl::ResetDialog() { | 168 void PasswordDialogControllerImpl::ResetDialog() { |
| 176 if (account_chooser_dialog_) { | 169 if (account_chooser_dialog_) { |
| 177 account_chooser_dialog_->ControllerGone(); | 170 account_chooser_dialog_->ControllerGone(); |
| 178 account_chooser_dialog_ = nullptr; | 171 account_chooser_dialog_ = nullptr; |
| 179 } | 172 } |
| 180 if (autosignin_dialog_) { | 173 if (autosignin_dialog_) { |
| 181 autosignin_dialog_->ControllerGone(); | 174 autosignin_dialog_->ControllerGone(); |
| 182 autosignin_dialog_ = nullptr; | 175 autosignin_dialog_ = nullptr; |
| 183 } | 176 } |
| 184 } | 177 } |
| OLD | NEW |