| 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 #ifndef CHROME_BROWSER_UI_PASSWORDS_PASSWORD_DIALOG_CONTROLLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_PASSWORD_DIALOG_CONTROLLER_IMPL_H_ |
| 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORD_DIALOG_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORD_DIALOG_CONTROLLER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/ui/passwords/password_dialog_controller.h" | 12 #include "chrome/browser/ui/passwords/password_dialog_controller.h" |
| 13 | 13 |
| 14 class AccountChooserPrompt; | 14 class AccountChooserPrompt; |
| 15 class AutoSigninFirstRunPrompt; | 15 class AutoSigninFirstRunPrompt; |
| 16 class PasswordsModelDelegate; | 16 class PasswordsModelDelegate; |
| 17 class Profile; | 17 class Profile; |
| 18 | 18 |
| 19 // A UI controller responsible for the account chooser dialog and autosignin | 19 // A UI controller responsible for the account chooser dialog and autosignin |
| 20 // first run promo. | 20 // first run promo. |
| 21 class PasswordDialogControllerImpl : public PasswordDialogController { | 21 class PasswordDialogControllerImpl : public PasswordDialogController { |
| 22 public: | 22 public: |
| 23 PasswordDialogControllerImpl(Profile* profle, | 23 PasswordDialogControllerImpl(Profile* profle, |
| 24 PasswordsModelDelegate* delegate); | 24 PasswordsModelDelegate* delegate); |
| 25 ~PasswordDialogControllerImpl() override; | 25 ~PasswordDialogControllerImpl() override; |
| 26 | 26 |
| 27 // Pop up the account chooser dialog. | 27 // Pop up the account chooser dialog. |
| 28 void ShowAccountChooser(AccountChooserPrompt* dialog, | 28 void ShowAccountChooser(AccountChooserPrompt* dialog, FormsVector locals); |
| 29 FormsVector locals, FormsVector federations); | |
| 30 | 29 |
| 31 // Pop up the autosignin first run dialog. | 30 // Pop up the autosignin first run dialog. |
| 32 void ShowAutosigninPrompt(AutoSigninFirstRunPrompt* dialog); | 31 void ShowAutosigninPrompt(AutoSigninFirstRunPrompt* dialog); |
| 33 | 32 |
| 34 bool IsShowingAccountChooser() const { return !!account_chooser_dialog_; } | 33 bool IsShowingAccountChooser() const { return !!account_chooser_dialog_; } |
| 35 | 34 |
| 36 // PasswordDialogController: | 35 // PasswordDialogController: |
| 37 const FormsVector& GetLocalForms() const override; | 36 const FormsVector& GetLocalForms() const override; |
| 38 const FormsVector& GetFederationsForms() const override; | |
| 39 std::pair<base::string16, gfx::Range> GetAccoutChooserTitle() const override; | 37 std::pair<base::string16, gfx::Range> GetAccoutChooserTitle() const override; |
| 40 bool ShouldShowSignInButton() const override; | 38 bool ShouldShowSignInButton() const override; |
| 41 base::string16 GetAutoSigninPromoTitle() const override; | 39 base::string16 GetAutoSigninPromoTitle() const override; |
| 42 std::pair<base::string16, gfx::Range> GetAutoSigninText() const override; | 40 std::pair<base::string16, gfx::Range> GetAutoSigninText() const override; |
| 43 void OnSmartLockLinkClicked() override; | 41 void OnSmartLockLinkClicked() override; |
| 44 void OnChooseCredentials( | 42 void OnChooseCredentials( |
| 45 const autofill::PasswordForm& password_form, | 43 const autofill::PasswordForm& password_form, |
| 46 password_manager::CredentialType credential_type) override; | 44 password_manager::CredentialType credential_type) override; |
| 47 void OnSignInClicked() override; | 45 void OnSignInClicked() override; |
| 48 void OnAutoSigninOK() override; | 46 void OnAutoSigninOK() override; |
| 49 void OnAutoSigninTurnOff() override; | 47 void OnAutoSigninTurnOff() override; |
| 50 void OnCloseDialog() override; | 48 void OnCloseDialog() override; |
| 51 | 49 |
| 52 private: | 50 private: |
| 53 // Release |current_dialog_| and close the open dialog. | 51 // Release |current_dialog_| and close the open dialog. |
| 54 void ResetDialog(); | 52 void ResetDialog(); |
| 55 | 53 |
| 56 Profile* const profile_; | 54 Profile* const profile_; |
| 57 PasswordsModelDelegate* const delegate_; | 55 PasswordsModelDelegate* const delegate_; |
| 58 AccountChooserPrompt* account_chooser_dialog_; | 56 AccountChooserPrompt* account_chooser_dialog_; |
| 59 AutoSigninFirstRunPrompt* autosignin_dialog_; | 57 AutoSigninFirstRunPrompt* autosignin_dialog_; |
| 60 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials_; | 58 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials_; |
| 61 std::vector<std::unique_ptr<autofill::PasswordForm>> federated_credentials_; | |
| 62 | 59 |
| 63 DISALLOW_COPY_AND_ASSIGN(PasswordDialogControllerImpl); | 60 DISALLOW_COPY_AND_ASSIGN(PasswordDialogControllerImpl); |
| 64 }; | 61 }; |
| 65 | 62 |
| 66 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORD_DIALOG_CONTROLLER_IMPL_H_ | 63 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORD_DIALOG_CONTROLLER_IMPL_H_ |
| OLD | NEW |