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

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

Issue 707173004: Refactor Autofill for out of process iframes (OOPIF). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mem leak Created 6 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
new file mode 100644
index 0000000000000000000000000000000000000000..02fa868ecc02881b126f6e80b7e681f29f0973ab
--- /dev/null
+++ b/components/autofill/content/browser/content_autofill_driver_factory.h
@@ -0,0 +1,81 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H_
+#define COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "base/supports_user_data.h"
+#include "components/autofill/content/browser/request_autocomplete_manager.h"
+#include "components/autofill/core/browser/autofill_manager.h"
+#include "content/public/browser/web_contents_observer.h"
+
+namespace content {
+class RenderFrameHost;
+}
+
+namespace IPC {
+class Message;
+}
+
+namespace autofill {
+
+class AutofillDriver;
+class ContentAutofillDriver;
+
+// Manages lifetime of ContentAutofillDriver. One Factory per WebContents
+// creates one Driver per RenderFrame.
+class ContentAutofillDriverFactory : public content::WebContentsObserver,
+ public base::SupportsUserData::Data {
+ public:
+ static void CreateForWebContentsAndDelegate(
+ content::WebContents* contents,
+ AutofillClient* client,
+ const std::string& app_locale,
+ AutofillManager::AutofillDownloadManagerState enable_download_manager);
+ static ContentAutofillDriverFactory* FromWebContents(
+ content::WebContents* contents);
+
+ // Gets the |ContentAutofillDriver| associated with |render_frame_host|.
+ // |render_frame_host| must be owned by |web_contents()|.
+ ContentAutofillDriver* DriverForFrame(
+ content::RenderFrameHost* render_frame_host);
+
+ // content::WebContentsObserver:
+ bool OnMessageReceived(const IPC::Message& message,
+ content::RenderFrameHost* render_frame_host) override;
+ void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
+ void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
+ void DidNavigateAnyFrame(content::RenderFrameHost* render_frame_host,
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params) override;
+ void NavigationEntryCommitted(
+ const content::LoadCommittedDetails& load_details) override;
+ void WasHidden() override;
+
+ static const char kContentAutofillDriverFactoryWebContentsUserDataKey[];
+
+ protected:
+ ContentAutofillDriverFactory(
+ content::WebContents* web_contents,
+ AutofillClient* client,
+ const std::string& app_locale,
+ AutofillManager::AutofillDownloadManagerState enable_download_manager);
+ ~ContentAutofillDriverFactory() override;
+
+ private:
+ void CreateDriverForFrame(content::RenderFrameHost* render_frame_host);
+
+ AutofillClient* client_;
+ std::string app_locale_;
+ AutofillManager::AutofillDownloadManagerState enable_download_manager_;
+
+ std::map<content::RenderFrameHost*, ContentAutofillDriver*> frame_driver_map_;
+};
+
+} // namespace autofill
+
+#endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698