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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
11 #include "components/autofill/content/common/autofill_driver.mojom.h" | 11 #include "components/autofill/content/common/autofill_driver.mojom.h" |
12 #include "components/autofill/core/browser/autofill_driver_factory.h" | 12 #include "components/autofill/core/browser/autofill_driver_factory.h" |
13 #include "components/autofill/core/browser/autofill_manager.h" | 13 #include "components/autofill/core/browser/autofill_manager.h" |
14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class RenderFrameHost; | 17 class RenderFrameHost; |
18 } | 18 } |
19 | 19 |
20 namespace autofill { | 20 namespace autofill { |
21 | 21 |
22 class ContentAutofillDriver; | 22 class ContentAutofillDriver; |
| 23 class AutofillProvider; |
23 | 24 |
24 // Manages lifetime of ContentAutofillDriver. One Factory per WebContents | 25 // Manages lifetime of ContentAutofillDriver. One Factory per WebContents |
25 // creates one Driver per RenderFrame. | 26 // creates one Driver per RenderFrame. |
26 class ContentAutofillDriverFactory : public AutofillDriverFactory, | 27 class ContentAutofillDriverFactory : public AutofillDriverFactory, |
27 public content::WebContentsObserver, | 28 public content::WebContentsObserver, |
28 public base::SupportsUserData::Data { | 29 public base::SupportsUserData::Data { |
29 public: | 30 public: |
30 ~ContentAutofillDriverFactory() override; | 31 ~ContentAutofillDriverFactory() override; |
31 | 32 |
32 static void CreateForWebContentsAndDelegate( | 33 static void CreateForWebContentsAndDelegate( |
33 content::WebContents* contents, | 34 content::WebContents* contents, |
34 AutofillClient* client, | 35 AutofillClient* client, |
35 const std::string& app_locale, | 36 const std::string& app_locale, |
36 AutofillManager::AutofillDownloadManagerState enable_download_manager); | 37 AutofillManager::AutofillDownloadManagerState enable_download_manager); |
| 38 |
| 39 static void CreateForWebContentsAndDelegate( |
| 40 content::WebContents* contents, |
| 41 AutofillClient* client, |
| 42 const std::string& app_locale, |
| 43 AutofillManager::AutofillDownloadManagerState enable_download_manager, |
| 44 AutofillProvider* provider); |
| 45 |
37 static ContentAutofillDriverFactory* FromWebContents( | 46 static ContentAutofillDriverFactory* FromWebContents( |
38 content::WebContents* contents); | 47 content::WebContents* contents); |
39 static void BindAutofillDriver(content::RenderFrameHost* render_frame_host, | 48 static void BindAutofillDriver(content::RenderFrameHost* render_frame_host, |
40 mojom::AutofillDriverRequest request); | 49 mojom::AutofillDriverRequest request); |
41 | 50 |
42 // Gets the |ContentAutofillDriver| associated with |render_frame_host|. | 51 // Gets the |ContentAutofillDriver| associated with |render_frame_host|. |
43 // |render_frame_host| must be owned by |web_contents()|. | 52 // |render_frame_host| must be owned by |web_contents()|. |
44 ContentAutofillDriver* DriverForFrame( | 53 ContentAutofillDriver* DriverForFrame( |
45 content::RenderFrameHost* render_frame_host); | 54 content::RenderFrameHost* render_frame_host); |
46 | 55 |
47 // content::WebContentsObserver: | 56 // content::WebContentsObserver: |
48 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; | 57 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; |
49 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; | 58 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; |
50 void DidFinishNavigation( | 59 void DidFinishNavigation( |
51 content::NavigationHandle* navigation_handle) override; | 60 content::NavigationHandle* navigation_handle) override; |
52 void WasHidden() override; | 61 void WasHidden() override; |
53 | 62 |
54 static const char kContentAutofillDriverFactoryWebContentsUserDataKey[]; | 63 static const char kContentAutofillDriverFactoryWebContentsUserDataKey[]; |
55 | 64 |
56 private: | 65 private: |
57 ContentAutofillDriverFactory( | 66 ContentAutofillDriverFactory( |
58 content::WebContents* web_contents, | 67 content::WebContents* web_contents, |
59 AutofillClient* client, | 68 AutofillClient* client, |
60 const std::string& app_locale, | 69 const std::string& app_locale, |
61 AutofillManager::AutofillDownloadManagerState enable_download_manager); | 70 AutofillManager::AutofillDownloadManagerState enable_download_manager, |
| 71 AutofillProvider* provider); |
62 | 72 |
63 std::string app_locale_; | 73 std::string app_locale_; |
64 AutofillManager::AutofillDownloadManagerState enable_download_manager_; | 74 AutofillManager::AutofillDownloadManagerState enable_download_manager_; |
| 75 AutofillProvider* provider_; |
65 }; | 76 }; |
66 | 77 |
67 } // namespace autofill | 78 } // namespace autofill |
68 | 79 |
69 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H
_ | 80 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H
_ |
OLD | NEW |