Commit c1dbfd39 authored by sandromaggi's avatar sandromaggi Committed by Commit Bot

[Autofill Assistant] Remove deprecated flag

It appears that this flag has lost its meaning. Removing
it.

Also unsubscribing from further PDM changes once the callback
is called.

Bug: b/168445878
Change-Id: I0222043e53070fde7a36ba507d6ed95b4d082d3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414395
Commit-Queue: Sandro Maggi <sandromaggi@google.com>
Reviewed-by: default avatarClemens Arbesser <arbesser@google.com>
Reviewed-by: default avatarMathias Carlen <mcarlen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808829}
parent 931ac59b
...@@ -513,7 +513,6 @@ void CollectUserDataAction::OnShowToUser(UserData* user_data, ...@@ -513,7 +513,6 @@ void CollectUserDataAction::OnShowToUser(UserData* user_data,
// merge the new proto_ into the existing user_data. the proto_ always takes // merge the new proto_ into the existing user_data. the proto_ always takes
// precedence over the existing user_data. // precedence over the existing user_data.
*field_change = UserData::FieldChange::ALL; *field_change = UserData::FieldChange::ALL;
user_data->succeed_ = false;
auto collect_user_data = proto_.collect_user_data(); auto collect_user_data = proto_.collect_user_data();
// the backend should explicitly set the terms and conditions state on every // the backend should explicitly set the terms and conditions state on every
// new action. // new action.
...@@ -565,7 +564,6 @@ void CollectUserDataAction::OnShowToUser(UserData* user_data, ...@@ -565,7 +564,6 @@ void CollectUserDataAction::OnShowToUser(UserData* user_data,
// made implicitly, the entire UI will not be shown and the action will // made implicitly, the entire UI will not be shown and the action will
// complete immediately. // complete immediately.
if (OnlyLoginRequested(*collect_user_data_options_)) { if (OnlyLoginRequested(*collect_user_data_options_)) {
user_data->succeed_ = true;
std::move(collect_user_data_options_->confirm_callback) std::move(collect_user_data_options_->confirm_callback)
.Run(user_data, nullptr); .Run(user_data, nullptr);
return; return;
...@@ -617,16 +615,12 @@ void CollectUserDataAction::OnGetUserData( ...@@ -617,16 +615,12 @@ void CollectUserDataAction::OnGetUserData(
const UserModel* user_model) { const UserModel* user_model) {
if (!callback_) if (!callback_)
return; return;
delegate_->GetPersonalDataManager()->RemoveObserver(this);
bool succeed = user_data->succeed_; WriteProcessedAction(user_data, user_model);
if (succeed) { DCHECK(
succeed = IsUserDataComplete(*user_data, *user_model, IsUserDataComplete(*user_data, *user_model, *collect_user_data_options_));
*collect_user_data_options_); EndAction(ClientStatus(ACTION_APPLIED));
WriteProcessedAction(user_data, user_model);
}
EndAction(succeed ? ClientStatus(ACTION_APPLIED)
: ClientStatus(COLLECT_USER_DATA_ERROR));
} }
void CollectUserDataAction::OnAdditionalActionTriggered( void CollectUserDataAction::OnAdditionalActionTriggered(
...@@ -635,6 +629,7 @@ void CollectUserDataAction::OnAdditionalActionTriggered( ...@@ -635,6 +629,7 @@ void CollectUserDataAction::OnAdditionalActionTriggered(
const UserModel* user_model) { const UserModel* user_model) {
if (!callback_) if (!callback_)
return; return;
delegate_->GetPersonalDataManager()->RemoveObserver(this);
processed_action_proto_->mutable_collect_user_data_result() processed_action_proto_->mutable_collect_user_data_result()
->set_additional_action_index(index); ->set_additional_action_index(index);
...@@ -648,6 +643,7 @@ void CollectUserDataAction::OnTermsAndConditionsLinkClicked( ...@@ -648,6 +643,7 @@ void CollectUserDataAction::OnTermsAndConditionsLinkClicked(
const UserModel* user_model) { const UserModel* user_model) {
if (!callback_) if (!callback_)
return; return;
delegate_->GetPersonalDataManager()->RemoveObserver(this);
processed_action_proto_->mutable_collect_user_data_result()->set_terms_link( processed_action_proto_->mutable_collect_user_data_result()->set_terms_link(
link); link);
......
...@@ -1255,11 +1255,6 @@ void Controller::OnCollectUserDataContinueButtonClicked() { ...@@ -1255,11 +1255,6 @@ void Controller::OnCollectUserDataContinueButtonClicked() {
auto callback = std::move(collect_user_data_options_->confirm_callback); auto callback = std::move(collect_user_data_options_->confirm_callback);
// TODO(crbug.com/806868): succeed is currently always true, but we might want
// to set it to false and propagate the result to CollectUserDataAction
// when the user clicks "Cancel" during that action.
user_data_->succeed_ = true;
SetCollectUserDataOptions(nullptr); SetCollectUserDataOptions(nullptr);
std::move(callback).Run(user_data_.get(), &user_model_); std::move(callback).Run(user_data_.get(), &user_model_);
} }
......
...@@ -108,7 +108,6 @@ class UserData { ...@@ -108,7 +108,6 @@ class UserData {
AVAILABLE_PAYMENT_INSTRUMENTS, AVAILABLE_PAYMENT_INSTRUMENTS,
}; };
bool succeed_ = false;
std::unique_ptr<autofill::CreditCard> selected_card_; std::unique_ptr<autofill::CreditCard> selected_card_;
std::string login_choice_identifier_; std::string login_choice_identifier_;
TermsAndConditionsState terms_and_conditions_ = NOT_SELECTED; TermsAndConditionsState terms_and_conditions_ = NOT_SELECTED;
......
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