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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "components/autofill/core/common/password_form.h" | 12 #include "components/autofill/core/common/password_form.h" |
13 #include "components/password_manager/core/browser/password_store_change.h" | 13 #include "components/password_manager/core/browser/password_store_change.h" |
14 #include "components/password_manager/core/common/password_manager_ui.h" | 14 #include "components/password_manager/core/common/password_manager_ui.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
| 17 namespace content { |
| 18 class WebContents; |
| 19 } |
| 20 |
17 namespace password_manager { | 21 namespace password_manager { |
18 struct CredentialInfo; | 22 struct CredentialInfo; |
19 class PasswordFormManager; | 23 class PasswordFormManager; |
20 class PasswordManagerClient; | |
21 } | 24 } |
22 | 25 |
23 | 26 |
24 // ManagePasswordsState keeps the current state for ManagePasswordsUIController | 27 // ManagePasswordsState keeps the current state for ManagePasswordsUIController |
25 // as well as up-to-date data for this state. | 28 // as well as up-to-date data for this state. |
26 class ManagePasswordsState { | 29 class ManagePasswordsState { |
27 public: | 30 public: |
28 using CredentialsCallback = | 31 using CredentialsCallback = |
29 base::Callback<void(const password_manager::CredentialInfo&)>; | 32 base::Callback<void(const password_manager::CredentialInfo&)>; |
30 | 33 |
31 ManagePasswordsState(); | 34 ManagePasswordsState(); |
32 ~ManagePasswordsState(); | 35 ~ManagePasswordsState(); |
33 | 36 |
34 // Set the client for logging. | 37 void set_web_content(content::WebContents* web_contents) { |
35 void set_client(password_manager::PasswordManagerClient* client) { | 38 web_contents_ = web_contents; |
36 client_ = client; | |
37 } | 39 } |
38 | 40 |
39 // The methods below discard the current state/data of the object and move it | 41 // The methods below discard the current state/data of the object and move it |
40 // to the specified state. | 42 // to the specified state. |
41 | 43 |
42 // Move to PENDING_PASSWORD_STATE. | 44 // Move to PENDING_PASSWORD_STATE. |
43 void OnPendingPassword( | 45 void OnPendingPassword( |
44 scoped_ptr<password_manager::PasswordFormManager> form_manager); | 46 scoped_ptr<password_manager::PasswordFormManager> form_manager); |
45 | 47 |
46 // Move to CREDENTIAL_REQUEST_STATE. | 48 // Move to CREDENTIAL_REQUEST_STATE. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 133 |
132 // Federated credentials for the CREDENTIAL_REQUEST_STATE. | 134 // Federated credentials for the CREDENTIAL_REQUEST_STATE. |
133 ScopedVector<const autofill::PasswordForm> federated_credentials_forms_; | 135 ScopedVector<const autofill::PasswordForm> federated_credentials_forms_; |
134 | 136 |
135 // A callback to be invoked when user selects a credential. | 137 // A callback to be invoked when user selects a credential. |
136 CredentialsCallback credentials_callback_; | 138 CredentialsCallback credentials_callback_; |
137 | 139 |
138 // The current state of the password manager UI. | 140 // The current state of the password manager UI. |
139 password_manager::ui::State state_; | 141 password_manager::ui::State state_; |
140 | 142 |
141 // The client used for logging. | 143 // Used to retrieve the client for logging. |
142 password_manager::PasswordManagerClient* client_; | 144 content::WebContents* web_contents_; |
143 | 145 |
144 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsState); | 146 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsState); |
145 }; | 147 }; |
146 | 148 |
147 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_STATE_H_ | 149 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_STATE_H_ |
OLD | NEW |