| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H_ |
| 6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
| 13 #include "components/autofill/content/public/interfaces/autofill_driver.mojom.h" | 13 #include "components/autofill/content/public/interfaces/autofill_driver.mojom.h" |
| 14 #include "components/autofill/core/browser/autofill_manager.h" | 14 #include "components/autofill/core/browser/autofill_manager.h" |
| 15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class RenderFrameHost; | 18 class RenderFrameHost; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace IPC { | |
| 22 class Message; | |
| 23 } | |
| 24 | |
| 25 namespace autofill { | 21 namespace autofill { |
| 26 | 22 |
| 27 class AutofillDriver; | 23 class AutofillDriver; |
| 28 class ContentAutofillDriver; | 24 class ContentAutofillDriver; |
| 29 | 25 |
| 30 // Manages lifetime of ContentAutofillDriver. One Factory per WebContents | 26 // Manages lifetime of ContentAutofillDriver. One Factory per WebContents |
| 31 // creates one Driver per RenderFrame. | 27 // creates one Driver per RenderFrame. |
| 32 class ContentAutofillDriverFactory : public content::WebContentsObserver, | 28 class ContentAutofillDriverFactory : public content::WebContentsObserver, |
| 33 public base::SupportsUserData::Data { | 29 public base::SupportsUserData::Data { |
| 34 public: | 30 public: |
| 35 ~ContentAutofillDriverFactory() override; | 31 ~ContentAutofillDriverFactory() override; |
| 36 | 32 |
| 37 static void CreateForWebContentsAndDelegate( | 33 static void CreateForWebContentsAndDelegate( |
| 38 content::WebContents* contents, | 34 content::WebContents* contents, |
| 39 AutofillClient* client, | 35 AutofillClient* client, |
| 40 const std::string& app_locale, | 36 const std::string& app_locale, |
| 41 AutofillManager::AutofillDownloadManagerState enable_download_manager); | 37 AutofillManager::AutofillDownloadManagerState enable_download_manager); |
| 42 static ContentAutofillDriverFactory* FromWebContents( | 38 static ContentAutofillDriverFactory* FromWebContents( |
| 43 content::WebContents* contents); | 39 content::WebContents* contents); |
| 44 static void BindAutofillDriver(content::RenderFrameHost* render_frame_host, | 40 static void BindAutofillDriver(content::RenderFrameHost* render_frame_host, |
| 45 mojom::AutofillDriverRequest request); | 41 mojom::AutofillDriverRequest request); |
| 46 | 42 |
| 47 // Gets the |ContentAutofillDriver| associated with |render_frame_host|. | 43 // Gets the |ContentAutofillDriver| associated with |render_frame_host|. |
| 48 // |render_frame_host| must be owned by |web_contents()|. | 44 // |render_frame_host| must be owned by |web_contents()|. |
| 49 ContentAutofillDriver* DriverForFrame( | 45 ContentAutofillDriver* DriverForFrame( |
| 50 content::RenderFrameHost* render_frame_host); | 46 content::RenderFrameHost* render_frame_host); |
| 51 | 47 |
| 52 // content::WebContentsObserver: | 48 // content::WebContentsObserver: |
| 53 bool OnMessageReceived(const IPC::Message& message, | |
| 54 content::RenderFrameHost* render_frame_host) override; | |
| 55 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; | 49 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; |
| 56 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; | 50 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; |
| 57 void DidNavigateAnyFrame( | 51 void DidNavigateAnyFrame( |
| 58 content::RenderFrameHost* render_frame_host, | 52 content::RenderFrameHost* render_frame_host, |
| 59 const content::LoadCommittedDetails& details, | 53 const content::LoadCommittedDetails& details, |
| 60 const content::FrameNavigateParams& params) override; | 54 const content::FrameNavigateParams& params) override; |
| 61 void DidFinishNavigation( | 55 void DidFinishNavigation( |
| 62 content::NavigationHandle* navigation_handle) override; | 56 content::NavigationHandle* navigation_handle) override; |
| 63 void WasHidden() override; | 57 void WasHidden() override; |
| 64 | 58 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 76 std::string app_locale_; | 70 std::string app_locale_; |
| 77 AutofillManager::AutofillDownloadManagerState enable_download_manager_; | 71 AutofillManager::AutofillDownloadManagerState enable_download_manager_; |
| 78 | 72 |
| 79 std::map<content::RenderFrameHost*, std::unique_ptr<ContentAutofillDriver>> | 73 std::map<content::RenderFrameHost*, std::unique_ptr<ContentAutofillDriver>> |
| 80 frame_driver_map_; | 74 frame_driver_map_; |
| 81 }; | 75 }; |
| 82 | 76 |
| 83 } // namespace autofill | 77 } // namespace autofill |
| 84 | 78 |
| 85 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H
_ | 79 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H
_ |
| OLD | NEW |