| 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 SingleThreadTaskRunner; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace autofill { | 27 namespace autofill { |
| 28 | 28 |
| 29 class AutofillChange; | 29 class AutofillChange; |
| 30 class AutofillEntry; | 30 class AutofillEntry; |
| 31 class AutofillProfile; | 31 class AutofillProfile; |
| 32 class AutofillWebDataBackend; | 32 class AutofillWebDataBackend; |
| 33 class AutofillWebDataBackendImpl; | 33 class AutofillWebDataBackendImpl; |
| 34 class AutofillWebDataServiceObserverOnDBThread; | 34 class AutofillWebDataServiceObserverOnDBThread; |
| 35 class AutofillWebDataServiceObserverOnUIThread; | 35 class AutofillWebDataServiceObserverOnUIThread; |
| 36 class CreditCard; | 36 class CreditCard; |
| 37 | 37 |
| 38 // API for Autofill web data. | 38 // API for Autofill web data. |
| 39 class AutofillWebDataService : public AutofillWebData, | 39 class AutofillWebDataService : public AutofillWebData, |
| 40 public WebDataServiceBase { | 40 public WebDataServiceBase { |
| 41 public: | 41 public: |
| 42 AutofillWebDataService(scoped_refptr<base::MessageLoopProxy> ui_thread, | 42 AutofillWebDataService(scoped_refptr<base::SingleThreadTaskRunner> ui_thread, |
| 43 scoped_refptr<base::MessageLoopProxy> db_thread); | 43 scoped_refptr<base::SingleThreadTaskRunner> db_thread); |
| 44 AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs, | 44 AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs, |
| 45 scoped_refptr<base::MessageLoopProxy> ui_thread, | 45 scoped_refptr<base::SingleThreadTaskRunner> ui_thread, |
| 46 scoped_refptr<base::MessageLoopProxy> db_thread, | 46 scoped_refptr<base::SingleThreadTaskRunner> db_thread, |
| 47 const ProfileErrorCallback& callback); | 47 const ProfileErrorCallback& callback); |
| 48 | 48 |
| 49 // WebDataServiceBase implementation. | 49 // WebDataServiceBase implementation. |
| 50 void ShutdownOnUIThread() override; | 50 void ShutdownOnUIThread() override; |
| 51 | 51 |
| 52 // AutofillWebData implementation. | 52 // AutofillWebData implementation. |
| 53 void AddFormFields(const std::vector<FormFieldData>& fields) override; | 53 void AddFormFields(const std::vector<FormFieldData>& fields) override; |
| 54 WebDataServiceBase::Handle GetFormValuesForElementName( | 54 WebDataServiceBase::Handle GetFormValuesForElementName( |
| 55 const base::string16& name, | 55 const base::string16& name, |
| 56 const base::string16& prefix, | 56 const base::string16& prefix, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 virtual void NotifyAutofillMultipleChangedOnUIThread(); | 126 virtual void NotifyAutofillMultipleChangedOnUIThread(); |
| 127 | 127 |
| 128 base::WeakPtr<AutofillWebDataService> AsWeakPtr() { | 128 base::WeakPtr<AutofillWebDataService> AsWeakPtr() { |
| 129 return weak_ptr_factory_.GetWeakPtr(); | 129 return weak_ptr_factory_.GetWeakPtr(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; | 133 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; |
| 134 | 134 |
| 135 // The MessageLoopProxy that this class uses as its UI thread. | 135 // The task runner that this class uses as its UI thread. |
| 136 scoped_refptr<base::MessageLoopProxy> ui_thread_; | 136 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; |
| 137 | 137 |
| 138 // The MessageLoopProxy that this class uses as its DB thread. | 138 // The task runner that this class uses as its DB thread. |
| 139 scoped_refptr<base::MessageLoopProxy> db_thread_; | 139 scoped_refptr<base::SingleThreadTaskRunner> db_thread_; |
| 140 | 140 |
| 141 scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_; | 141 scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_; |
| 142 | 142 |
| 143 // This factory is used on the UI thread. All vended weak pointers are | 143 // This factory is used on the UI thread. All vended weak pointers are |
| 144 // invalidated in ShutdownOnUIThread(). | 144 // invalidated in ShutdownOnUIThread(). |
| 145 base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_; | 145 base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_; |
| 146 | 146 |
| 147 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); | 147 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 } // namespace autofill | 150 } // namespace autofill |
| 151 | 151 |
| 152 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ | 152 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
| OLD | NEW |