| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_WEB_DATA_SERVICE_IMPL_H_ | |
| 6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_WEB_DATA_SERVICE_IMPL_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "chrome/browser/api/webdata/autofill_web_data_service.h" | |
| 10 #include "chrome/browser/api/webdata/web_data_results.h" | |
| 11 #include "chrome/browser/api/webdata/web_data_service_base.h" | |
| 12 #include "chrome/browser/api/webdata/web_data_service_consumer.h" | |
| 13 #include "chrome/browser/webdata/web_database.h" | |
| 14 | |
| 15 class AutofillChange; | |
| 16 class WebDatabaseService; | |
| 17 | |
| 18 // This aggregates a WebDataService and delegates all method calls to | |
| 19 // it. | |
| 20 class AutofillWebDataServiceImpl : public AutofillWebDataService { | |
| 21 public: | |
| 22 AutofillWebDataServiceImpl(scoped_refptr<WebDatabaseService> wdbs, | |
| 23 const ProfileErrorCallback& callback); | |
| 24 | |
| 25 // WebDataServiceBase overrides: | |
| 26 virtual content::NotificationSource GetNotificationSource() OVERRIDE; | |
| 27 | |
| 28 // AutofillWebData implementation. | |
| 29 virtual void AddFormFields( | |
| 30 const std::vector<FormFieldData>& fields) OVERRIDE; | |
| 31 virtual WebDataServiceBase::Handle GetFormValuesForElementName( | |
| 32 const string16& name, | |
| 33 const string16& prefix, | |
| 34 int limit, | |
| 35 WebDataServiceConsumer* consumer) OVERRIDE; | |
| 36 virtual void RemoveFormElementsAddedBetween( | |
| 37 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; | |
| 38 virtual void RemoveExpiredFormElements() OVERRIDE; | |
| 39 virtual void RemoveFormValueForElementName(const string16& name, | |
| 40 const string16& value) OVERRIDE; | |
| 41 virtual void AddAutofillProfile(const AutofillProfile& profile) OVERRIDE; | |
| 42 virtual void UpdateAutofillProfile(const AutofillProfile& profile) OVERRIDE; | |
| 43 virtual void RemoveAutofillProfile(const std::string& guid) OVERRIDE; | |
| 44 virtual WebDataServiceBase::Handle GetAutofillProfiles( | |
| 45 WebDataServiceConsumer* consumer) OVERRIDE; | |
| 46 virtual void AddCreditCard(const CreditCard& credit_card) OVERRIDE; | |
| 47 virtual void UpdateCreditCard(const CreditCard& credit_card) OVERRIDE; | |
| 48 virtual void RemoveCreditCard(const std::string& guid) OVERRIDE; | |
| 49 virtual WebDataServiceBase::Handle GetCreditCards( | |
| 50 WebDataServiceConsumer* consumer) OVERRIDE; | |
| 51 virtual void RemoveAutofillDataModifiedBetween( | |
| 52 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; | |
| 53 | |
| 54 | |
| 55 protected: | |
| 56 virtual ~AutofillWebDataServiceImpl(); | |
| 57 | |
| 58 private: | |
| 59 WebDatabase::State AddFormElementsImpl( | |
| 60 const std::vector<FormFieldData>& fields, WebDatabase* db); | |
| 61 scoped_ptr<WDTypedResult> GetFormValuesForElementNameImpl( | |
| 62 const string16& name, const string16& prefix, int limit, WebDatabase* db); | |
| 63 WebDatabase::State RemoveFormElementsAddedBetweenImpl( | |
| 64 const base::Time& delete_begin, const base::Time& delete_end, | |
| 65 WebDatabase* db); | |
| 66 WebDatabase::State RemoveExpiredFormElementsImpl(WebDatabase* db); | |
| 67 WebDatabase::State RemoveFormValueForElementNameImpl( | |
| 68 const string16& name, const string16& value, WebDatabase* db); | |
| 69 WebDatabase::State AddAutofillProfileImpl( | |
| 70 const AutofillProfile& profile, WebDatabase* db); | |
| 71 WebDatabase::State UpdateAutofillProfileImpl( | |
| 72 const AutofillProfile& profile, WebDatabase* db); | |
| 73 WebDatabase::State RemoveAutofillProfileImpl( | |
| 74 const std::string& guid, WebDatabase* db); | |
| 75 scoped_ptr<WDTypedResult> GetAutofillProfilesImpl(WebDatabase* db); | |
| 76 WebDatabase::State AddCreditCardImpl( | |
| 77 const CreditCard& credit_card, WebDatabase* db); | |
| 78 WebDatabase::State UpdateCreditCardImpl( | |
| 79 const CreditCard& credit_card, WebDatabase* db); | |
| 80 WebDatabase::State RemoveCreditCardImpl( | |
| 81 const std::string& guid, WebDatabase* db); | |
| 82 scoped_ptr<WDTypedResult> GetCreditCardsImpl(WebDatabase* db); | |
| 83 WebDatabase::State RemoveAutofillDataModifiedBetweenImpl( | |
| 84 const base::Time& delete_begin, const base::Time& delete_end, | |
| 85 WebDatabase* db); | |
| 86 | |
| 87 // Callbacks to ensure that sensitive info is destroyed if request is | |
| 88 // cancelled. | |
| 89 void DestroyAutofillProfileResult(const WDTypedResult* result); | |
| 90 void DestroyAutofillCreditCardResult(const WDTypedResult* result); | |
| 91 | |
| 92 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataServiceImpl); | |
| 93 }; | |
| 94 | |
| 95 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_WEB_DATA_SERVICE_IMPL_H_ | |
| OLD | NEW |