| 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_API_WEBDATA_AUTOFILL_WEB_DATA_H_ |
| 6 #define CHROME_BROWSER_API_WEBDATA_AUTOFILL_WEB_DATA_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/string16.h" |
| 11 #include "chrome/browser/api/webdata/web_data_service_base.h" |
| 12 #include "chrome/browser/api/webdata/web_data_service_consumer.h" |
| 13 |
| 14 namespace webkit { |
| 15 namespace forms { |
| 16 struct FormField; |
| 17 } |
| 18 } |
| 19 |
| 20 class AutofillProfile; |
| 21 class CreditCard; |
| 22 class Profile; |
| 23 |
| 24 class AutofillWebData { |
| 25 public: |
| 26 // Retrieve an AutofillWebData interface for the specified service. |
| 27 // This pointer is valid as long as you hold a reference to |
| 28 // |service|. |
| 29 static AutofillWebData* ForService(WebDataServiceBase* service); |
| 30 |
| 31 virtual ~AutofillWebData() {} |
| 32 |
| 33 // Schedules a task to add form fields to the web database. |
| 34 virtual void AddFormFields( |
| 35 const std::vector<webkit::forms::FormField>& fields) = 0; |
| 36 |
| 37 // Initiates the request for a vector of values which have been entered in |
| 38 // form input fields named |name|. The method OnWebDataServiceRequestDone of |
| 39 // |consumer| gets called back when the request is finished, with the vector |
| 40 // included in the argument |result|. |
| 41 virtual WebDataServiceBase::Handle GetFormValuesForElementName( |
| 42 const string16& name, |
| 43 const string16& prefix, |
| 44 int limit, |
| 45 WebDataServiceConsumer* consumer) = 0; |
| 46 |
| 47 virtual void RemoveExpiredFormElements() = 0; |
| 48 virtual void RemoveFormValueForElementName(const string16& name, |
| 49 const string16& value) = 0; |
| 50 |
| 51 // Schedules a task to add an Autofill profile to the web database. |
| 52 virtual void AddAutofillProfile(const AutofillProfile& profile) = 0; |
| 53 |
| 54 // Schedules a task to update an Autofill profile in the web database. |
| 55 virtual void UpdateAutofillProfile(const AutofillProfile& profile) = 0; |
| 56 |
| 57 // Schedules a task to remove an Autofill profile from the web database. |
| 58 // |guid| is the identifer of the profile to remove. |
| 59 virtual void RemoveAutofillProfile(const std::string& guid) = 0; |
| 60 |
| 61 // Initiates the request for all Autofill profiles. The method |
| 62 // OnWebDataServiceRequestDone of |consumer| gets called when the request is |
| 63 // finished, with the profiles included in the argument |result|. The |
| 64 // consumer owns the profiles. |
| 65 virtual WebDataServiceBase::Handle GetAutofillProfiles( |
| 66 WebDataServiceConsumer* consumer) = 0; |
| 67 |
| 68 // Remove "trashed" profile guids from the web database and optionally send |
| 69 // notifications to tell Sync that the items have been removed. |
| 70 virtual void EmptyMigrationTrash(bool notify_sync) = 0; |
| 71 |
| 72 // Schedules a task to add credit card to the web database. |
| 73 virtual void AddCreditCard(const CreditCard& credit_card) = 0; |
| 74 |
| 75 // Schedules a task to update credit card in the web database. |
| 76 virtual void UpdateCreditCard(const CreditCard& credit_card) = 0; |
| 77 |
| 78 // Schedules a task to remove a credit card from the web database. |
| 79 // |guid| is identifer of the credit card to remove. |
| 80 virtual void RemoveCreditCard(const std::string& guid) = 0; |
| 81 |
| 82 // Initiates the request for all credit cards. The method |
| 83 // OnWebDataServiceRequestDone of |consumer| gets called when the request is |
| 84 // finished, with the credit cards included in the argument |result|. The |
| 85 // consumer owns the credit cards. |
| 86 virtual WebDataServiceBase::Handle |
| 87 GetCreditCards(WebDataServiceConsumer* consumer) = 0; |
| 88 }; |
| 89 |
| 90 #endif // CHROME_BROWSER_API_WEBDATA_AUTOFILL_WEB_DATA_H_ |
| OLD | NEW |