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

Unified Diff: components/autofill/content/browser/content_autofill_driver.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.h
diff --git a/components/autofill/content/browser/content_autofill_driver.h b/components/autofill/content/browser/content_autofill_driver.h
index 8247c1dcc8dc0ad151575d94bdd1236da5edcd5d..cb35d811d533fa362c108a52dccfca01ce96049d 100644
--- a/components/autofill/content/browser/content_autofill_driver.h
+++ b/components/autofill/content/browser/content_autofill_driver.h
@@ -13,10 +13,12 @@
#include "components/autofill/core/browser/autofill_driver.h"
#include "components/autofill/core/browser/autofill_external_delegate.h"
#include "components/autofill/core/browser/autofill_manager.h"
-#include "content/public/browser/web_contents_observer.h"
namespace content {
-class WebContents;
+class BrowserContext;
+class RenderFrameHost;
+struct FrameNavigateParams;
+struct LoadCommittedDetails;
}
namespace IPC {
@@ -29,17 +31,15 @@ class AutofillClient;
// Class that drives autofill flow in the browser process based on
// communication from the renderer and from the external world. There is one
-// instance per WebContents.
-class ContentAutofillDriver : public AutofillDriver,
- public content::WebContentsObserver,
- public base::SupportsUserData::Data {
+// instance per RenderFrameHost.
+class ContentAutofillDriver : public AutofillDriver {
public:
- static void CreateForWebContentsAndDelegate(
- content::WebContents* contents,
+ ContentAutofillDriver(
+ content::RenderFrameHost* render_frame_host,
AutofillClient* client,
const std::string& app_locale,
AutofillManager::AutofillDownloadManagerState enable_download_manager);
- static ContentAutofillDriver* FromWebContents(content::WebContents* contents);
+ ~ContentAutofillDriver() override;
// AutofillDriver:
bool IsOffTheRecord() const override;
@@ -50,6 +50,8 @@ class ContentAutofillDriver : public AutofillDriver,
RendererFormDataAction action,
const FormData& data) override;
void PingRenderer() override;
+ void DetectAccountCreationForms(
+ const std::vector<autofill::FormStructure*>& forms) override;
void SendAutofillTypePredictionsToRenderer(
const std::vector<FormStructure*>& forms) override;
void RendererShouldAcceptDataListSuggestion(
@@ -60,34 +62,33 @@ class ContentAutofillDriver : public AutofillDriver,
void RendererShouldPreviewFieldWithValue(
const base::string16& value) override;
+ // Handles a message that came from the associated render frame.
+ bool HandleMessage(const IPC::Message& message);
+
+ // Called when the frame has navigated.
+ void DidNavigateFrame(const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params);
+
AutofillExternalDelegate* autofill_external_delegate() {
return &autofill_external_delegate_;
}
AutofillManager* autofill_manager() { return autofill_manager_.get(); }
+ content::RenderFrameHost* render_frame_host() { return render_frame_host_; }
protected:
- ContentAutofillDriver(
- content::WebContents* web_contents,
- AutofillClient* client,
- const std::string& app_locale,
- AutofillManager::AutofillDownloadManagerState enable_download_manager);
- ~ContentAutofillDriver() override;
-
- // content::WebContentsObserver:
- void DidNavigateMainFrame(
- const content::LoadCommittedDetails& details,
- const content::FrameNavigateParams& params) override;
- void NavigationEntryCommitted(
- const content::LoadCommittedDetails& load_details) override;
- void WasHidden() override;
- bool OnMessageReceived(const IPC::Message& message) override;
-
// Sets the manager to |manager| and sets |manager|'s external delegate
// to |autofill_external_delegate_|. Takes ownership of |manager|.
void SetAutofillManager(scoped_ptr<AutofillManager> manager);
private:
+ // Weak ref to the RenderFrameHost the driver is associated with. Should
+ // always be non-NULL and valid for lifetime of |this|.
+ content::RenderFrameHost* const render_frame_host_;
+
+ // The per-tab client.
+ AutofillClient* client_;
+
// AutofillManager instance via which this object drives the shared Autofill
// code.
scoped_ptr<AutofillManager> autofill_manager_;
« no previous file with comments | « components/autofill/content/browser/BUILD.gn ('k') | components/autofill/content/browser/content_autofill_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698