[Autofill] Clean up after AutofillDownloadManager ownership change
This CL removes the AutofillManager::EnableDownloadManager parameter from BrowserAutofillManager and carries out some other cleanups. This is a followup of crrev.com/c/4180847. Bug: 1394786, 892612 Change-Id: Ide70afd26ef11616cf4d309a1ce23cda1d46e7e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4181047 Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Commit-Queue: Christoph Schwering <schwering@google.com> Reviewed-by: Dominic Battré <battre@chromium.org> Reviewed-by: Alex Ilin <alexilin@chromium.org> Reviewed-by: Rohit Rao <rohitrao@chromium.org> Cr-Commit-Position: refs/heads/main@{#1104515}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
cbf4acd189
commit
e8173f585e
chrome/browser
autofill
fast_checkout
page_load_metrics
ui
autofill
views
components
android_autofill
browser
test_support
autofill
content
core
browser
ios
ios
chrome
browser
autofill
ui
autofill
manual_fill
web_view
internal
autofill
@@ -74,10 +74,7 @@ constexpr char kCvc[] = "123";
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
static TestAutofillManager* GetForRenderFrameHost(
|
||||
content::RenderFrameHost* rfh) {
|
||||
|
@@ -120,10 +120,7 @@ class AutofillTest : public InProcessBrowserTest {
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
[[nodiscard]] testing::AssertionResult WaitForFormsSeen(
|
||||
int min_num_awaited_calls) {
|
||||
@@ -759,10 +756,7 @@ class AutofillTestPrerendering : public InProcessBrowserTest {
|
||||
class MockAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
MockAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {
|
||||
: BrowserAutofillManager(driver, client, "en-US") {
|
||||
// We need to set these expectations immediately to catch any premature
|
||||
// calls while prerendering.
|
||||
if (driver->render_frame_host()->GetLifecycleState() ==
|
||||
@@ -870,10 +864,7 @@ class AutofillTestFormSubmission
|
||||
class MockAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
MockAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
MOCK_METHOD(void,
|
||||
OnFormSubmittedImpl,
|
||||
(const FormData&, bool, mojom::SubmissionSource),
|
||||
|
@@ -175,10 +175,7 @@ class FormStructureBrowserTest
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
TestAutofillManagerWaiter& waiter() { return waiter_; }
|
||||
|
||||
|
@@ -558,7 +558,7 @@ TEST_F(FastCheckoutClientImplTest,
|
||||
std::make_unique<autofill::BrowserAutofillManager>(
|
||||
autofill_driver.get(),
|
||||
autofill::ChromeAutofillClient::FromWebContents(web_contents()),
|
||||
"en-US", autofill::AutofillManager::EnableDownloadManager(false));
|
||||
"en-US");
|
||||
autofill::BrowserAutofillManager* autofill_manager =
|
||||
browser_autofill_manager.get();
|
||||
autofill_driver->set_autofill_manager(std::move(browser_autofill_manager));
|
||||
|
@@ -40,10 +40,7 @@ class FormfillPageLoadMetricsObserverBrowserTest : public InProcessBrowserTest {
|
||||
public:
|
||||
TestAutofillManager(autofill::ContentAutofillDriver* driver,
|
||||
autofill::AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
autofill::TestAutofillManagerWaiter& waiter() { return waiter_; }
|
||||
|
||||
|
@@ -95,10 +95,7 @@ class MockAutofillDriver : public ContentAutofillDriver {
|
||||
class MockBrowserAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
MockBrowserAutofillManager(AutofillDriver* driver, MockAutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
MockBrowserAutofillManager(MockBrowserAutofillManager&) = delete;
|
||||
MockBrowserAutofillManager& operator=(MockBrowserAutofillManager&) = delete;
|
||||
~MockBrowserAutofillManager() override = default;
|
||||
|
@@ -195,9 +195,8 @@ TEST_F(ChromeAutofillClientTest, TryToShowFastCheckout) {
|
||||
auto router = std::make_unique<autofill::ContentAutofillRouter>();
|
||||
auto driver = std::make_unique<autofill::ContentAutofillDriver>(
|
||||
web_contents()->GetPrimaryMainFrame(), router.get());
|
||||
auto manager = std::make_unique<BrowserAutofillManager>(
|
||||
driver.get(), client(), "en-US",
|
||||
AutofillManager::EnableDownloadManager(false));
|
||||
auto manager =
|
||||
std::make_unique<BrowserAutofillManager>(driver.get(), client(), "en-US");
|
||||
BrowserAutofillManager* manager_ptr = manager.get();
|
||||
driver->set_autofill_manager(std::move(manager));
|
||||
|
||||
|
@@ -49,10 +49,7 @@ class AutofillAccessibilityWinBrowserTest : public InProcessBrowserTest {
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
testing::AssertionResult WaitForFormsSeen(int min_num_awaited_calls) {
|
||||
return forms_seen_waiter_.Wait(min_num_awaited_calls);
|
||||
|
@@ -30,10 +30,7 @@ class CreditCardAccessManagerBrowserTest : public InProcessBrowserTest {
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
testing::AssertionResult WaitForFormsSeen(int min_num_awaited_calls) {
|
||||
return forms_seen_waiter_.Wait(min_num_awaited_calls);
|
||||
|
@@ -165,10 +165,7 @@ class LocalCardMigrationBrowserTest
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
testing::AssertionResult WaitForFormsSeen(int min_num_awaited_calls) {
|
||||
return forms_seen_waiter_.Wait(min_num_awaited_calls);
|
||||
|
@@ -42,10 +42,7 @@ class OfferNotificationBubbleViewsTestBase
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
testing::AssertionResult WaitForFormsSeen(int min_num_awaited_calls) {
|
||||
return forms_seen_waiter_.Wait(min_num_awaited_calls);
|
||||
|
@@ -151,10 +151,7 @@ class SaveCardBubbleViewsFullFormBrowserTest
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
testing::AssertionResult WaitForFormsSeen(int min_num_awaited_calls) {
|
||||
return forms_seen_waiter_.Wait(min_num_awaited_calls);
|
||||
|
@@ -67,10 +67,7 @@ class SaveIbanBubbleViewFullFormBrowserTest
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(ContentAutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
testing::AssertionResult WaitForFormsSeen(int min_num_awaited_calls) {
|
||||
return forms_seen_waiter_.Wait(min_num_awaited_calls);
|
||||
|
@@ -42,10 +42,7 @@ class TestAutofillManager : public autofill::BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(autofill::ContentAutofillDriver* driver,
|
||||
autofill::AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
[[nodiscard]] testing::AssertionResult WaitForFormsSeen(
|
||||
int min_num_awaited_calls) {
|
||||
|
@@ -173,11 +173,11 @@ JNI_AutofillProviderTestHelper_SimulateMainFrameAutofillQueryFailedForTesting(
|
||||
AutofillManager* autofill_manager = ToMainFrameAutofillManager(jweb_contents);
|
||||
const std::map<FormGlobalId, std::unique_ptr<FormStructure>>&
|
||||
form_structures = autofill_manager->form_structures();
|
||||
// Always use first form.
|
||||
CHECK(form_structures.size());
|
||||
autofill_manager->OnServerRequestErrorForTest(
|
||||
*(autofill::test::GetEncodedSignatures(*(form_structures.begin()->second))
|
||||
.begin()),
|
||||
CHECK(!form_structures.empty());
|
||||
const FormStructure& arbitary_form = *form_structures.begin()->second;
|
||||
AutofillDownloadManager::Observer* observer = autofill_manager;
|
||||
observer->OnServerRequestError(
|
||||
arbitary_form.form_signature(),
|
||||
AutofillDownloadManager::RequestType::REQUEST_QUERY, 400);
|
||||
}
|
||||
|
||||
|
@@ -272,10 +272,7 @@ class FakeAutofillAgent : public mojom::AutofillAgent {
|
||||
class MockBrowserAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
MockBrowserAutofillManager(AutofillDriver* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
kAppLocale,
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, kAppLocale) {}
|
||||
~MockBrowserAutofillManager() override = default;
|
||||
|
||||
MOCK_METHOD(void, Reset, (), (override));
|
||||
|
@@ -89,11 +89,6 @@ class AutofillDownloadManager {
|
||||
version_info::Channel channel,
|
||||
LogManager* log_manager);
|
||||
|
||||
AutofillDownloadManager(AutofillClient* client,
|
||||
const std::string& api_key,
|
||||
bool is_raw_metadata_uploading_enabled,
|
||||
LogManager* log_manager);
|
||||
|
||||
virtual ~AutofillDownloadManager();
|
||||
|
||||
// Starts a query request to Autofill servers. The observer is called with the
|
||||
@@ -132,6 +127,11 @@ class AutofillDownloadManager {
|
||||
static void ClearUploadHistory(PrefService* pref_service);
|
||||
|
||||
protected:
|
||||
AutofillDownloadManager(AutofillClient* client,
|
||||
const std::string& api_key,
|
||||
bool is_raw_metadata_uploading_enabled,
|
||||
LogManager* log_manager);
|
||||
|
||||
// Gets the length of the payload from request data. Used to simulate
|
||||
// different payload sizes when testing without the need for data. Do not use
|
||||
// this when the length is needed to read/write a buffer.
|
||||
|
@@ -113,10 +113,7 @@ class MockAutofillClient : public TestAutofillClient {
|
||||
class MockBrowserAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
MockBrowserAutofillManager(AutofillDriver* driver, MockAutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
MockBrowserAutofillManager(const MockBrowserAutofillManager&) = delete;
|
||||
MockBrowserAutofillManager& operator=(const MockBrowserAutofillManager&) =
|
||||
delete;
|
||||
|
@@ -107,9 +107,6 @@ class AutofillManager
|
||||
virtual void OnFormSubmitted() {}
|
||||
};
|
||||
|
||||
using EnableDownloadManager =
|
||||
base::StrongAlias<struct EnableDownloadManagerTag, bool>;
|
||||
|
||||
// TODO(crbug.com/1151542): Move to anonymous namespace once
|
||||
// BrowserAutofillManager::OnLoadedServerPredictions() moves to
|
||||
// AutofillManager.
|
||||
@@ -335,12 +332,6 @@ class AutofillManager
|
||||
const std::vector<FormSignature>& queried_form_signatures) {
|
||||
OnLoadedServerPredictions(response, queried_form_signatures);
|
||||
}
|
||||
void OnServerRequestErrorForTest(
|
||||
FormSignature form_signature,
|
||||
AutofillDownloadManager::RequestType request_type,
|
||||
int http_error) {
|
||||
OnServerRequestError(form_signature, request_type, http_error);
|
||||
}
|
||||
|
||||
std::map<FormGlobalId, std::unique_ptr<FormStructure>>*
|
||||
mutable_form_structures_for_test() {
|
||||
|
@@ -516,11 +516,9 @@ BrowserAutofillManager::FillingContext::FillingContext(
|
||||
|
||||
BrowserAutofillManager::FillingContext::~FillingContext() = default;
|
||||
|
||||
BrowserAutofillManager::BrowserAutofillManager(
|
||||
AutofillDriver* driver,
|
||||
AutofillClient* client,
|
||||
const std::string& app_locale,
|
||||
EnableDownloadManager enable_download_manager)
|
||||
BrowserAutofillManager::BrowserAutofillManager(AutofillDriver* driver,
|
||||
AutofillClient* client,
|
||||
const std::string& app_locale)
|
||||
: AutofillManager(driver, client),
|
||||
external_delegate_(
|
||||
std::make_unique<AutofillExternalDelegate>(this, driver)),
|
||||
|
@@ -100,10 +100,7 @@ class BrowserAutofillManager : public AutofillManager,
|
||||
public:
|
||||
BrowserAutofillManager(AutofillDriver* driver,
|
||||
AutofillClient* client,
|
||||
const std::string& app_locale,
|
||||
// TODO(crbug.com/1394786): Remove parameter.
|
||||
EnableDownloadManager enable_download_manager =
|
||||
EnableDownloadManager(true));
|
||||
const std::string& app_locale);
|
||||
|
||||
BrowserAutofillManager(const BrowserAutofillManager&) = delete;
|
||||
BrowserAutofillManager& operator=(const BrowserAutofillManager&) = delete;
|
||||
|
@@ -34,10 +34,7 @@ FormStructureTestApi test_api(FormStructure* form_structure) {
|
||||
TestBrowserAutofillManager::TestBrowserAutofillManager(
|
||||
TestAutofillDriver* driver,
|
||||
TestAutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)),
|
||||
: BrowserAutofillManager(driver, client, "en-US"),
|
||||
client_(client),
|
||||
driver_(driver) {}
|
||||
|
||||
|
@@ -131,8 +131,7 @@ TEST_F(AutofillAgentTests,
|
||||
OnFormDataFilledTestWithFrameMessagingUsingRendererIDs) {
|
||||
std::string locale("en");
|
||||
autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate(
|
||||
&fake_web_state_, &client_, nil, locale,
|
||||
autofill::AutofillManager::EnableDownloadManager(false));
|
||||
&fake_web_state_, &client_, nil, locale);
|
||||
|
||||
autofill::FormData form;
|
||||
form.url = GURL("https://myform.com");
|
||||
@@ -412,8 +411,7 @@ TEST_F(AutofillAgentTests, onSuggestionsReady_ClearFormWithGPay) {
|
||||
TEST_F(AutofillAgentTests, FrameInitializationOrderFrames) {
|
||||
std::string locale("en");
|
||||
autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate(
|
||||
&fake_web_state_, &client_, nil, locale,
|
||||
autofill::AutofillManager::EnableDownloadManager(false));
|
||||
&fake_web_state_, &client_, nil, locale);
|
||||
|
||||
// Remove the current main frame.
|
||||
RemoveWebFrame(fake_main_frame_->GetFrameId());
|
||||
|
@@ -45,8 +45,7 @@ class AutofillDriverIOS : public AutofillDriver {
|
||||
web::WebState* web_state,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager);
|
||||
const std::string& app_locale);
|
||||
|
||||
static AutofillDriverIOS* FromWebStateAndWebFrame(web::WebState* web_state,
|
||||
web::WebFrame* web_frame);
|
||||
@@ -106,13 +105,11 @@ class AutofillDriverIOS : public AutofillDriver {
|
||||
web::WebFrame* web_frame();
|
||||
|
||||
protected:
|
||||
AutofillDriverIOS(
|
||||
web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager);
|
||||
AutofillDriverIOS(web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale);
|
||||
|
||||
private:
|
||||
// The WebState with which this object is associated.
|
||||
|
@@ -26,13 +26,12 @@ void AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate(
|
||||
web::WebState* web_state,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager) {
|
||||
const std::string& app_locale) {
|
||||
// By the time this method is called, no web_frame is available. This method
|
||||
// only prepares the factory and the AutofillDriverIOS will be created in the
|
||||
// first call to FromWebStateAndWebFrame.
|
||||
AutofillDriverIOSWebFrameFactory::CreateForWebState(
|
||||
web_state, client, bridge, app_locale, enable_download_manager);
|
||||
AutofillDriverIOSWebFrameFactory::CreateForWebState(web_state, client, bridge,
|
||||
app_locale);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -44,22 +43,17 @@ AutofillDriverIOS* AutofillDriverIOS::FromWebStateAndWebFrame(
|
||||
->driver();
|
||||
}
|
||||
|
||||
AutofillDriverIOS::AutofillDriverIOS(
|
||||
web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager)
|
||||
AutofillDriverIOS::AutofillDriverIOS(web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale)
|
||||
: web_state_(web_state),
|
||||
bridge_(bridge),
|
||||
client_(client),
|
||||
browser_autofill_manager_(
|
||||
std::make_unique<BrowserAutofillManager>(this,
|
||||
client,
|
||||
app_locale,
|
||||
enable_download_manager)) {
|
||||
web_frame_id_ = web::GetWebFrameId(web_frame);
|
||||
std::make_unique<BrowserAutofillManager>(this, client, app_locale)) {
|
||||
web_frame_id_ = web::GetWebFrameId(web_frame);
|
||||
}
|
||||
|
||||
AutofillDriverIOS::~AutofillDriverIOS() = default;
|
||||
|
@@ -37,18 +37,15 @@ class AutofillDriverIOSWebFrameFactory
|
||||
|
||||
// Creates a AutofillDriverIOSWebFrameFactory that will store all the
|
||||
// needed to create a AutofillDriverIOS.
|
||||
AutofillDriverIOSWebFrameFactory(
|
||||
web::WebState* web_state,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager);
|
||||
AutofillDriverIOSWebFrameFactory(web::WebState* web_state,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale);
|
||||
|
||||
web::WebState* web_state_ = nullptr;
|
||||
AutofillClient* client_ = nullptr;
|
||||
id<AutofillDriverIOSBridge> bridge_ = nil;
|
||||
std::string app_locale_;
|
||||
AutofillManager::EnableDownloadManager enable_download_manager_;
|
||||
WEB_STATE_USER_DATA_KEY_DECL();
|
||||
};
|
||||
|
||||
@@ -58,13 +55,11 @@ class AutofillDriverIOSRefCountable
|
||||
: public AutofillDriverIOS,
|
||||
public base::RefCountedThreadSafe<AutofillDriverIOSRefCountable> {
|
||||
public:
|
||||
AutofillDriverIOSRefCountable(
|
||||
web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager);
|
||||
AutofillDriverIOSRefCountable(web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale);
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<AutofillDriverIOSRefCountable>;
|
||||
@@ -84,13 +79,11 @@ class AutofillDriverIOSRefCountable
|
||||
class AutofillDriverIOSWebFrame
|
||||
: public web::WebFrameUserData<AutofillDriverIOSWebFrame> {
|
||||
public:
|
||||
static void CreateForWebFrame(
|
||||
web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager);
|
||||
static void CreateForWebFrame(web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale);
|
||||
|
||||
~AutofillDriverIOSWebFrame() override;
|
||||
|
||||
@@ -107,13 +100,11 @@ class AutofillDriverIOSWebFrame
|
||||
}
|
||||
|
||||
private:
|
||||
AutofillDriverIOSWebFrame(
|
||||
web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager);
|
||||
AutofillDriverIOSWebFrame(web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale);
|
||||
|
||||
scoped_refptr<AutofillDriverIOSRefCountable> driver_;
|
||||
};
|
||||
|
@@ -10,13 +10,11 @@ AutofillDriverIOSWebFrameFactory::AutofillDriverIOSWebFrameFactory(
|
||||
web::WebState* web_state,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager)
|
||||
const std::string& app_locale)
|
||||
: web_state_(web_state),
|
||||
client_(client),
|
||||
bridge_(bridge),
|
||||
app_locale_(app_locale),
|
||||
enable_download_manager_(enable_download_manager) {}
|
||||
app_locale_(app_locale) {}
|
||||
|
||||
AutofillDriverIOSWebFrameFactory::~AutofillDriverIOSWebFrameFactory() {}
|
||||
|
||||
@@ -24,8 +22,7 @@ AutofillDriverIOSWebFrame*
|
||||
AutofillDriverIOSWebFrameFactory::AutofillDriverIOSFromWebFrame(
|
||||
web::WebFrame* web_frame) {
|
||||
AutofillDriverIOSWebFrame::CreateForWebFrame(web_state_, web_frame, client_,
|
||||
bridge_, app_locale_,
|
||||
enable_download_manager_);
|
||||
bridge_, app_locale_);
|
||||
return AutofillDriverIOSWebFrame::FromWebFrame(web_frame);
|
||||
}
|
||||
|
||||
@@ -35,15 +32,13 @@ void AutofillDriverIOSWebFrame::CreateForWebFrame(
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager) {
|
||||
const std::string& app_locale) {
|
||||
if (FromWebFrame(web_frame))
|
||||
return;
|
||||
|
||||
web_frame->SetUserData(UserDataKey(),
|
||||
base::WrapUnique(new AutofillDriverIOSWebFrame(
|
||||
web_state, web_frame, client, bridge, app_locale,
|
||||
enable_download_manager)));
|
||||
web_frame->SetUserData(
|
||||
UserDataKey(), base::WrapUnique(new AutofillDriverIOSWebFrame(
|
||||
web_state, web_frame, client, bridge, app_locale)));
|
||||
}
|
||||
|
||||
AutofillDriverIOSRefCountable::AutofillDriverIOSRefCountable(
|
||||
@@ -51,29 +46,21 @@ AutofillDriverIOSRefCountable::AutofillDriverIOSRefCountable(
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager)
|
||||
: AutofillDriverIOS(web_state,
|
||||
web_frame,
|
||||
client,
|
||||
bridge,
|
||||
app_locale,
|
||||
enable_download_manager) {}
|
||||
const std::string& app_locale)
|
||||
: AutofillDriverIOS(web_state, web_frame, client, bridge, app_locale) {}
|
||||
|
||||
AutofillDriverIOSWebFrame::AutofillDriverIOSWebFrame(
|
||||
web::WebState* web_state,
|
||||
web::WebFrame* web_frame,
|
||||
AutofillClient* client,
|
||||
id<AutofillDriverIOSBridge> bridge,
|
||||
const std::string& app_locale,
|
||||
AutofillManager::EnableDownloadManager enable_download_manager)
|
||||
: driver_(base::MakeRefCounted<AutofillDriverIOSRefCountable>(
|
||||
web_state,
|
||||
web_frame,
|
||||
client,
|
||||
bridge,
|
||||
app_locale,
|
||||
enable_download_manager)) {}
|
||||
const std::string& app_locale)
|
||||
: driver_(base::MakeRefCounted<AutofillDriverIOSRefCountable>(web_state,
|
||||
web_frame,
|
||||
client,
|
||||
bridge,
|
||||
app_locale)) {
|
||||
}
|
||||
|
||||
AutofillDriverIOSWebFrame::~AutofillDriverIOSWebFrame() {}
|
||||
|
||||
|
@@ -26,8 +26,7 @@ namespace autofill {
|
||||
// public:
|
||||
// MockAutofillManager(AutofillDriverIOS* driver,
|
||||
// AutofillClient* client)
|
||||
// : BrowserAutofillManager(driver, client, "en-US",
|
||||
// EnableDownloadManager(true)) {}
|
||||
// : BrowserAutofillManager(driver, client, "en-US") {}
|
||||
// MOCK_METHOD(...);
|
||||
// ...
|
||||
// };
|
||||
|
@@ -241,10 +241,7 @@ class AutofillControllerTest : public PlatformTest {
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(AutofillDriverIOS* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
TestAutofillManagerWaiter& waiter() { return waiter_; }
|
||||
|
||||
@@ -351,8 +348,7 @@ void AutofillControllerTest::SetUp() {
|
||||
|
||||
std::string locale("en");
|
||||
autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate(
|
||||
web_state(), autofill_client_.get(), /*autofill_agent=*/nil, locale,
|
||||
autofill::AutofillManager::EnableDownloadManager(false));
|
||||
web_state(), autofill_client_.get(), /*autofill_agent=*/nil, locale);
|
||||
|
||||
autofill_manager_injector_ =
|
||||
std::make_unique<TestAutofillManagerInjector<TestAutofillManager>>(
|
||||
|
@@ -47,8 +47,7 @@ AutofillTabHelper::AutofillTabHelper(
|
||||
|
||||
autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate(
|
||||
web_state, autofill_client_.get(), autofill_agent_,
|
||||
GetApplicationContext()->GetApplicationLocale(),
|
||||
autofill::AutofillManager::EnableDownloadManager(true));
|
||||
GetApplicationContext()->GetApplicationLocale());
|
||||
}
|
||||
|
||||
void AutofillTabHelper::WebStateDestroyed(web::WebState* web_state) {
|
||||
|
@@ -138,10 +138,7 @@ class FormStructureBrowserTest
|
||||
class TestAutofillManager : public BrowserAutofillManager {
|
||||
public:
|
||||
TestAutofillManager(AutofillDriverIOS* driver, AutofillClient* client)
|
||||
: BrowserAutofillManager(driver,
|
||||
client,
|
||||
"en-US",
|
||||
EnableDownloadManager(false)) {}
|
||||
: BrowserAutofillManager(driver, client, "en-US") {}
|
||||
|
||||
TestAutofillManagerWaiter& waiter() { return waiter_; }
|
||||
|
||||
@@ -258,8 +255,7 @@ void FormStructureBrowserTest::SetUp() {
|
||||
|
||||
std::string locale("en");
|
||||
autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate(
|
||||
web_state(), autofill_client_.get(), /*autofill_agent=*/nil, locale,
|
||||
autofill::AutofillManager::EnableDownloadManager(false));
|
||||
web_state(), autofill_client_.get(), /*autofill_agent=*/nil, locale);
|
||||
|
||||
autofill_manager_injector_ =
|
||||
std::make_unique<TestAutofillManagerInjector<TestAutofillManager>>(
|
||||
|
@@ -103,8 +103,7 @@ class PaymentRequestFullCardRequesterTest : public PlatformTest {
|
||||
|
||||
std::string locale("en");
|
||||
autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate(
|
||||
web_state(), autofill_client_.get(), nil, locale,
|
||||
autofill::AutofillManager::EnableDownloadManager(false));
|
||||
web_state(), autofill_client_.get(), nil, locale);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
@@ -130,8 +130,7 @@ using UserDecision =
|
||||
_autofillClient->set_bridge(self);
|
||||
|
||||
autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate(
|
||||
_webState, _autofillClient.get(), self, applicationLocale,
|
||||
autofill::AutofillManager::EnableDownloadManager(true));
|
||||
_webState, _autofillClient.get(), self, applicationLocale);
|
||||
|
||||
_passwordManagerClient = std::move(passwordManagerClient);
|
||||
_passwordManagerClient->set_bridge(self);
|
||||
|
Reference in New Issue
Block a user