Commit 794343ab authored by Vadym Doroshenko's avatar Vadym Doroshenko Committed by Commit Bot

Refactoring: simplifying passwords filling code 1.

Context: code for filling passwords in DOM is very convoluted. For username
first flow, we need to fill only usernames, which is hard to do in the current
setup. Let's refactor!

This CL contains:
1.FillFormOnPasswordReceived is removed. It basically delegates filling to
FillUserNameAndPassword, which is used now.
2.Checking origin of parent frames moved to a helper method.
3.2 arguments removed from FillUserNameAndPassword, they may be computed from
other args anyway.

The further CL will contain more simplification to FillUserNameAndPassword.

Bug: 875768, 959776

Change-Id: Id1658401a8ec683a1a8db1117e816fe87f7dbaae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1738554Reviewed-by: default avatarMaxim Kolosovskiy <kolos@chromium.org>
Commit-Queue: Vadym Doroshenko <dvadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684338}
parent ad439ec4
...@@ -393,14 +393,11 @@ class PasswordAutofillAgent : public content::RenderFrameObserver, ...@@ -393,14 +393,11 @@ class PasswordAutofillAgent : public content::RenderFrameObserver,
// with values from |fill_data|. The |username_element| and |password_element| // with values from |fill_data|. The |username_element| and |password_element|
// will only have the suggestedValue set. If a match is found, return true and // will only have the suggestedValue set. If a match is found, return true and
// |field_data_manager| will be modified with the autofilled credentials and // |field_data_manager| will be modified with the autofilled credentials and
// |FieldPropertiesFlags::AUTOFILLED| flag. // |FieldPropertiesFlags::AUTOFILLED| flag. Returns true if the password is
// If |username_may_use_prefilled_placeholder| then this function may // filled.
// overwrite the value of username field. bool FillUserNameAndPassword(blink::WebInputElement username_element,
bool FillUserNameAndPassword(blink::WebInputElement* username_element, blink::WebInputElement password_element,
blink::WebInputElement* password_element,
const PasswordFormFillData& fill_data, const PasswordFormFillData& fill_data,
bool exact_username_match,
bool username_may_use_prefilled_placeholder,
FieldDataManager* field_data_manager, FieldDataManager* field_data_manager,
RendererSavePasswordProgressLogger* logger); RendererSavePasswordProgressLogger* logger);
...@@ -409,18 +406,6 @@ class PasswordAutofillAgent : public content::RenderFrameObserver, ...@@ -409,18 +406,6 @@ class PasswordAutofillAgent : public content::RenderFrameObserver,
// only one value per |PasswordAutofillAgent| instance. // only one value per |PasswordAutofillAgent| instance.
void LogPrefilledUsernameFillOutcome(PrefilledUsernameFillOutcome outcome); void LogPrefilledUsernameFillOutcome(PrefilledUsernameFillOutcome outcome);
// Attempts to fill |username_element| and |password_element| with the
// |fill_data|. Will use the data corresponding to the preferred username,
// unless the |username_element| already has a value set. In that case,
// attempts to fill the password matching the already filled username, if
// such a password exists. The |password_element| will have the
// |suggestedValue| set. Returns true if the password is filled.
bool FillFormOnPasswordReceived(const PasswordFormFillData& fill_data,
blink::WebInputElement username_element,
blink::WebInputElement password_element,
FieldDataManager* field_data_manager,
RendererSavePasswordProgressLogger* logger);
// Helper function called when form submission is successful. // Helper function called when form submission is successful.
void FireSubmissionIfFormDisappear(mojom::SubmissionIndicatorEvent event); void FireSubmissionIfFormDisappear(mojom::SubmissionIndicatorEvent event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment