OLD | NEW |
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_WEB_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ |
6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ | 6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // Retrieves all credit cards in the database. Caller owns the returned | 254 // Retrieves all credit cards in the database. Caller owns the returned |
255 // credit cards. | 255 // credit cards. |
256 virtual bool GetCreditCards(std::vector<CreditCard*>* credit_cards); | 256 virtual bool GetCreditCards(std::vector<CreditCard*>* credit_cards); |
257 | 257 |
258 // Removes rows from autofill_profiles and credit_cards if they were created | 258 // Removes rows from autofill_profiles and credit_cards if they were created |
259 // on or after |delete_begin| and strictly before |delete_end|. | 259 // on or after |delete_begin| and strictly before |delete_end|. |
260 bool RemoveAutofillProfilesAndCreditCardsModifiedBetween( | 260 bool RemoveAutofillProfilesAndCreditCardsModifiedBetween( |
261 base::Time delete_begin, | 261 base::Time delete_begin, |
262 base::Time delete_end); | 262 base::Time delete_end); |
263 | 263 |
| 264 // Retrieves all profiles in the database that have been deleted since last |
| 265 // "empty" of the trash. |
| 266 bool GetAutofillProfilesInTrash(std::vector<std::string>* guids); |
| 267 |
| 268 // Empties the Autofill profiles "trash can". |
| 269 bool EmptyAutofillProfilesTrash(); |
| 270 |
264 ////////////////////////////////////////////////////////////////////////////// | 271 ////////////////////////////////////////////////////////////////////////////// |
265 // | 272 // |
266 // Web Apps | 273 // Web Apps |
267 // | 274 // |
268 ////////////////////////////////////////////////////////////////////////////// | 275 ////////////////////////////////////////////////////////////////////////////// |
269 | 276 |
270 bool SetWebAppImage(const GURL& url, const SkBitmap& image); | 277 bool SetWebAppImage(const GURL& url, const SkBitmap& image); |
271 bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images); | 278 bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images); |
272 | 279 |
273 bool SetWebAppHasAllImages(const GURL& url, bool has_all_images); | 280 bool SetWebAppHasAllImages(const GURL& url, bool has_all_images); |
(...skipping 30 matching lines...) Expand all Loading... |
304 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, | 311 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, |
305 Autofill_GetAllAutofillEntries_TwoDistinct); | 312 Autofill_GetAllAutofillEntries_TwoDistinct); |
306 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, | 313 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, |
307 Autofill_GetAllAutofillEntries_TwoSame); | 314 Autofill_GetAllAutofillEntries_TwoSame); |
308 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, Autofill_UpdateDontReplace); | 315 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, Autofill_UpdateDontReplace); |
309 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, Autofill_AddFormFieldValues); | 316 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, Autofill_AddFormFieldValues); |
310 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, AutofillProfile); | 317 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, AutofillProfile); |
311 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, CreditCard); | 318 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, CreditCard); |
312 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, UpdateAutofillProfile); | 319 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, UpdateAutofillProfile); |
313 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, UpdateCreditCard); | 320 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, UpdateCreditCard); |
| 321 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, AutofillProfileTrash); |
| 322 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, AutofillProfileTrashInteraction); |
314 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, | 323 FRIEND_TEST_ALL_PREFIXES(WebDatabaseTest, |
315 RemoveAutofillProfilesAndCreditCardsModifiedBetween); | 324 RemoveAutofillProfilesAndCreditCardsModifiedBetween); |
316 | 325 |
317 // Methods for adding autofill entries at a specified time. For | 326 // Methods for adding autofill entries at a specified time. For |
318 // testing only. | 327 // testing only. |
319 bool AddFormFieldValuesTime( | 328 bool AddFormFieldValuesTime( |
320 const std::vector<webkit_glue::FormField>& elements, | 329 const std::vector<webkit_glue::FormField>& elements, |
321 std::vector<AutofillChange>* changes, | 330 std::vector<AutofillChange>* changes, |
322 base::Time time); | 331 base::Time time); |
323 bool AddFormFieldValueTime(const webkit_glue::FormField& element, | 332 bool AddFormFieldValueTime(const webkit_glue::FormField& element, |
324 std::vector<AutofillChange>* changes, | 333 std::vector<AutofillChange>* changes, |
325 base::Time time); | 334 base::Time time); |
326 | 335 |
327 // Removes empty values for autofill that were incorrectly stored in the DB | 336 // Removes empty values for autofill that were incorrectly stored in the DB |
328 // (see bug http://crbug.com/6111). | 337 // (see bug http://crbug.com/6111). |
329 // TODO(jcampan): http://crbug.com/7564 remove when we think all users have | 338 // TODO(jcampan): http://crbug.com/7564 remove when we think all users have |
330 // run this code. | 339 // run this code. |
331 bool ClearAutofillEmptyValueElements(); | 340 bool ClearAutofillEmptyValueElements(); |
332 | 341 |
333 // Insert a single AutofillEntry into the autofill/autofill_dates tables. | 342 // Insert a single AutofillEntry into the autofill/autofill_dates tables. |
334 bool InsertAutofillEntry(const AutofillEntry& entry); | 343 bool InsertAutofillEntry(const AutofillEntry& entry); |
335 | 344 |
| 345 // Retrieves all profiles in the database that have been deleted since last |
| 346 // "empty" of the trash. |
| 347 bool AddAutofillGUIDToTrash(const std::string& guid); |
| 348 |
| 349 // Checks if the guid is in the trash. |
| 350 bool IsAutofillGUIDInTrash(const std::string& guid); |
| 351 |
| 352 // Clear all profiles. |
| 353 bool ClearAutofillProfiles(); |
| 354 |
336 bool InitKeywordsTable(); | 355 bool InitKeywordsTable(); |
337 bool InitLoginsTable(); | 356 bool InitLoginsTable(); |
338 bool InitAutofillTable(); | 357 bool InitAutofillTable(); |
339 bool InitAutofillDatesTable(); | 358 bool InitAutofillDatesTable(); |
340 bool InitAutofillProfilesTable(); | 359 bool InitAutofillProfilesTable(); |
341 bool InitAutofillProfileNamesTable(); | 360 bool InitAutofillProfileNamesTable(); |
342 bool InitAutofillProfileEmailsTable(); | 361 bool InitAutofillProfileEmailsTable(); |
343 bool InitAutofillProfilePhonesTable(); | 362 bool InitAutofillProfilePhonesTable(); |
| 363 bool InitAutofillProfileTrashTable(); |
344 bool InitCreditCardsTable(); | 364 bool InitCreditCardsTable(); |
345 bool InitTokenServiceTable(); | 365 bool InitTokenServiceTable(); |
346 bool InitWebAppIconsTable(); | 366 bool InitWebAppIconsTable(); |
347 bool InitWebAppsTable(); | 367 bool InitWebAppsTable(); |
348 | 368 |
349 // Used by |Init()| to migration database schema from older versions to | 369 // Used by |Init()| to migration database schema from older versions to |
350 // current version. | 370 // current version. |
351 sql::InitStatus MigrateOldVersionsAsNeeded(); | 371 sql::InitStatus MigrateOldVersionsAsNeeded(); |
352 | 372 |
353 sql::Connection db_; | 373 sql::Connection db_; |
354 sql::MetaTable meta_table_; | 374 sql::MetaTable meta_table_; |
355 | 375 |
356 scoped_ptr<NotificationService> notification_service_; | 376 scoped_ptr<NotificationService> notification_service_; |
357 | 377 |
358 DISALLOW_COPY_AND_ASSIGN(WebDatabase); | 378 DISALLOW_COPY_AND_ASSIGN(WebDatabase); |
359 }; | 379 }; |
360 | 380 |
361 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ | 381 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ |
OLD | NEW |