OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_AUTOFILL_DRIVER_IMPL_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOFILL_DRIVER_IMPL_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOFILL_DRIVER_IMPL_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOFILL_DRIVER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/supports_user_data.h" | 11 #include "base/supports_user_data.h" |
12 #include "components/autofill/core/browser/autofill_driver.h" | 12 #include "components/autofill/core/browser/autofill_driver.h" |
13 #include "components/autofill/core/browser/autofill_external_delegate.h" | 13 #include "components/autofill/core/browser/autofill_external_delegate.h" |
14 #include "components/autofill/core/browser/autofill_manager.h" | 14 #include "components/autofill/core/browser/autofill_manager.h" |
| 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" |
15 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
16 | 18 |
17 namespace content { | 19 namespace content { |
18 class WebContents; | 20 class WebContents; |
19 } | 21 } |
20 | 22 |
21 namespace IPC { | 23 namespace IPC { |
22 class Message; | 24 class Message; |
23 } | 25 } |
24 | 26 |
25 namespace autofill { | 27 namespace autofill { |
26 | 28 |
27 class AutofillContext; | 29 class AutofillContext; |
28 class AutofillManagerDelegate; | 30 class AutofillManagerDelegate; |
29 | 31 |
30 // Class that drives autofill flow in the browser process based on | 32 // Class that drives autofill flow in the browser process based on |
31 // communication from the renderer and from the external world. There is one | 33 // communication from the renderer and from the external world. There is one |
32 // instance per WebContents. | 34 // instance per WebContents. |
33 class AutofillDriverImpl : public AutofillDriver, | 35 class AutofillDriverImpl : public AutofillDriver, |
| 36 public content::NotificationObserver, |
34 public content::WebContentsObserver, | 37 public content::WebContentsObserver, |
35 public base::SupportsUserData::Data { | 38 public base::SupportsUserData::Data { |
36 public: | 39 public: |
37 static void CreateForWebContentsAndDelegate( | 40 static void CreateForWebContentsAndDelegate( |
38 content::WebContents* contents, | 41 content::WebContents* contents, |
39 autofill::AutofillManagerDelegate* delegate, | 42 autofill::AutofillManagerDelegate* delegate, |
40 const std::string& app_locale, | 43 const std::string& app_locale, |
41 AutofillManager::AutofillDownloadManagerState enable_download_manager); | 44 AutofillManager::AutofillDownloadManagerState enable_download_manager); |
42 static AutofillDriverImpl* FromWebContents(content::WebContents* contents); | 45 static AutofillDriverImpl* FromWebContents(content::WebContents* contents); |
43 | 46 |
(...skipping 23 matching lines...) Expand all Loading... |
67 virtual void DidNavigateMainFrame( | 70 virtual void DidNavigateMainFrame( |
68 const content::LoadCommittedDetails& details, | 71 const content::LoadCommittedDetails& details, |
69 const content::FrameNavigateParams& params) OVERRIDE; | 72 const content::FrameNavigateParams& params) OVERRIDE; |
70 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 73 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
71 | 74 |
72 // Sets the manager to |manager| and sets |manager|'s external delegate | 75 // Sets the manager to |manager| and sets |manager|'s external delegate |
73 // to |autofill_external_delegate_|. Takes ownership of |manager|. | 76 // to |autofill_external_delegate_|. Takes ownership of |manager|. |
74 void SetAutofillManager(scoped_ptr<AutofillManager> manager); | 77 void SetAutofillManager(scoped_ptr<AutofillManager> manager); |
75 | 78 |
76 private: | 79 private: |
| 80 // content::NotificationObserver: |
| 81 virtual void Observe(int type, |
| 82 const content::NotificationSource& source, |
| 83 const content::NotificationDetails& details) OVERRIDE; |
| 84 |
| 85 // A scoped container for notification registries. |
| 86 content::NotificationRegistrar registrar_; |
| 87 |
77 // AutofillExternalDelegate instance that this object instantiates in the | 88 // AutofillExternalDelegate instance that this object instantiates in the |
78 // case where the autofill native UI is enabled. | 89 // case where the autofill native UI is enabled. |
79 scoped_ptr<AutofillExternalDelegate> autofill_external_delegate_; | 90 scoped_ptr<AutofillExternalDelegate> autofill_external_delegate_; |
80 | 91 |
81 // AutofillManager instance via which this object drives the shared Autofill | 92 // AutofillManager instance via which this object drives the shared Autofill |
82 // code. | 93 // code. |
83 scoped_ptr<AutofillManager> autofill_manager_; | 94 scoped_ptr<AutofillManager> autofill_manager_; |
84 }; | 95 }; |
85 | 96 |
86 } // namespace autofill | 97 } // namespace autofill |
87 | 98 |
88 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOFILL_DRIVER_IMPL_H_ | 99 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOFILL_DRIVER_IMPL_H_ |
OLD | NEW |