| 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_WEBDATA_AUTOFILL_AUTOFILL_WEBDATA_SERVICE_H_ | 5 #ifndef COMPONENTS_WEBDATA_AUTOFILL_AUTOFILL_WEBDATA_SERVICE_H_ |
| 6 #define COMPONENTS_WEBDATA_AUTOFILL_AUTOFILL_WEBDATA_SERVICE_H_ | 6 #define COMPONENTS_WEBDATA_AUTOFILL_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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // NOTE: This method is intended to be called from the DB thread. It | 46 // NOTE: This method is intended to be called from the DB thread. It |
| 47 // it asynchronously notifies listeners on the UI thread. | 47 // it asynchronously notifies listeners on the UI thread. |
| 48 // |web_data_service| may be NULL for testing purposes. | 48 // |web_data_service| may be NULL for testing purposes. |
| 49 static void NotifyOfMultipleAutofillChanges( | 49 static void NotifyOfMultipleAutofillChanges( |
| 50 AutofillWebDataService* web_data_service); | 50 AutofillWebDataService* web_data_service); |
| 51 | 51 |
| 52 // AutofillWebData implementation. | 52 // AutofillWebData implementation. |
| 53 virtual void AddFormFields( | 53 virtual void AddFormFields( |
| 54 const std::vector<FormFieldData>& fields) OVERRIDE; | 54 const std::vector<FormFieldData>& fields) OVERRIDE; |
| 55 virtual WebDataServiceBase::Handle GetFormValuesForElementName( | 55 virtual WebDataServiceBase::Handle GetFormValuesForElementName( |
| 56 const string16& name, | 56 const base::string16& name, |
| 57 const string16& prefix, | 57 const base::string16& prefix, |
| 58 int limit, | 58 int limit, |
| 59 WebDataServiceConsumer* consumer) OVERRIDE; | 59 WebDataServiceConsumer* consumer) OVERRIDE; |
| 60 virtual void RemoveFormElementsAddedBetween( | 60 virtual void RemoveFormElementsAddedBetween( |
| 61 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; | 61 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; |
| 62 virtual void RemoveExpiredFormElements() OVERRIDE; | 62 virtual void RemoveExpiredFormElements() OVERRIDE; |
| 63 virtual void RemoveFormValueForElementName(const string16& name, | 63 virtual void RemoveFormValueForElementName( |
| 64 const string16& value) OVERRIDE; | 64 const base::string16& name, |
| 65 const base::string16& value) OVERRIDE; |
| 65 virtual void AddAutofillProfile(const AutofillProfile& profile) OVERRIDE; | 66 virtual void AddAutofillProfile(const AutofillProfile& profile) OVERRIDE; |
| 66 virtual void UpdateAutofillProfile(const AutofillProfile& profile) OVERRIDE; | 67 virtual void UpdateAutofillProfile(const AutofillProfile& profile) OVERRIDE; |
| 67 virtual void RemoveAutofillProfile(const std::string& guid) OVERRIDE; | 68 virtual void RemoveAutofillProfile(const std::string& guid) OVERRIDE; |
| 68 virtual WebDataServiceBase::Handle GetAutofillProfiles( | 69 virtual WebDataServiceBase::Handle GetAutofillProfiles( |
| 69 WebDataServiceConsumer* consumer) OVERRIDE; | 70 WebDataServiceConsumer* consumer) OVERRIDE; |
| 70 virtual void AddCreditCard(const CreditCard& credit_card) OVERRIDE; | 71 virtual void AddCreditCard(const CreditCard& credit_card) OVERRIDE; |
| 71 virtual void UpdateCreditCard(const CreditCard& credit_card) OVERRIDE; | 72 virtual void UpdateCreditCard(const CreditCard& credit_card) OVERRIDE; |
| 72 virtual void RemoveCreditCard(const std::string& guid) OVERRIDE; | 73 virtual void RemoveCreditCard(const std::string& guid) OVERRIDE; |
| 73 virtual WebDataServiceBase::Handle GetCreditCards( | 74 virtual WebDataServiceBase::Handle GetCreditCards( |
| 74 WebDataServiceConsumer* consumer) OVERRIDE; | 75 WebDataServiceConsumer* consumer) OVERRIDE; |
| 75 virtual void RemoveAutofillDataModifiedBetween( | 76 virtual void RemoveAutofillDataModifiedBetween( |
| 76 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; | 77 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; |
| 77 | 78 |
| 78 void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer); | 79 void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer); |
| 79 void RemoveObserver(AutofillWebDataServiceObserverOnDBThread* observer); | 80 void RemoveObserver(AutofillWebDataServiceObserverOnDBThread* observer); |
| 80 | 81 |
| 81 void AddObserver(AutofillWebDataServiceObserverOnUIThread* observer); | 82 void AddObserver(AutofillWebDataServiceObserverOnUIThread* observer); |
| 82 void RemoveObserver(AutofillWebDataServiceObserverOnUIThread* observer); | 83 void RemoveObserver(AutofillWebDataServiceObserverOnUIThread* observer); |
| 83 | 84 |
| 84 protected: | 85 protected: |
| 85 virtual ~AutofillWebDataService(); | 86 virtual ~AutofillWebDataService(); |
| 86 | 87 |
| 87 // WebDataServiceBase overrides: | 88 // WebDataServiceBase overrides: |
| 88 virtual void NotifyDatabaseLoadedOnUIThread() OVERRIDE; | 89 virtual void NotifyDatabaseLoadedOnUIThread() OVERRIDE; |
| 89 | 90 |
| 90 private: | 91 private: |
| 91 WebDatabase::State AddFormElementsImpl( | 92 WebDatabase::State AddFormElementsImpl( |
| 92 const std::vector<FormFieldData>& fields, WebDatabase* db); | 93 const std::vector<FormFieldData>& fields, WebDatabase* db); |
| 93 scoped_ptr<WDTypedResult> GetFormValuesForElementNameImpl( | 94 scoped_ptr<WDTypedResult> GetFormValuesForElementNameImpl( |
| 94 const string16& name, const string16& prefix, int limit, WebDatabase* db); | 95 const base::string16& name, const base::string16& prefix, int limit, |
| 96 WebDatabase* db); |
| 95 WebDatabase::State RemoveFormElementsAddedBetweenImpl( | 97 WebDatabase::State RemoveFormElementsAddedBetweenImpl( |
| 96 const base::Time& delete_begin, const base::Time& delete_end, | 98 const base::Time& delete_begin, const base::Time& delete_end, |
| 97 WebDatabase* db); | 99 WebDatabase* db); |
| 98 WebDatabase::State RemoveExpiredFormElementsImpl(WebDatabase* db); | 100 WebDatabase::State RemoveExpiredFormElementsImpl(WebDatabase* db); |
| 99 WebDatabase::State RemoveFormValueForElementNameImpl( | 101 WebDatabase::State RemoveFormValueForElementNameImpl( |
| 100 const string16& name, const string16& value, WebDatabase* db); | 102 const base::string16& name, const base::string16& value, WebDatabase* db); |
| 101 WebDatabase::State AddAutofillProfileImpl( | 103 WebDatabase::State AddAutofillProfileImpl( |
| 102 const AutofillProfile& profile, WebDatabase* db); | 104 const AutofillProfile& profile, WebDatabase* db); |
| 103 WebDatabase::State UpdateAutofillProfileImpl( | 105 WebDatabase::State UpdateAutofillProfileImpl( |
| 104 const AutofillProfile& profile, WebDatabase* db); | 106 const AutofillProfile& profile, WebDatabase* db); |
| 105 WebDatabase::State RemoveAutofillProfileImpl( | 107 WebDatabase::State RemoveAutofillProfileImpl( |
| 106 const std::string& guid, WebDatabase* db); | 108 const std::string& guid, WebDatabase* db); |
| 107 scoped_ptr<WDTypedResult> GetAutofillProfilesImpl(WebDatabase* db); | 109 scoped_ptr<WDTypedResult> GetAutofillProfilesImpl(WebDatabase* db); |
| 108 WebDatabase::State AddCreditCardImpl( | 110 WebDatabase::State AddCreditCardImpl( |
| 109 const CreditCard& credit_card, WebDatabase* db); | 111 const CreditCard& credit_card, WebDatabase* db); |
| 110 WebDatabase::State UpdateCreditCardImpl( | 112 WebDatabase::State UpdateCreditCardImpl( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 123 | 125 |
| 124 void NotifyAutofillMultipleChangedOnUIThread(); | 126 void NotifyAutofillMultipleChangedOnUIThread(); |
| 125 | 127 |
| 126 ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_; | 128 ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_; |
| 127 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; | 129 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; |
| 128 | 130 |
| 129 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); | 131 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); |
| 130 }; | 132 }; |
| 131 | 133 |
| 132 #endif // COMPONENTS_WEBDATA_AUTOFILL_AUTOFILL_WEBDATA_SERVICE_H_ | 134 #endif // COMPONENTS_WEBDATA_AUTOFILL_AUTOFILL_WEBDATA_SERVICE_H_ |
| OLD | NEW |