Commit fec24a71 authored by Dominic Battre's avatar Dominic Battre Committed by Commit Bot

Minor cleanups in the password manager

This CL contains two minor cleanups ins the password manager:

1. Rename ClearPasswordValues to MaybeClearPasswordValues because the function
   only clears password values in some cases which was not reflected in the
   function name and confused me a lot.
2. Delete some unused local variables. I hope that they are intentionally
   unused.

Bug: 831123
Change-Id: Iba308f48d13f6755b9cc1e6fb2cde19c5dc911f6
Reviewed-on: https://chromium-review.googlesource.com/c/1373761Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Dominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615927}
parent 8b9cd774
...@@ -73,7 +73,8 @@ void InitPasswordFormFillData( ...@@ -73,7 +73,8 @@ void InitPasswordFormFillData(
} }
} }
PasswordFormFillData ClearPasswordValues(const PasswordFormFillData& data) { PasswordFormFillData MaybeClearPasswordValues(
const PasswordFormFillData& data) {
// In case when there is a username on a page (for example in a hidden field), // In case when there is a username on a page (for example in a hidden field),
// credentials from |additional_logins| could be used for filling on load. So // credentials from |additional_logins| could be used for filling on load. So
// in case of filling on load nor |password_field| nor |additional_logins| // in case of filling on load nor |password_field| nor |additional_logins|
......
...@@ -91,9 +91,9 @@ void InitPasswordFormFillData( ...@@ -91,9 +91,9 @@ void InitPasswordFormFillData(
bool wait_for_username_before_autofill, bool wait_for_username_before_autofill,
PasswordFormFillData* result); PasswordFormFillData* result);
// Renderer needs to have only a password that should be autofilled, all other // If |data.wait_for_username| is set, the renderer does not need to receive
// passwords might be safety erased. // passwords, yet, and this function clears the password values from |data|.
PasswordFormFillData ClearPasswordValues(const PasswordFormFillData& data); PasswordFormFillData MaybeClearPasswordValues(const PasswordFormFillData& data);
} // namespace autofill } // namespace autofill
......
...@@ -69,7 +69,7 @@ void ContentPasswordManagerDriver::FillPasswordForm( ...@@ -69,7 +69,7 @@ void ContentPasswordManagerDriver::FillPasswordForm(
const autofill::PasswordFormFillData& form_data) { const autofill::PasswordFormFillData& form_data) {
password_autofill_manager_.OnAddPasswordFillData(form_data); password_autofill_manager_.OnAddPasswordFillData(form_data);
GetPasswordAutofillAgent()->FillPasswordForm( GetPasswordAutofillAgent()->FillPasswordForm(
autofill::ClearPasswordValues(form_data)); autofill::MaybeClearPasswordValues(form_data));
} }
void ContentPasswordManagerDriver::AllowPasswordGenerationForForm( void ContentPasswordManagerDriver::AllowPasswordGenerationForForm(
......
...@@ -383,7 +383,6 @@ bool PasswordAutofillManager::PreviewSuggestionForTest( ...@@ -383,7 +383,6 @@ bool PasswordAutofillManager::PreviewSuggestionForTest(
// PasswordAutofillManager, private: // PasswordAutofillManager, private:
bool PasswordAutofillManager::FillSuggestion(const base::string16& username) { bool PasswordAutofillManager::FillSuggestion(const base::string16& username) {
autofill::PasswordFormFillData fill_data;
autofill::PasswordAndRealm password_and_realm; autofill::PasswordAndRealm password_and_realm;
if (fill_data_ && GetPasswordAndRealmForUsername(username, *fill_data_, if (fill_data_ && GetPasswordAndRealmForUsername(username, *fill_data_,
&password_and_realm)) { &password_and_realm)) {
...@@ -400,7 +399,6 @@ bool PasswordAutofillManager::FillSuggestion(const base::string16& username) { ...@@ -400,7 +399,6 @@ bool PasswordAutofillManager::FillSuggestion(const base::string16& username) {
bool PasswordAutofillManager::PreviewSuggestion( bool PasswordAutofillManager::PreviewSuggestion(
const base::string16& username) { const base::string16& username) {
autofill::PasswordFormFillData fill_data;
autofill::PasswordAndRealm password_and_realm; autofill::PasswordAndRealm password_and_realm;
if (fill_data_ && GetPasswordAndRealmForUsername(username, *fill_data_, if (fill_data_ && GetPasswordAndRealmForUsername(username, *fill_data_,
&password_and_realm)) { &password_and_realm)) {
......
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