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