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

Side by Side Diff: components/autofill/browser/webdata/autofill_webdata_service.h

Issue 14348036: Move AutofillWebData DB methods into separate class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge Created 7 years, 7 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 COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_
6 #define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ 6 #define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "base/supports_user_data.h" 12 #include "base/supports_user_data.h"
13 #include "components/autofill/browser/webdata/autofill_webdata.h" 13 #include "components/autofill/browser/webdata/autofill_webdata.h"
14 #include "components/autofill/common/form_field_data.h" 14 #include "components/autofill/common/form_field_data.h"
15 #include "components/webdata/common/web_data_results.h" 15 #include "components/webdata/common/web_data_results.h"
16 #include "components/webdata/common/web_data_service_base.h" 16 #include "components/webdata/common/web_data_service_base.h"
17 #include "components/webdata/common/web_data_service_consumer.h" 17 #include "components/webdata/common/web_data_service_consumer.h"
18 #include "components/webdata/common/web_database.h" 18 #include "components/webdata/common/web_database.h"
19 19
20 class WebDatabaseService; 20 class WebDatabaseService;
21 21
22 namespace content { 22 namespace content {
23 class BrowserContext; 23 class BrowserContext;
24 } 24 }
25 25
26 namespace autofill { 26 namespace autofill {
27 27
28 class AutofillChange; 28 class AutofillChange;
29 class AutofillProfile; 29 class AutofillProfile;
30 class AutofillWebDataBackend;
30 class AutofillWebDataServiceObserverOnDBThread; 31 class AutofillWebDataServiceObserverOnDBThread;
31 class AutofillWebDataServiceObserverOnUIThread; 32 class AutofillWebDataServiceObserverOnUIThread;
32 class CreditCard; 33 class CreditCard;
33 34
34 // API for Autofill web data. 35 // API for Autofill web data.
35 class AutofillWebDataService : public AutofillWebData, 36 class AutofillWebDataService : public AutofillWebData,
36 public WebDataServiceBase { 37 public WebDataServiceBase {
37 public: 38 public:
38 AutofillWebDataService(); 39 AutofillWebDataService();
39 40
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // the DB thread, and will be destroyed on the DB thread soon after 95 // the DB thread, and will be destroyed on the DB thread soon after
95 // |ShutdownOnUIThread()| is called. 96 // |ShutdownOnUIThread()| is called.
96 base::SupportsUserData* GetDBUserData(); 97 base::SupportsUserData* GetDBUserData();
97 98
98 protected: 99 protected:
99 virtual ~AutofillWebDataService(); 100 virtual ~AutofillWebDataService();
100 101
101 virtual void ShutdownOnDBThread(); 102 virtual void ShutdownOnDBThread();
102 103
103 private: 104 private:
104 WebDatabase::State AddFormElementsImpl(
105 const std::vector<FormFieldData>& fields, WebDatabase* db);
106 scoped_ptr<WDTypedResult> GetFormValuesForElementNameImpl(
107 const base::string16& name, const base::string16& prefix, int limit,
108 WebDatabase* db);
109 WebDatabase::State RemoveFormElementsAddedBetweenImpl(
110 const base::Time& delete_begin, const base::Time& delete_end,
111 WebDatabase* db);
112 WebDatabase::State RemoveExpiredFormElementsImpl(WebDatabase* db);
113 WebDatabase::State RemoveFormValueForElementNameImpl(
114 const base::string16& name, const base::string16& value, WebDatabase* db);
115 WebDatabase::State AddAutofillProfileImpl(
116 const AutofillProfile& profile, WebDatabase* db);
117 WebDatabase::State UpdateAutofillProfileImpl(
118 const AutofillProfile& profile, WebDatabase* db);
119 WebDatabase::State RemoveAutofillProfileImpl(
120 const std::string& guid, WebDatabase* db);
121 scoped_ptr<WDTypedResult> GetAutofillProfilesImpl(WebDatabase* db);
122 WebDatabase::State AddCreditCardImpl(
123 const CreditCard& credit_card, WebDatabase* db);
124 WebDatabase::State UpdateCreditCardImpl(
125 const CreditCard& credit_card, WebDatabase* db);
126 WebDatabase::State RemoveCreditCardImpl(
127 const std::string& guid, WebDatabase* db);
128 scoped_ptr<WDTypedResult> GetCreditCardsImpl(WebDatabase* db);
129 WebDatabase::State RemoveAutofillDataModifiedBetweenImpl(
130 const base::Time& delete_begin, const base::Time& delete_end,
131 WebDatabase* db);
132
133 // Callbacks to ensure that sensitive info is destroyed if request is
134 // cancelled.
135 void DestroyAutofillProfileResult(const WDTypedResult* result);
136 void DestroyAutofillCreditCardResult(const WDTypedResult* result);
137
138 void NotifyAutofillMultipleChangedOnUIThread();
139
140 // This makes the destructor public, and thus allows us to aggregate 105 // This makes the destructor public, and thus allows us to aggregate
141 // SupportsUserData. It is private by default to prevent incorrect 106 // SupportsUserData. It is private by default to prevent incorrect
142 // usage in class hierarchies where it is inherited by 107 // usage in class hierarchies where it is inherited by
143 // reference-counted objects. 108 // reference-counted objects.
144 class SupportsUserDataAggregatable : public base::SupportsUserData { 109 class SupportsUserDataAggregatable : public base::SupportsUserData {
145 public: 110 public:
146 SupportsUserDataAggregatable() {} 111 SupportsUserDataAggregatable() {}
147 virtual ~SupportsUserDataAggregatable() {} 112 virtual ~SupportsUserDataAggregatable() {}
148 private: 113 private:
149 DISALLOW_COPY_AND_ASSIGN(SupportsUserDataAggregatable); 114 DISALLOW_COPY_AND_ASSIGN(SupportsUserDataAggregatable);
150 }; 115 };
151 116
117 void NotifyAutofillMultipleChangedOnUIThread();
118
152 // Storage for user data to be accessed only on the DB thread. May 119 // Storage for user data to be accessed only on the DB thread. May
153 // be used e.g. for SyncableService subclasses that need to be owned 120 // be used e.g. for SyncableService subclasses that need to be owned
154 // by this object. Is created on first call to |GetDBUserData()|. 121 // by this object. Is created on first call to |GetDBUserData()|.
155 scoped_ptr<SupportsUserDataAggregatable> db_thread_user_data_; 122 scoped_ptr<SupportsUserDataAggregatable> db_thread_user_data_;
156 123
157 ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_;
158 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; 124 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_;
159 125
126 scoped_refptr<AutofillWebDataBackend> autofill_backend_;
127
160 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); 128 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService);
161 }; 129 };
162 130
163 } // namespace autofill 131 } // namespace autofill
164 132
165 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ 133 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698