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_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/supports_user_data.h" | 13 #include "base/supports_user_data.h" |
14 #include "components/autofill/core/browser/webdata/autofill_webdata.h" | 14 #include "components/autofill/core/browser/webdata/autofill_webdata.h" |
15 #include "components/autofill/core/common/form_field_data.h" | 15 #include "components/autofill/core/common/form_field_data.h" |
16 #include "components/webdata/common/web_data_results.h" | 16 #include "components/webdata/common/web_data_results.h" |
17 #include "components/webdata/common/web_data_service_base.h" | 17 #include "components/webdata/common/web_data_service_base.h" |
18 #include "components/webdata/common/web_data_service_consumer.h" | 18 #include "components/webdata/common/web_data_service_consumer.h" |
19 #include "components/webdata/common/web_database.h" | 19 #include "components/webdata/common/web_database.h" |
20 | 20 |
21 class WebDatabaseService; | 21 class WebDatabaseService; |
22 | 22 |
23 namespace base { | 23 namespace base { |
24 class MessageLoopProxy; | 24 class MessageLoopProxy; |
25 } | 25 } |
26 | 26 |
27 namespace content { | |
28 class BrowserContext; | |
29 } | |
30 | |
31 namespace autofill { | 27 namespace autofill { |
32 | 28 |
33 class AutofillChange; | 29 class AutofillChange; |
34 class AutofillProfile; | 30 class AutofillProfile; |
35 class AutofillWebDataBackend; | 31 class AutofillWebDataBackend; |
36 class AutofillWebDataBackendImpl; | 32 class AutofillWebDataBackendImpl; |
37 class AutofillWebDataServiceObserverOnDBThread; | 33 class AutofillWebDataServiceObserverOnDBThread; |
38 class AutofillWebDataServiceObserverOnUIThread; | 34 class AutofillWebDataServiceObserverOnUIThread; |
39 class CreditCard; | 35 class CreditCard; |
40 | 36 |
41 // API for Autofill web data. | 37 // API for Autofill web data. |
42 class AutofillWebDataService : public AutofillWebData, | 38 class AutofillWebDataService : public AutofillWebData, |
43 public WebDataServiceBase { | 39 public WebDataServiceBase { |
44 public: | 40 public: |
45 AutofillWebDataService(scoped_refptr<base::MessageLoopProxy> ui_thread, | 41 AutofillWebDataService(scoped_refptr<base::MessageLoopProxy> ui_thread, |
46 scoped_refptr<base::MessageLoopProxy> db_thread); | 42 scoped_refptr<base::MessageLoopProxy> db_thread); |
47 AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs, | 43 AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs, |
48 scoped_refptr<base::MessageLoopProxy> ui_thread, | 44 scoped_refptr<base::MessageLoopProxy> ui_thread, |
49 scoped_refptr<base::MessageLoopProxy> db_thread, | 45 scoped_refptr<base::MessageLoopProxy> db_thread, |
50 const ProfileErrorCallback& callback); | 46 const ProfileErrorCallback& callback); |
51 | 47 |
52 // Retrieve an AutofillWebDataService for the given context. | |
53 // Can return NULL in some contexts. | |
54 static scoped_refptr<AutofillWebDataService> FromBrowserContext( | |
55 content::BrowserContext* context); | |
56 | |
57 // WebDataServiceBase implementation. | 48 // WebDataServiceBase implementation. |
58 virtual void ShutdownOnUIThread() OVERRIDE; | 49 virtual void ShutdownOnUIThread() OVERRIDE; |
59 | 50 |
60 // AutofillWebData implementation. | 51 // AutofillWebData implementation. |
61 virtual void AddFormFields( | 52 virtual void AddFormFields( |
62 const std::vector<FormFieldData>& fields) OVERRIDE; | 53 const std::vector<FormFieldData>& fields) OVERRIDE; |
63 virtual WebDataServiceBase::Handle GetFormValuesForElementName( | 54 virtual WebDataServiceBase::Handle GetFormValuesForElementName( |
64 const base::string16& name, | 55 const base::string16& name, |
65 const base::string16& prefix, | 56 const base::string16& prefix, |
66 int limit, | 57 int limit, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_; | 120 base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_; |
130 | 121 |
131 scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_; | 122 scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_; |
132 | 123 |
133 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); | 124 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); |
134 }; | 125 }; |
135 | 126 |
136 } // namespace autofill | 127 } // namespace autofill |
137 | 128 |
138 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ | 129 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
OLD | NEW |