diff options
3 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc index bec328a..2692eb7 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc @@ -2206,7 +2206,7 @@ void AutofillDialogControllerImpl::Observe( content::Details<content::LoadCommittedDetails>(details).ptr(); size_t user_index = 0; if (IsSignInContinueUrl(load_details->entry->GetVirtualURL(), &user_index)) { - GetWalletClient()->set_user_index(user_index); + GetWalletClient()->SetUserIndex(user_index); FetchWalletCookie(); // NOTE: |HideSignIn()| may delete the WebContents which doesn't expect to @@ -2372,7 +2372,7 @@ void AutofillDialogControllerImpl::OnDidGetWalletItems( // Making sure the user index is in sync shouldn't be necessary, but is an // extra precaution. But if there is no active account (such as in the // PASSIVE_AUTH case), stick with the old active account. - GetWalletClient()->set_user_index(wallet_items_->active_account_index()); + GetWalletClient()->SetUserIndex(wallet_items_->active_account_index()); std::vector<std::string> usernames; for (size_t i = 0; i < wallet_items_->gaia_accounts().size(); ++i) { @@ -2440,7 +2440,7 @@ void AutofillDialogControllerImpl::AccountChoiceChanged() { account_chooser_model_->GetActiveWalletAccountIndex(); if (account_chooser_model_->WalletIsSelected() && client->user_index() != selected_user_index) { - client->set_user_index(selected_user_index); + client->SetUserIndex(selected_user_index); // Clear |wallet_items_| so we don't try to restore the selected instrument // and address. wallet_items_.reset(); diff --git a/components/autofill/content/browser/wallet/wallet_client.cc b/components/autofill/content/browser/wallet/wallet_client.cc index 30fd618..b2bb40c 100644 --- a/components/autofill/content/browser/wallet/wallet_client.cc +++ b/components/autofill/content/browser/wallet/wallet_client.cc @@ -506,6 +506,11 @@ void WalletClient::CancelRequests() { } } +void WalletClient::SetUserIndex(size_t user_index) { + CancelRequests(); + user_index_ = user_index; +} + void WalletClient::DoAcceptLegalDocuments( const std::vector<std::string>& document_ids, const std::string& google_transaction_id) { diff --git a/components/autofill/content/browser/wallet/wallet_client.h b/components/autofill/content/browser/wallet/wallet_client.h index 22d0bd5..54476f0 100644 --- a/components/autofill/content/browser/wallet/wallet_client.h +++ b/components/autofill/content/browser/wallet/wallet_client.h @@ -175,10 +175,9 @@ class WalletClient : public net::URLFetcherDelegate { // Cancels and clears the current |request_| and |pending_requests_| (if any). void CancelRequests(); + // Sets the user index and cancels any pending requests. + void SetUserIndex(size_t user_index); size_t user_index() const { return user_index_; } - void set_user_index(size_t user_index) { - user_index_ = user_index; - } private: FRIEND_TEST_ALL_PREFIXES(WalletClientTest, PendingRequest); |