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