Commit 3d00e383 authored by Mohamad Ahmadi's avatar Mohamad Ahmadi Committed by Commit Bot

[PR] Removes GetURLRequestContextGetter from autofill::PersonalDataManager

Replaces usages of PersonalDataManager::GetURLRequestContextGetter() with
ApplicationContext::GetSystemURLRequestContext()

Bug: 781942
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I7e42baf9ce61d722410c1f49ee33a55c5e53485a
Reviewed-on: https://chromium-review.googlesource.com/793850
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Reviewed-by: default avatarMathieu Perreault <mathp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519825}
parent 33ce2fff
...@@ -1212,9 +1212,6 @@ AutofillManager::AutofillManager( ...@@ -1212,9 +1212,6 @@ AutofillManager::AutofillManager(
CountryNames::SetLocaleString(app_locale_); CountryNames::SetLocaleString(app_locale_);
if (personal_data_ && client_) if (personal_data_ && client_)
personal_data_->OnSyncServiceInitialized(client_->GetSyncService()); personal_data_->OnSyncServiceInitialized(client_->GetSyncService());
if (personal_data_ && driver)
personal_data_->SetURLRequestContextGetter(driver->GetURLRequestContext());
} }
bool AutofillManager::RefreshDataModels() { bool AutofillManager::RefreshDataModels() {
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_member.h" #include "components/prefs/pref_member.h"
#include "components/webdata/common/web_data_service_consumer.h" #include "components/webdata/common/web_data_service_consumer.h"
#include "net/url_request/url_request_context_getter.h"
class AccountTrackerService; class AccountTrackerService;
class Browser; class Browser;
...@@ -285,18 +284,6 @@ class PersonalDataManager : public KeyedService, ...@@ -285,18 +284,6 @@ class PersonalDataManager : public KeyedService,
// Notifies test observers that personal data has changed. // Notifies test observers that personal data has changed.
void NotifyPersonalDataChangedForTest() { NotifyPersonalDataChanged(); } void NotifyPersonalDataChangedForTest() { NotifyPersonalDataChanged(); }
// Sets the URL request context getter to be used when normalizing addresses
// with libaddressinput's address validator.
void SetURLRequestContextGetter(
net::URLRequestContextGetter* context_getter) {
context_getter_ = context_getter;
}
// Returns the class used to fetch the address validation rules.
net::URLRequestContextGetter* GetURLRequestContextGetter() const {
return context_getter_.get();
}
// This function assumes |credit_card| contains the full PAN. Returns |true| // This function assumes |credit_card| contains the full PAN. Returns |true|
// if the card number of |credit_card| is equal to any local card or any // if the card number of |credit_card| is equal to any local card or any
// unmasked server card known by the browser, or |TypeAndLastFourDigits| of // unmasked server card known by the browser, or |TypeAndLastFourDigits| of
...@@ -627,10 +614,6 @@ class PersonalDataManager : public KeyedService, ...@@ -627,10 +614,6 @@ class PersonalDataManager : public KeyedService,
bool has_created_test_addresses_ = false; bool has_created_test_addresses_ = false;
bool has_created_test_credit_cards_ = false; bool has_created_test_credit_cards_ = false;
// The context for the request to be used to fetch libaddressinput's address
// validation rules.
scoped_refptr<net::URLRequestContextGetter> context_getter_;
DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); DISALLOW_COPY_AND_ASSIGN(PersonalDataManager);
}; };
......
...@@ -89,9 +89,10 @@ PaymentRequest::PaymentRequest( ...@@ -89,9 +89,10 @@ PaymentRequest::PaymentRequest(
web_state_(web_state), web_state_(web_state),
personal_data_manager_(personal_data_manager), personal_data_manager_(personal_data_manager),
payment_request_ui_delegate_(payment_request_ui_delegate), payment_request_ui_delegate_(payment_request_ui_delegate),
// TODO(crbug.com/788229): Use a factory for the AddressNormalizer.
address_normalizer_( address_normalizer_(
GetAddressInputSource( GetAddressInputSource(
personal_data_manager_->GetURLRequestContextGetter()), GetApplicationContext()->GetSystemURLRequestContext()),
GetAddressInputStorage(), GetAddressInputStorage(),
GetApplicationContext()->GetApplicationLocale()), GetApplicationContext()->GetApplicationLocale()),
address_normalization_manager_( address_normalization_manager_(
...@@ -105,7 +106,7 @@ PaymentRequest::PaymentRequest( ...@@ -105,7 +106,7 @@ PaymentRequest::PaymentRequest(
journey_logger_(IsIncognito(), GetLastCommittedURL(), GetUkmRecorder()), journey_logger_(IsIncognito(), GetLastCommittedURL(), GetUkmRecorder()),
payment_instruments_ready_(false), payment_instruments_ready_(false),
ios_instrument_finder_( ios_instrument_finder_(
personal_data_manager_->GetURLRequestContextGetter(), GetApplicationContext()->GetSystemURLRequestContext(),
payment_request_ui_delegate_) { payment_request_ui_delegate_) {
PopulateAvailableShippingOptions(); PopulateAvailableShippingOptions();
PopulateProfileCache(); PopulateProfileCache();
...@@ -184,7 +185,7 @@ autofill::AddressNormalizer* PaymentRequest::GetAddressNormalizer() { ...@@ -184,7 +185,7 @@ autofill::AddressNormalizer* PaymentRequest::GetAddressNormalizer() {
autofill::RegionDataLoader* PaymentRequest::GetRegionDataLoader() { autofill::RegionDataLoader* PaymentRequest::GetRegionDataLoader() {
return new autofill::RegionDataLoaderImpl( return new autofill::RegionDataLoaderImpl(
GetAddressInputSource( GetAddressInputSource(
personal_data_manager_->GetURLRequestContextGetter()) GetApplicationContext()->GetSystemURLRequestContext())
.release(), .release(),
GetAddressInputStorage().release(), GetApplicationLocale()); GetAddressInputStorage().release(), GetApplicationLocale());
} }
......
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