Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: chrome/browser/api/webdata/autofill_web_data.h

Issue 10908065: Introduce a couple of abstract bases for WebDataService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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"
erikwright (departed) 2012/09/13 01:45:11 forward-decl?
Jói 2012/09/13 12:34:50 Done.
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
erikwright (departed) 2012/09/13 01:45:11 It may seem pedantic, but I wish this were in its
Jói 2012/09/13 12:34:50 Done.
94 : public AutofillWebData,
95 public WebDataServiceBase {
96 public:
97 // Retrieve an AutofillWebDataService for the given context.
98 //
99 // Can return NULL in some contexts.
100 static scoped_ptr<AutofillWebDataService> ForContext(
101 content::BrowserContext* context);
102
103 virtual ~AutofillWebDataService() {}
104 };
105
106 #endif // CHROME_BROWSER_API_WEBDATA_AUTOFILL_WEB_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698