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

Side by Side Diff: chrome/browser/webdata/autofill_web_data_service_impl.h

Issue 12695015: Split Autofill webdata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_WEB_DATA_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_WEB_DATA_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_WEB_DATA_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_WEB_DATA_SERVICE_IMPL_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "chrome/browser/api/webdata/autofill_web_data_service.h" 9 #include "chrome/browser/api/webdata/autofill_web_data_service.h"
10 #include "chrome/browser/api/webdata/web_data_results.h"
11 #include "chrome/browser/api/webdata/web_data_service_base.h"
12 #include "chrome/browser/api/webdata/web_data_service_consumer.h"
13 #include "chrome/browser/webdata/web_database.h"
10 14
11 class WebDataService; 15 class AutofillChange;
16 class WebDatabaseService;
12 17
13 // This aggregates a WebDataService and delegates all method calls to 18 // This aggregates a WebDataService and delegates all method calls to
14 // it. 19 // it.
15 class AutofillWebDataServiceImpl : public AutofillWebDataService { 20 class AutofillWebDataServiceImpl : public AutofillWebDataService {
16 public: 21 public:
17 explicit AutofillWebDataServiceImpl(scoped_refptr<WebDataService> service); 22 AutofillWebDataServiceImpl(scoped_refptr<WebDatabaseService> wdbs,
Jói 2013/03/19 20:53:58 Both parameters should align to the opening parent
Cait (Slow) 2013/03/20 22:21:10 Done.
23 const ProfileErrorCallback& callback);
18 24
19 // AutofillWebData implementation. 25 // AutofillWebData implementation.
20 virtual void AddFormFields( 26 virtual void AddFormFields(
21 const std::vector<FormFieldData>& fields) OVERRIDE; 27 const std::vector<FormFieldData>& fields) OVERRIDE;
22 virtual WebDataServiceBase::Handle GetFormValuesForElementName( 28 virtual WebDataServiceBase::Handle GetFormValuesForElementName(
23 const string16& name, 29 const string16& name,
24 const string16& prefix, 30 const string16& prefix,
25 int limit, 31 int limit,
26 WebDataServiceConsumer* consumer) OVERRIDE; 32 WebDataServiceConsumer* consumer) OVERRIDE;
27 virtual void RemoveExpiredFormElements() OVERRIDE; 33 virtual void RemoveExpiredFormElements() OVERRIDE;
28 virtual void RemoveFormValueForElementName(const string16& name, 34 virtual void RemoveFormValueForElementName(const string16& name,
29 const string16& value) OVERRIDE; 35 const string16& value) OVERRIDE;
30 virtual void AddAutofillProfile(const AutofillProfile& profile) OVERRIDE; 36 virtual void AddAutofillProfile(const AutofillProfile& profile) OVERRIDE;
31 virtual void UpdateAutofillProfile(const AutofillProfile& profile) OVERRIDE; 37 virtual void UpdateAutofillProfile(const AutofillProfile& profile) OVERRIDE;
32 virtual void RemoveAutofillProfile(const std::string& guid) OVERRIDE; 38 virtual void RemoveAutofillProfile(const std::string& guid) OVERRIDE;
33 virtual WebDataServiceBase::Handle GetAutofillProfiles( 39 virtual WebDataServiceBase::Handle GetAutofillProfiles(
34 WebDataServiceConsumer* consumer) OVERRIDE; 40 WebDataServiceConsumer* consumer) OVERRIDE;
35 virtual void AddCreditCard(const CreditCard& credit_card) OVERRIDE; 41 virtual void AddCreditCard(const CreditCard& credit_card) OVERRIDE;
36 virtual void UpdateCreditCard(const CreditCard& credit_card) OVERRIDE; 42 virtual void UpdateCreditCard(const CreditCard& credit_card) OVERRIDE;
37 virtual void RemoveCreditCard(const std::string& guid) OVERRIDE; 43 virtual void RemoveCreditCard(const std::string& guid) OVERRIDE;
38 virtual WebDataServiceBase::Handle 44 virtual WebDataServiceBase::Handle
39 GetCreditCards(WebDataServiceConsumer* consumer) OVERRIDE; 45 GetCreditCards(WebDataServiceConsumer* consumer) OVERRIDE;
40 46
41 // WebDataServiceBase overrides.
42 // TODO(caitkp): remove these when we decouple
43 // WebDatabaseService life cycle from WebData).
44 virtual void CancelRequest(Handle h) OVERRIDE;
45 virtual content::NotificationSource GetNotificationSource() OVERRIDE;
46 virtual bool IsDatabaseLoaded() OVERRIDE;
47 virtual WebDatabase* GetDatabase() OVERRIDE;
48
49
50 protected: 47 protected:
51 virtual ~AutofillWebDataServiceImpl(); 48 virtual ~AutofillWebDataServiceImpl();
52 49
53 private: 50 private:
51 WebDatabase::State AddFormElementsImpl(
52 const std::vector<FormFieldData>& fields, WebDatabase* db);
53 scoped_ptr<WDTypedResult> GetFormValuesForElementNameImpl(
54 const string16& name, const string16& prefix, int limit, WebDatabase* db);
55 WebDatabase::State RemoveFormElementsAddedBetweenImpl(
56 const base::Time& delete_begin, const base::Time& delete_end,
57 WebDatabase* db);
58 WebDatabase::State RemoveExpiredFormElementsImpl(WebDatabase* db);
59 WebDatabase::State RemoveFormValueForElementNameImpl(
60 const string16& name, const string16& value, WebDatabase* db);
61 WebDatabase::State AddAutofillProfileImpl(
62 const AutofillProfile& profile, WebDatabase* db);
63 WebDatabase::State UpdateAutofillProfileImpl(
64 const AutofillProfile& profile, WebDatabase* db);
65 WebDatabase::State RemoveAutofillProfileImpl(
66 const std::string& guid, WebDatabase* db);
67 scoped_ptr<WDTypedResult> GetAutofillProfilesImpl(WebDatabase* db);
68 WebDatabase::State AddCreditCardImpl(
69 const CreditCard& credit_card, WebDatabase* db);
70 WebDatabase::State UpdateCreditCardImpl(
71 const CreditCard& credit_card, WebDatabase* db);
72 WebDatabase::State RemoveCreditCardImpl(
73 const std::string& guid, WebDatabase* db);
74 scoped_ptr<WDTypedResult> GetCreditCardsImpl(WebDatabase* db);
75
76 // Callbacks to ensure that sensitive info is destroyed if request is
77 // cancelled.
78 void DestroyAutofillProfileResult(const WDTypedResult* result);
79 void DestroyAutofillCreditCardResult(const WDTypedResult* result);
80
54 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataServiceImpl); 81 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataServiceImpl);
55
56 const scoped_refptr<WebDataService> service_;
57 }; 82 };
58 83
59 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_WEB_DATA_SERVICE_IMPL_H_ 84 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_WEB_DATA_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698