| 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> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/autofill/content/common/autofill_agent.mojom.h" | 13 #include "components/autofill/content/common/autofill_agent.mojom.h" |
| 14 #include "components/autofill/content/common/autofill_driver.mojom.h" | 14 #include "components/autofill/content/common/autofill_driver.mojom.h" |
| 15 #include "components/autofill/content/renderer/autofill_agent.h" | 15 #include "components/autofill/content/renderer/autofill_agent.h" |
| 16 #include "components/autofill/content/renderer/password_form_conversion_utils.h" | 16 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
| 17 #include "components/autofill/content/renderer/provisionally_saved_password_form
.h" |
| 17 #include "components/autofill/core/common/form_data_predictions.h" | 18 #include "components/autofill/core/common/form_data_predictions.h" |
| 18 #include "components/autofill/core/common/password_form.h" | 19 #include "components/autofill/core/common/password_form.h" |
| 19 #include "components/autofill/core/common/password_form_field_prediction_map.h" | 20 #include "components/autofill/core/common/password_form_field_prediction_map.h" |
| 20 #include "components/autofill/core/common/password_form_fill_data.h" | 21 #include "components/autofill/core/common/password_form_fill_data.h" |
| 21 #include "content/public/renderer/render_frame_observer.h" | 22 #include "content/public/renderer/render_frame_observer.h" |
| 22 #include "content/public/renderer/render_view_observer.h" | 23 #include "content/public/renderer/render_view_observer.h" |
| 23 #include "mojo/public/cpp/bindings/binding.h" | 24 #include "mojo/public/cpp/bindings/binding.h" |
| 24 #include "third_party/WebKit/public/web/WebInputElement.h" | 25 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 25 | 26 |
| 26 namespace blink { | 27 namespace blink { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 PasswordInfo** password_info); | 233 PasswordInfo** password_info); |
| 233 | 234 |
| 234 // Invoked when the frame is closing. | 235 // Invoked when the frame is closing. |
| 235 void FrameClosing(); | 236 void FrameClosing(); |
| 236 | 237 |
| 237 // Clears the preview for the username and password fields, restoring both to | 238 // Clears the preview for the username and password fields, restoring both to |
| 238 // their previous filled state. | 239 // their previous filled state. |
| 239 void ClearPreview(blink::WebInputElement* username, | 240 void ClearPreview(blink::WebInputElement* username, |
| 240 blink::WebInputElement* password); | 241 blink::WebInputElement* password); |
| 241 | 242 |
| 242 // Saves |password_form| in |provisionally_saved_form_|, as long as it | 243 // Saves |password_form|, |form| and |input| in |provisionally_saved_form_|, |
| 243 // satisfies |restriction|. | 244 // as long as it satisfies |restriction|. |form| and |input| are the elements |
| 245 // user has just been interacting with before the form save. |form| or |input| |
| 246 // can be null but not both at the same time. For example: if the form is |
| 247 // unowned, |form| will be null; if the user has submitted the form, |input| |
| 248 // will be null. |
| 244 void ProvisionallySavePassword(std::unique_ptr<PasswordForm> password_form, | 249 void ProvisionallySavePassword(std::unique_ptr<PasswordForm> password_form, |
| 250 const blink::WebFormElement& form, |
| 251 const blink::WebInputElement& input, |
| 245 ProvisionallySaveRestriction restriction); | 252 ProvisionallySaveRestriction restriction); |
| 246 | 253 |
| 247 // Returns true if |provisionally_saved_form_| has enough information that | |
| 248 // it is likely filled out. | |
| 249 bool ProvisionallySavedPasswordIsValid(); | |
| 250 | |
| 251 // Helper function called when in-page navigation completed | 254 // Helper function called when in-page navigation completed |
| 252 void OnSamePageNavigationCompleted(); | 255 void OnSamePageNavigationCompleted(); |
| 253 | 256 |
| 254 const mojom::AutofillDriverPtr& GetAutofillDriver(); | 257 const mojom::AutofillDriverPtr& GetAutofillDriver(); |
| 255 | 258 |
| 256 // The logins we have filled so far with their associated info. | 259 // The logins we have filled so far with their associated info. |
| 257 WebInputToPasswordInfoMap web_input_to_password_info_; | 260 WebInputToPasswordInfoMap web_input_to_password_info_; |
| 258 // A (sort-of) reverse map to |login_to_password_info_|. | 261 // A (sort-of) reverse map to |login_to_password_info_|. |
| 259 PasswordToLoginMap password_to_username_; | 262 PasswordToLoginMap password_to_username_; |
| 260 | 263 |
| 261 // Set if the user might be submitting a password form on the current page, | 264 // Set if the user might be submitting a password form on the current page, |
| 262 // but the submit may still fail (i.e. doesn't pass JavaScript validation). | 265 // but the submit may still fail (i.e. doesn't pass JavaScript validation). |
| 263 std::unique_ptr<PasswordForm> provisionally_saved_form_; | 266 ProvisionallySavedPasswordForm provisionally_saved_form_; |
| 264 | 267 |
| 265 // Map WebFormControlElement to the pair of: | 268 // Map WebFormControlElement to the pair of: |
| 266 // 1) The most recent text that user typed or PasswordManager autofilled in | 269 // 1) The most recent text that user typed or PasswordManager autofilled in |
| 267 // input elements. Used for storing username/password before JavaScript | 270 // input elements. Used for storing username/password before JavaScript |
| 268 // changes them. | 271 // changes them. |
| 269 // 2) Field properties mask, i.e. whether the field was autofilled, modified | 272 // 2) Field properties mask, i.e. whether the field was autofilled, modified |
| 270 // by user, etc. (see FieldPropertiesMask). | 273 // by user, etc. (see FieldPropertiesMask). |
| 271 FieldValueAndPropertiesMaskMap field_value_and_properties_map_; | 274 FieldValueAndPropertiesMaskMap field_value_and_properties_map_; |
| 272 | 275 |
| 273 PasswordValueGatekeeper gatekeeper_; | 276 PasswordValueGatekeeper gatekeeper_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 292 mojom::PasswordManagerDriverPtr password_manager_driver_; | 295 mojom::PasswordManagerDriverPtr password_manager_driver_; |
| 293 | 296 |
| 294 mojo::Binding<mojom::PasswordAutofillAgent> binding_; | 297 mojo::Binding<mojom::PasswordAutofillAgent> binding_; |
| 295 | 298 |
| 296 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 299 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
| 297 }; | 300 }; |
| 298 | 301 |
| 299 } // namespace autofill | 302 } // namespace autofill |
| 300 | 303 |
| 301 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 304 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
| OLD | NEW |