Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: components/autofill/content/browser/content_autofill_driver_factory.h

Issue 2606473003: Use AutofillDriver* in ContentAutofillDriverFactory when possible (Closed)
Patch Set: Fix Android compilation Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/content/browser/content_autofill_driver_factory.h
diff --git a/components/autofill/content/browser/content_autofill_driver_factory.h b/components/autofill/content/browser/content_autofill_driver_factory.h
index 2781ee4c1cfc7b838282c344ee98511bd89d98a6..7fd1206c8edd883786a576368a5228f74b477527 100644
--- a/components/autofill/content/browser/content_autofill_driver_factory.h
+++ b/components/autofill/content/browser/content_autofill_driver_factory.h
@@ -9,6 +9,7 @@
#include <memory>
#include <string>
+#include "base/callback.h"
#include "base/supports_user_data.h"
#include "components/autofill/content/common/autofill_driver.mojom.h"
#include "components/autofill/core/browser/autofill_manager.h"
@@ -20,13 +21,19 @@ class RenderFrameHost;
namespace autofill {
-class ContentAutofillDriver;
+class AutofillDriver;
// Manages lifetime of ContentAutofillDriver. One Factory per WebContents
// creates one Driver per RenderFrame.
class ContentAutofillDriverFactory : public content::WebContentsObserver,
public base::SupportsUserData::Data {
public:
+ using DriverCreator = base::Callback<std::unique_ptr<AutofillDriver>(
+ content::RenderFrameHost*,
+ AutofillClient*,
+ const std::string&,
+ AutofillManager::AutofillDownloadManagerState)>;
+
~ContentAutofillDriverFactory() override;
static void CreateForWebContentsAndDelegate(
@@ -39,10 +46,9 @@ class ContentAutofillDriverFactory : public content::WebContentsObserver,
static void BindAutofillDriver(content::RenderFrameHost* render_frame_host,
mojom::AutofillDriverRequest request);
- // Gets the |ContentAutofillDriver| associated with |render_frame_host|.
+ // Gets the |AutofillDriver| associated with |render_frame_host|.
// |render_frame_host| must be owned by |web_contents()|.
- ContentAutofillDriver* DriverForFrame(
- content::RenderFrameHost* render_frame_host);
+ AutofillDriver* DriverForFrame(content::RenderFrameHost* render_frame_host);
// content::WebContentsObserver:
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
@@ -58,18 +64,21 @@ class ContentAutofillDriverFactory : public content::WebContentsObserver,
static const char kContentAutofillDriverFactoryWebContentsUserDataKey[];
protected:
+ // Accessible for tests.
ContentAutofillDriverFactory(
content::WebContents* web_contents,
AutofillClient* client,
const std::string& app_locale,
- AutofillManager::AutofillDownloadManagerState enable_download_manager);
+ AutofillManager::AutofillDownloadManagerState enable_download_manager,
+ DriverCreator driver_creator);
private:
AutofillClient* client_;
std::string app_locale_;
AutofillManager::AutofillDownloadManagerState enable_download_manager_;
+ const DriverCreator driver_creator_;
- std::map<content::RenderFrameHost*, std::unique_ptr<ContentAutofillDriver>>
+ std::map<content::RenderFrameHost*, std::unique_ptr<AutofillDriver>>
frame_driver_map_;
};

Powered by Google App Engine
This is Rietveld 408576698