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

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

Issue 7601013: Web Intents: Hook up the register intent InfoBar with the WebIntentsRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fix. Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_TABLE_H_ 5 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_
6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ 6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "chrome/browser/webdata/web_database_table.h" 11 #include "chrome/browser/webdata/web_database_table.h"
12 12
13 #include <vector> 13 #include <vector>
14 14
15 class AutofillChange; 15 class AutofillChange;
16 class AutofillEntry; 16 class AutofillEntry;
17 class AutofillProfile; 17 class AutofillProfile;
18 class AutofillTableTest; 18 class AutofillTableTest;
19 class CreditCard; 19 class CreditCard;
20 20
21 namespace base {
22 class Time;
23 }
24
21 namespace webkit_glue { 25 namespace webkit_glue {
22 struct FormField; 26 struct FormField;
23 } 27 }
24 28
25 // This class manages the various autofill tables within the SQLite database 29 // This class manages the various autofill tables within the SQLite database
26 // passed to the constructor. It expects the following schemas: 30 // passed to the constructor. It expects the following schemas:
27 // 31 //
28 // Note: The database stores time in seconds, UTC. 32 // Note: The database stores time in seconds, UTC.
29 // 33 //
30 // autofill 34 // autofill
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 const string16& prefix, 139 const string16& prefix,
136 std::vector<string16>* values, 140 std::vector<string16>* values,
137 int limit); 141 int limit);
138 142
139 // Removes rows from autofill_dates if they were created on or after 143 // Removes rows from autofill_dates if they were created on or after
140 // |delete_begin| and strictly before |delete_end|. Decrements the 144 // |delete_begin| and strictly before |delete_end|. Decrements the
141 // count of the corresponding rows in the autofill table, and 145 // count of the corresponding rows in the autofill table, and
142 // removes those rows if the count goes to 0. A list of all changed 146 // removes those rows if the count goes to 0. A list of all changed
143 // keys and whether each was updater or removed is returned in the 147 // keys and whether each was updater or removed is returned in the
144 // changes out parameter. 148 // changes out parameter.
145 bool RemoveFormElementsAddedBetween(base::Time delete_begin, 149 bool RemoveFormElementsAddedBetween(const base::Time& delete_begin,
146 base::Time delete_end, 150 const base::Time& delete_end,
147 std::vector<AutofillChange>* changes); 151 std::vector<AutofillChange>* changes);
148 152
149 // Removes from autofill_dates rows with given pair_id where date_created lies 153 // Removes from autofill_dates rows with given pair_id where date_created lies
150 // between delte_begin and delte_end. 154 // between delte_begin and delte_end.
151 bool RemoveFormElementForTimeRange(int64 pair_id, 155 bool RemoveFormElementForTimeRange(int64 pair_id,
152 base::Time delete_begin, 156 const base::Time& delete_begin,
153 base::Time delete_end, 157 const base::Time& delete_end,
154 int* how_many); 158 int* how_many);
155 159
156 // Increments the count in the row corresponding to |pair_id| by 160 // Increments the count in the row corresponding to |pair_id| by
157 // |delta|. Removes the row from the table and sets the 161 // |delta|. Removes the row from the table and sets the
158 // |was_removed| out parameter to true if the count becomes 0. 162 // |was_removed| out parameter to true if the count becomes 0.
159 bool AddToCountOfFormElement(int64 pair_id, int delta, bool* was_removed); 163 bool AddToCountOfFormElement(int64 pair_id, int delta, bool* was_removed);
160 164
161 // Gets the pair_id and count entries from name and value specified in 165 // Gets the pair_id and count entries from name and value specified in
162 // |element|. Sets *pair_id and *count to 0 if there is no such row in 166 // |element|. Sets *pair_id and *count to 0 if there is no such row in
163 // the table. 167 // the table.
164 bool GetIDAndCountOfFormElement(const webkit_glue::FormField& element, 168 bool GetIDAndCountOfFormElement(const webkit_glue::FormField& element,
165 int64* pair_id, 169 int64* pair_id,
166 int* count); 170 int* count);
167 171
168 // Gets the count only given the pair_id. 172 // Gets the count only given the pair_id.
169 bool GetCountOfFormElement(int64 pair_id, int* count); 173 bool GetCountOfFormElement(int64 pair_id, int* count);
170 174
171 // Updates the count entry in the row corresponding to |pair_id| to |count|. 175 // Updates the count entry in the row corresponding to |pair_id| to |count|.
172 bool SetCountOfFormElement(int64 pair_id, int count); 176 bool SetCountOfFormElement(int64 pair_id, int count);
173 177
174 // Adds a new row to the autofill table with name and value given in 178 // Adds a new row to the autofill table with name and value given in
175 // |element|. Sets *pair_id to the pair_id of the new row. 179 // |element|. Sets *pair_id to the pair_id of the new row.
176 bool InsertFormElement(const webkit_glue::FormField& element, int64* pair_id); 180 bool InsertFormElement(const webkit_glue::FormField& element, int64* pair_id);
177 181
178 // Adds a new row to the autofill_dates table. 182 // Adds a new row to the autofill_dates table.
179 bool InsertPairIDAndDate(int64 pair_id, base::Time date_created); 183 bool InsertPairIDAndDate(int64 pair_id, const base::Time& date_created);
180 184
181 // Removes row from the autofill tables given |pair_id|. 185 // Removes row from the autofill tables given |pair_id|.
182 bool RemoveFormElementForID(int64 pair_id); 186 bool RemoveFormElementForID(int64 pair_id);
183 187
184 // Removes row from the autofill tables for the given |name| |value| pair. 188 // Removes row from the autofill tables for the given |name| |value| pair.
185 virtual bool RemoveFormElement(const string16& name, const string16& value); 189 virtual bool RemoveFormElement(const string16& name, const string16& value);
186 190
187 // Retrieves all of the entries in the autofill table. 191 // Retrieves all of the entries in the autofill table.
188 virtual bool GetAllAutofillEntries(std::vector<AutofillEntry>* entries); 192 virtual bool GetAllAutofillEntries(std::vector<AutofillEntry>* entries);
189 193
190 // Retrieves a single entry from the autofill table. 194 // Retrieves a single entry from the autofill table.
191 virtual bool GetAutofillTimestamps(const string16& name, 195 virtual bool GetAutofillTimestamps(const string16& name,
192 const string16& value, 196 const string16& value,
193 std::vector<base::Time>* timestamps); 197 std::vector<base::Time>* timestamps);
194 198
195 // Replaces existing autofill entries with the entries supplied in 199 // Replaces existing autofill entries with the entries supplied in
196 // the argument. If the entry does not already exist, it will be 200 // the argument. If the entry does not already exist, it will be
197 // added. 201 // added.
198 virtual bool UpdateAutofillEntries(const std::vector<AutofillEntry>& entries); 202 virtual bool UpdateAutofillEntries(const std::vector<AutofillEntry>& entries);
199 203
200 // Records a single Autofill profile in the autofill_profiles table. 204 // Records a single Autofill profile in the autofill_profiles table.
201 virtual bool AddAutofillProfile(const AutofillProfile& profile); 205 virtual bool AddAutofillProfile(const AutofillProfile& profile);
202 206
203 // Updates the database values for the specified profile. 207 // Updates the database values for the specified profile.
(...skipping 28 matching lines...) Expand all
232 bool GetCreditCard(const std::string& guid, CreditCard** credit_card); 236 bool GetCreditCard(const std::string& guid, CreditCard** credit_card);
233 237
234 // Retrieves all credit cards in the database. Caller owns the returned 238 // Retrieves all credit cards in the database. Caller owns the returned
235 // credit cards. 239 // credit cards.
236 virtual bool GetCreditCards(std::vector<CreditCard*>* credit_cards); 240 virtual bool GetCreditCards(std::vector<CreditCard*>* credit_cards);
237 241
238 // Removes rows from autofill_profiles and credit_cards if they were created 242 // Removes rows from autofill_profiles and credit_cards if they were created
239 // on or after |delete_begin| and strictly before |delete_end|. Returns lists 243 // on or after |delete_begin| and strictly before |delete_end|. Returns lists
240 // of deleted guids in |profile_guids| and |credit_card_guids|. 244 // of deleted guids in |profile_guids| and |credit_card_guids|.
241 bool RemoveAutofillProfilesAndCreditCardsModifiedBetween( 245 bool RemoveAutofillProfilesAndCreditCardsModifiedBetween(
242 base::Time delete_begin, 246 const base::Time& delete_begin,
243 base::Time delete_end, 247 const base::Time& delete_end,
244 std::vector<std::string>* profile_guids, 248 std::vector<std::string>* profile_guids,
245 std::vector<std::string>* credit_card_guids); 249 std::vector<std::string>* credit_card_guids);
246 250
247 // Retrieves all profiles in the database that have been deleted since last 251 // Retrieves all profiles in the database that have been deleted since last
248 // "empty" of the trash. 252 // "empty" of the trash.
249 bool GetAutofillProfilesInTrash(std::vector<std::string>* guids); 253 bool GetAutofillProfilesInTrash(std::vector<std::string>* guids);
250 254
251 // Empties the Autofill profiles "trash can". 255 // Empties the Autofill profiles "trash can".
252 bool EmptyAutofillProfilesTrash(); 256 bool EmptyAutofillProfilesTrash();
253 257
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 bool InitProfilesTable(); 325 bool InitProfilesTable();
322 bool InitProfileNamesTable(); 326 bool InitProfileNamesTable();
323 bool InitProfileEmailsTable(); 327 bool InitProfileEmailsTable();
324 bool InitProfilePhonesTable(); 328 bool InitProfilePhonesTable();
325 bool InitProfileTrashTable(); 329 bool InitProfileTrashTable();
326 330
327 DISALLOW_COPY_AND_ASSIGN(AutofillTable); 331 DISALLOW_COPY_AND_ASSIGN(AutofillTable);
328 }; 332 };
329 333
330 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ 334 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698