| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 12 #include "components/autofill/browser/webdata/autofill_webdata.h" | 13 #include "components/autofill/browser/webdata/autofill_webdata.h" |
| 14 #include "components/autofill/common/autofill_export.h" |
| 13 #include "components/autofill/common/form_field_data.h" | 15 #include "components/autofill/common/form_field_data.h" |
| 14 #include "components/webdata/common/web_data_results.h" | 16 #include "components/webdata/common/web_data_results.h" |
| 15 #include "components/webdata/common/web_data_service_base.h" | 17 #include "components/webdata/common/web_data_service_base.h" |
| 16 #include "components/webdata/common/web_data_service_consumer.h" | 18 #include "components/webdata/common/web_data_service_consumer.h" |
| 17 #include "components/webdata/common/web_database.h" | 19 #include "components/webdata/common/web_database.h" |
| 18 | 20 |
| 19 class WebDatabaseService; | 21 class WebDatabaseService; |
| 20 | 22 |
| 21 namespace content { | 23 namespace content { |
| 22 class BrowserContext; | 24 class BrowserContext; |
| 23 } | 25 } |
| 24 | 26 |
| 25 namespace autofill { | 27 namespace autofill { |
| 26 | 28 |
| 27 class AutofillChange; | 29 class AutofillChange; |
| 28 class AutofillProfile; | 30 class AutofillProfile; |
| 29 class AutofillWebDataServiceObserverOnDBThread; | 31 class AutofillWebDataServiceObserverOnDBThread; |
| 30 class AutofillWebDataServiceObserverOnUIThread; | 32 class AutofillWebDataServiceObserverOnUIThread; |
| 31 class CreditCard; | 33 class CreditCard; |
| 32 | 34 |
| 33 // API for Autofill web data. | 35 // API for Autofill web data. |
| 34 class AutofillWebDataService : public AutofillWebData, | 36 class AUTOFILL_EXPORT AutofillWebDataService |
| 35 public WebDataServiceBase { | 37 : NON_EXPORTED_BASE(public AutofillWebData), |
| 38 public WebDataServiceBase { |
| 36 public: | 39 public: |
| 37 AutofillWebDataService(); | 40 AutofillWebDataService(); |
| 38 | 41 |
| 39 AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs, | 42 AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs, |
| 40 const ProfileErrorCallback& callback); | 43 const ProfileErrorCallback& callback); |
| 41 | 44 |
| 42 // Retrieve an AutofillWebDataService for the given context. | |
| 43 // Can return NULL in some contexts. | |
| 44 static scoped_refptr<AutofillWebDataService> FromBrowserContext( | |
| 45 content::BrowserContext* context); | |
| 46 | |
| 47 // Notifies listeners on the UI thread that multiple changes have been made to | 45 // Notifies listeners on the UI thread that multiple changes have been made to |
| 48 // to Autofill records of the database. | 46 // to Autofill records of the database. |
| 49 // NOTE: This method is intended to be called from the DB thread. It | 47 // NOTE: This method is intended to be called from the DB thread. It |
| 50 // it asynchronously notifies listeners on the UI thread. | 48 // it asynchronously notifies listeners on the UI thread. |
| 51 // |web_data_service| may be NULL for testing purposes. | 49 // |web_data_service| may be NULL for testing purposes. |
| 52 static void NotifyOfMultipleAutofillChanges( | 50 static void NotifyOfMultipleAutofillChanges( |
| 53 AutofillWebDataService* web_data_service); | 51 AutofillWebDataService* web_data_service); |
| 54 | 52 |
| 55 // AutofillWebData implementation. | 53 // AutofillWebData implementation. |
| 56 virtual void AddFormFields( | 54 virtual void AddFormFields( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 128 |
| 131 ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_; | 129 ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_; |
| 132 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; | 130 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; |
| 133 | 131 |
| 134 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); | 132 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); |
| 135 }; | 133 }; |
| 136 | 134 |
| 137 } // namespace autofill | 135 } // namespace autofill |
| 138 | 136 |
| 139 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ | 137 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
| OLD | NEW |