OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // Called when the focused node has changed. | 140 // Called when the focused node has changed. |
141 void FocusedNodeHasChanged(const blink::WebNode& node); | 141 void FocusedNodeHasChanged(const blink::WebNode& node); |
142 | 142 |
143 bool logging_state_active() const { return logging_state_active_; } | 143 bool logging_state_active() const { return logging_state_active_; } |
144 | 144 |
145 protected: | 145 protected: |
146 virtual bool OriginCanAccessPasswordManager( | 146 virtual bool OriginCanAccessPasswordManager( |
147 const blink::WebSecurityOrigin& origin); | 147 const blink::WebSecurityOrigin& origin); |
148 | 148 |
149 private: | 149 private: |
| 150 class FormElementObserver; |
| 151 |
150 // Ways to restrict which passwords are saved in ProvisionallySavePassword. | 152 // Ways to restrict which passwords are saved in ProvisionallySavePassword. |
151 enum ProvisionallySaveRestriction { | 153 enum ProvisionallySaveRestriction { |
152 RESTRICTION_NONE, | 154 RESTRICTION_NONE, |
153 RESTRICTION_NON_EMPTY_PASSWORD | 155 RESTRICTION_NON_EMPTY_PASSWORD |
154 }; | 156 }; |
155 | 157 |
156 struct PasswordInfo { | 158 struct PasswordInfo { |
157 blink::WebInputElement password_field; | 159 blink::WebInputElement password_field; |
158 PasswordFormFillData fill_data; | 160 PasswordFormFillData fill_data; |
159 // The user manually edited the password more recently than the username was | 161 // The user manually edited the password more recently than the username was |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // user has just been interacting with before the form save. |form| or |input| | 253 // user has just been interacting with before the form save. |form| or |input| |
252 // can be null but not both at the same time. For example: if the form is | 254 // can be null but not both at the same time. For example: if the form is |
253 // unowned, |form| will be null; if the user has submitted the form, |input| | 255 // unowned, |form| will be null; if the user has submitted the form, |input| |
254 // will be null. | 256 // will be null. |
255 void ProvisionallySavePassword(std::unique_ptr<PasswordForm> password_form, | 257 void ProvisionallySavePassword(std::unique_ptr<PasswordForm> password_form, |
256 const blink::WebFormElement& form, | 258 const blink::WebFormElement& form, |
257 const blink::WebInputElement& input, | 259 const blink::WebInputElement& input, |
258 ProvisionallySaveRestriction restriction); | 260 ProvisionallySaveRestriction restriction); |
259 | 261 |
260 // Helper function called when same-document navigation completed | 262 // Helper function called when same-document navigation completed |
261 void OnSameDocumentNavigationCompleted(bool is_inpage_navigation); | 263 void OnSameDocumentNavigationCompleted( |
| 264 PasswordForm::SubmissionIndicatorEvent event); |
262 | 265 |
263 const mojom::AutofillDriverPtr& GetAutofillDriver(); | 266 const mojom::AutofillDriverPtr& GetAutofillDriver(); |
264 | 267 |
265 // The logins we have filled so far with their associated info. | 268 // The logins we have filled so far with their associated info. |
266 WebInputToPasswordInfoMap web_input_to_password_info_; | 269 WebInputToPasswordInfoMap web_input_to_password_info_; |
267 // A (sort-of) reverse map to |login_to_password_info_|. | 270 // A (sort-of) reverse map to |login_to_password_info_|. |
268 PasswordToLoginMap password_to_username_; | 271 PasswordToLoginMap password_to_username_; |
269 | 272 |
270 // Set if the user might be submitting a password form on the current page, | 273 // Set if the user might be submitting a password form on the current page, |
271 // but the submit may still fail (i.e. doesn't pass JavaScript validation). | 274 // but the submit may still fail (i.e. doesn't pass JavaScript validation). |
(...skipping 29 matching lines...) Expand all Loading... |
301 // Contains server predictions for username, password and/or new password | 304 // Contains server predictions for username, password and/or new password |
302 // fields for individual forms. | 305 // fields for individual forms. |
303 FormsPredictionsMap form_predictions_; | 306 FormsPredictionsMap form_predictions_; |
304 | 307 |
305 AutofillAgent* autofill_agent_; // Weak reference. | 308 AutofillAgent* autofill_agent_; // Weak reference. |
306 | 309 |
307 mojom::PasswordManagerDriverPtr password_manager_driver_; | 310 mojom::PasswordManagerDriverPtr password_manager_driver_; |
308 | 311 |
309 mojo::Binding<mojom::PasswordAutofillAgent> binding_; | 312 mojo::Binding<mojom::PasswordAutofillAgent> binding_; |
310 | 313 |
| 314 FormElementObserver* form_element_observer_; // Weak reference. |
| 315 |
311 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 316 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
312 }; | 317 }; |
313 | 318 |
314 } // namespace autofill | 319 } // namespace autofill |
315 | 320 |
316 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 321 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |