Commit b365ac65 authored by Vaclav Brozek's avatar Vaclav Brozek Committed by Commit Bot

Remove useless null check in AssemblePasswordForm

AssemblePasswordForm inside
components/password_manager/core/browser/form_parsing/form_parser.cc
currently gets a pointer to SignificantFields and checks it for being
null. However, it is never called with the pointer being null.

To clarify the code, this CL changes the AssemblePasswordForm
signature to expect a reference instead.

Bug: 883633
Change-Id: I2a81350836074ca60e925a2a0bd28b5fa0169281
Reviewed-on: https://chromium-review.googlesource.com/1235582Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Vaclav Brozek <vabr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592807}
parent df01eb75
...@@ -655,11 +655,11 @@ bool GetMayUsePrefilledPlaceholder( ...@@ -655,11 +655,11 @@ bool GetMayUsePrefilledPlaceholder(
// used to find fields that may have preffilled placeholders. // used to find fields that may have preffilled placeholders.
std::unique_ptr<PasswordForm> AssemblePasswordForm( std::unique_ptr<PasswordForm> AssemblePasswordForm(
const autofill::FormData& form_data, const autofill::FormData& form_data,
const SignificantFields* significant_fields, const SignificantFields& significant_fields,
autofill::ValueElementVector all_possible_passwords, autofill::ValueElementVector all_possible_passwords,
autofill::ValueElementVector all_possible_usernames, autofill::ValueElementVector all_possible_usernames,
const FormPredictions* form_predictions) { const FormPredictions* form_predictions) {
if (!significant_fields || !significant_fields->HasPasswords()) if (!significant_fields.HasPasswords())
return nullptr; return nullptr;
// Create the PasswordForm and set data not related to specific fields. // Create the PasswordForm and set data not related to specific fields.
...@@ -677,10 +677,10 @@ std::unique_ptr<PasswordForm> AssemblePasswordForm( ...@@ -677,10 +677,10 @@ std::unique_ptr<PasswordForm> AssemblePasswordForm(
result->blacklisted_by_user = false; result->blacklisted_by_user = false;
result->type = PasswordForm::TYPE_MANUAL; result->type = PasswordForm::TYPE_MANUAL;
result->username_may_use_prefilled_placeholder = result->username_may_use_prefilled_placeholder =
GetMayUsePrefilledPlaceholder(form_predictions, *significant_fields); GetMayUsePrefilledPlaceholder(form_predictions, significant_fields);
// Set data related to specific fields. // Set data related to specific fields.
SetFields(*significant_fields, result.get()); SetFields(significant_fields, result.get());
return result; return result;
} }
...@@ -765,7 +765,7 @@ std::unique_ptr<PasswordForm> ParseFormData( ...@@ -765,7 +765,7 @@ std::unique_ptr<PasswordForm> ParseFormData(
UsernameDetectionMethod::kCount); UsernameDetectionMethod::kCount);
return AssemblePasswordForm( return AssemblePasswordForm(
form_data, significant_fields.get(), std::move(all_possible_passwords), form_data, *significant_fields, std::move(all_possible_passwords),
std::move(all_possible_usernames), form_predictions); std::move(all_possible_usernames), form_predictions);
} }
......
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