| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_MANAGE_PASSWORDS_STATE_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_STATE_H_ |
| 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_STATE_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_STATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 void OnPendingPassword( | 46 void OnPendingPassword( |
| 47 std::unique_ptr<password_manager::PasswordFormManager> form_manager); | 47 std::unique_ptr<password_manager::PasswordFormManager> form_manager); |
| 48 | 48 |
| 49 // Move to PENDING_PASSWORD_UPDATE_STATE. | 49 // Move to PENDING_PASSWORD_UPDATE_STATE. |
| 50 void OnUpdatePassword( | 50 void OnUpdatePassword( |
| 51 std::unique_ptr<password_manager::PasswordFormManager> form_manager); | 51 std::unique_ptr<password_manager::PasswordFormManager> form_manager); |
| 52 | 52 |
| 53 // Move to CREDENTIAL_REQUEST_STATE. | 53 // Move to CREDENTIAL_REQUEST_STATE. |
| 54 void OnRequestCredentials( | 54 void OnRequestCredentials( |
| 55 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials, | 55 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials, |
| 56 std::vector<std::unique_ptr<autofill::PasswordForm>> federation_providers, | |
| 57 const GURL& origin); | 56 const GURL& origin); |
| 58 | 57 |
| 59 // Move to AUTO_SIGNIN_STATE. |local_forms| can't be empty. | 58 // Move to AUTO_SIGNIN_STATE. |local_forms| can't be empty. |
| 60 void OnAutoSignin( | 59 void OnAutoSignin( |
| 61 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, | 60 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, |
| 62 const GURL& origin); | 61 const GURL& origin); |
| 63 | 62 |
| 64 // Move to CONFIRMATION_STATE. | 63 // Move to CONFIRMATION_STATE. |
| 65 void OnAutomaticPasswordSave( | 64 void OnAutomaticPasswordSave( |
| 66 std::unique_ptr<password_manager::PasswordFormManager> form_manager); | 65 std::unique_ptr<password_manager::PasswordFormManager> form_manager); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void set_credentials_callback(const CredentialsCallback& callback) { | 102 void set_credentials_callback(const CredentialsCallback& callback) { |
| 104 credentials_callback_ = callback; | 103 credentials_callback_ = callback; |
| 105 } | 104 } |
| 106 | 105 |
| 107 // Current local forms. ManagePasswordsState is responsible for the forms. | 106 // Current local forms. ManagePasswordsState is responsible for the forms. |
| 108 const std::vector<std::unique_ptr<autofill::PasswordForm>>& GetCurrentForms() | 107 const std::vector<std::unique_ptr<autofill::PasswordForm>>& GetCurrentForms() |
| 109 const { | 108 const { |
| 110 return local_credentials_forms_; | 109 return local_credentials_forms_; |
| 111 } | 110 } |
| 112 | 111 |
| 113 // Current federated forms. | |
| 114 const std::vector<std::unique_ptr<autofill::PasswordForm>>& | |
| 115 federation_providers_forms() const { | |
| 116 return federation_providers_forms_; | |
| 117 } | |
| 118 | |
| 119 private: | 112 private: |
| 120 // Removes all the PasswordForms stored in this object. | 113 // Removes all the PasswordForms stored in this object. |
| 121 void ClearData(); | 114 void ClearData(); |
| 122 | 115 |
| 123 // Add |form| to the internal state. | 116 // Add |form| to the internal state. |
| 124 void AddForm(const autofill::PasswordForm& form); | 117 void AddForm(const autofill::PasswordForm& form); |
| 125 // Updates |form| in the internal state. | 118 // Updates |form| in the internal state. |
| 126 bool UpdateForm(const autofill::PasswordForm& form); | 119 bool UpdateForm(const autofill::PasswordForm& form); |
| 127 // Removes |form| from the internal state. | 120 // Removes |form| from the internal state. |
| 128 void DeleteForm(const autofill::PasswordForm& form); | 121 void DeleteForm(const autofill::PasswordForm& form); |
| 129 | 122 |
| 130 void SetState(password_manager::ui::State state); | 123 void SetState(password_manager::ui::State state); |
| 131 | 124 |
| 132 // The origin of the current page for which the state is stored. It's used to | 125 // The origin of the current page for which the state is stored. It's used to |
| 133 // determine which PasswordStore changes are applicable to the internal state. | 126 // determine which PasswordStore changes are applicable to the internal state. |
| 134 GURL origin_; | 127 GURL origin_; |
| 135 | 128 |
| 136 // Contains the password that was submitted. | 129 // Contains the password that was submitted. |
| 137 std::unique_ptr<password_manager::PasswordFormManager> form_manager_; | 130 std::unique_ptr<password_manager::PasswordFormManager> form_manager_; |
| 138 | 131 |
| 139 // Contains all the current forms. | 132 // Contains all the current forms. |
| 140 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials_forms_; | 133 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials_forms_; |
| 141 | 134 |
| 142 // Federation providers for the CREDENTIAL_REQUEST_STATE. | |
| 143 std::vector<std::unique_ptr<autofill::PasswordForm>> | |
| 144 federation_providers_forms_; | |
| 145 | |
| 146 // A callback to be invoked when user selects a credential. | 135 // A callback to be invoked when user selects a credential. |
| 147 CredentialsCallback credentials_callback_; | 136 CredentialsCallback credentials_callback_; |
| 148 | 137 |
| 149 // The current state of the password manager UI. | 138 // The current state of the password manager UI. |
| 150 password_manager::ui::State state_; | 139 password_manager::ui::State state_; |
| 151 | 140 |
| 152 // The client used for logging. | 141 // The client used for logging. |
| 153 password_manager::PasswordManagerClient* client_; | 142 password_manager::PasswordManagerClient* client_; |
| 154 | 143 |
| 155 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsState); | 144 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsState); |
| 156 }; | 145 }; |
| 157 | 146 |
| 158 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_STATE_H_ | 147 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_STATE_H_ |
| OLD | NEW |