Chromium Code Reviews| 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..ea061e5c7292550ffd10cb577dd358953e3c8725 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,30 @@ 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* render_frame_host_; |
|
vabr (Chromium)
2014/11/10 14:34:39
Could this be
content::RenderFrameHost* const
to d
Evan Stade
2014/11/14 23:25:49
Done.
|
| + |
| // AutofillManager instance via which this object drives the shared Autofill |
| // code. |
| scoped_ptr<AutofillManager> autofill_manager_; |