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 26 matching lines...) Expand all Loading... |
37 // The embedder of this class has to set the client for logging. | 37 // The embedder of this class has to set the client for logging. |
38 void set_client(password_manager::PasswordManagerClient* client) { | 38 void set_client(password_manager::PasswordManagerClient* client) { |
39 client_ = client; | 39 client_ = client; |
40 } | 40 } |
41 | 41 |
42 // The methods below discard the current state/data of the object and move it | 42 // The methods below discard the current state/data of the object and move it |
43 // to the specified state. | 43 // to the specified state. |
44 | 44 |
45 // Move to PENDING_PASSWORD_STATE. | 45 // Move to PENDING_PASSWORD_STATE. |
46 void OnPendingPassword( | 46 void OnPendingPassword( |
47 std::unique_ptr<password_manager::PasswordFormManager> form_manager); | 47 scoped_refptr<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 scoped_refptr<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 const GURL& origin); | 56 const GURL& origin); |
57 | 57 |
58 // Move to AUTO_SIGNIN_STATE. |local_forms| can't be empty. | 58 // Move to AUTO_SIGNIN_STATE. |local_forms| can't be empty. |
59 void OnAutoSignin( | 59 void OnAutoSignin( |
60 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, | 60 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, |
61 const GURL& origin); | 61 const GURL& origin); |
62 | 62 |
63 // Move to CONFIRMATION_STATE. | 63 // Move to CONFIRMATION_STATE. |
64 void OnAutomaticPasswordSave( | 64 void OnAutomaticPasswordSave( |
65 std::unique_ptr<password_manager::PasswordFormManager> form_manager); | 65 scoped_refptr<password_manager::PasswordFormManager> form_manager); |
66 | 66 |
67 // Move to MANAGE_STATE or INACTIVE_STATE for PSL matched passwords. | 67 // Move to MANAGE_STATE or INACTIVE_STATE for PSL matched passwords. |
68 // |password_form_map| contains best matches from the password store for the | 68 // |password_form_map| contains best matches from the password store for the |
69 // form which was autofilled, |origin| is an origin of the form which was | 69 // form which was autofilled, |origin| is an origin of the form which was |
70 // autofilled. In addition, |federated_matches|, if not null, contains stored | 70 // autofilled. In addition, |federated_matches|, if not null, contains stored |
71 // federated credentials to show to the user as well. | 71 // federated credentials to show to the user as well. |
72 void OnPasswordAutofilled( | 72 void OnPasswordAutofilled( |
73 const std::map<base::string16, const autofill::PasswordForm*>& | 73 const std::map<base::string16, const autofill::PasswordForm*>& |
74 password_form_map, | 74 password_form_map, |
75 const GURL& origin, | 75 const GURL& origin, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Removes |form| from the internal state. | 120 // Removes |form| from the internal state. |
121 void DeleteForm(const autofill::PasswordForm& form); | 121 void DeleteForm(const autofill::PasswordForm& form); |
122 | 122 |
123 void SetState(password_manager::ui::State state); | 123 void SetState(password_manager::ui::State state); |
124 | 124 |
125 // 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 |
126 // determine which PasswordStore changes are applicable to the internal state. | 126 // determine which PasswordStore changes are applicable to the internal state. |
127 GURL origin_; | 127 GURL origin_; |
128 | 128 |
129 // Contains the password that was submitted. | 129 // Contains the password that was submitted. |
130 std::unique_ptr<password_manager::PasswordFormManager> form_manager_; | 130 scoped_refptr<password_manager::PasswordFormManager> form_manager_; |
131 | 131 |
132 // Contains all the current forms. | 132 // Contains all the current forms. |
133 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials_forms_; | 133 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials_forms_; |
134 | 134 |
135 // A callback to be invoked when user selects a credential. | 135 // A callback to be invoked when user selects a credential. |
136 CredentialsCallback credentials_callback_; | 136 CredentialsCallback credentials_callback_; |
137 | 137 |
138 // The current state of the password manager UI. | 138 // The current state of the password manager UI. |
139 password_manager::ui::State state_; | 139 password_manager::ui::State state_; |
140 | 140 |
141 // The client used for logging. | 141 // The client used for logging. |
142 password_manager::PasswordManagerClient* client_; | 142 password_manager::PasswordManagerClient* client_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsState); | 144 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsState); |
145 }; | 145 }; |
146 | 146 |
147 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_STATE_H_ | 147 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_STATE_H_ |
OLD | NEW |