1 // Copyright 2013 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.
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_H_
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h"
13 #include "components/webdata/common/web_data_service_base.h"
22 class WebDataServiceConsumer;
26 class AutofillProfile;
30 // Pure virtual interface for retrieving Autofill data. API users
31 // should use AutofillWebDataService.
32 class AutofillWebData {
34 virtual ~AutofillWebData() {}
36 // Schedules a task to add form fields to the web database.
37 virtual void AddFormFields(
38 const std::vector<FormFieldData>& fields) = 0;
40 // Initiates the request for a vector of values which have been entered in
41 // form input fields named |name|. The method OnWebDataServiceRequestDone of
42 // |consumer| gets called back when the request is finished, with the vector
43 // included in the argument |result|.
44 virtual WebDataServiceBase::Handle GetFormValuesForElementName(
45 const base::string16& name,
46 const base::string16& prefix,
48 WebDataServiceConsumer* consumer) = 0;
50 // Checks if there are any form elements in the database.
51 virtual WebDataServiceBase::Handle HasFormElements(
52 WebDataServiceConsumer* consumer) = 0;
54 // Removes form elements recorded for Autocomplete from the database.
55 virtual void RemoveFormElementsAddedBetween(
56 const base::Time& delete_begin, const base::Time& delete_end) = 0;
58 virtual void RemoveFormValueForElementName(const base::string16& name,
59 const base::string16& value) = 0;
61 // Schedules a task to add an Autofill profile to the web database.
62 virtual void AddAutofillProfile(const AutofillProfile& profile) = 0;
64 // Schedules a task to update an Autofill profile in the web database.
65 virtual void UpdateAutofillProfile(const AutofillProfile& profile) = 0;
67 // Schedules a task to remove an Autofill profile from the web database.
68 // |guid| is the identifer of the profile to remove.
69 virtual void RemoveAutofillProfile(const std::string& guid) = 0;
71 // Initiates the request for all Autofill profiles. The method
72 // OnWebDataServiceRequestDone of |consumer| gets called when the request is
73 // finished, with the profiles included in the argument |result|. The
74 // consumer owns the profiles.
75 virtual WebDataServiceBase::Handle GetAutofillProfiles(
76 WebDataServiceConsumer* consumer) = 0;
78 // Schedules a task to add credit card to the web database.
79 virtual void AddCreditCard(const CreditCard& credit_card) = 0;
81 // Schedules a task to update credit card in the web database.
82 virtual void UpdateCreditCard(const CreditCard& credit_card) = 0;
84 // Schedules a task to remove a credit card from the web database.
85 // |guid| is identifer of the credit card to remove.
86 virtual void RemoveCreditCard(const std::string& guid) = 0;
88 // Initiates the request for all credit cards. The method
89 // OnWebDataServiceRequestDone of |consumer| gets called when the request is
90 // finished, with the credit cards included in the argument |result|. The
91 // consumer owns the credit cards.
92 virtual WebDataServiceBase::Handle GetCreditCards(
93 WebDataServiceConsumer* consumer) = 0;
95 // Removes Autofill records from the database.
96 virtual void RemoveAutofillDataModifiedBetween(
97 const base::Time& delete_begin, const base::Time& delete_end) = 0;
99 // Removes origin URLs associated with Autofill profiles and credit cards from
101 virtual void RemoveOriginURLsModifiedBetween(
102 const base::Time& delete_begin, const base::Time& delete_end) = 0;
105 } // namespace autofill
107 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_H_