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

Unified Diff: chrome/browser/webdata/web_data_service.h

Issue 8184001: The AutofillProfileSyncableService's lifetime should be managed by the WebDataService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile after http://crrev.com/104990 Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/webdata/web_data_service.h
diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h
index 98c5d0a567adb688e779b436feac5e21ce7ba797..f40ad0042191cdf55bbed4a0f6afd697284241d1 100644
--- a/chrome/browser/webdata/web_data_service.h
+++ b/chrome/browser/webdata/web_data_service.h
@@ -20,6 +20,7 @@
class AutofillChange;
class AutofillProfile;
+class AutofillProfileSyncableService;
class CreditCard;
class GURL;
#if defined(OS_WIN)
@@ -512,6 +513,12 @@ class WebDataService
const base::Time& delete_begin,
const base::Time& delete_end);
+ // TODO(georgey): Add support for autocomplete as well: http://crbug.com/95759
+ // Returns the syncable service for Autofill addresses and credit cards stored
+ // in this table. The returned service is owned by |this| object.
+ virtual AutofillProfileSyncableService*
+ GetAutofillProfileSyncableService() const;
+
// Testing
#ifdef UNIT_TEST
void set_failed_init(bool value) { failed_init_ = value; }
@@ -553,12 +560,18 @@ class WebDataService
// Initialize the database, if it hasn't already been initialized.
void InitializeDatabaseIfNecessary();
+ // Initialize any syncable services.
+ void InitializeSyncableServices();
+
// The notification method.
void NotifyDatabaseLoadedOnUIThread();
// Commit any pending transaction and deletes the database.
void ShutdownDatabase();
+ // Deletes the syncable services.
+ void ShutdownSyncableServices();
+
// Commit the current transaction and creates a new one.
void Commit();
@@ -664,9 +677,17 @@ class WebDataService
// The path with which to initialize the database.
FilePath path_;
- // Our database.
+ // Our database. We own the |db_|, but don't use a |scoped_ptr| because the
+ // |db_| lifetime must be managed on the database thread.
WebDatabase* db_;
+ // Syncable services for the database data. We own the services, but don't
+ // use |scoped_ptr|s because the lifetimes must be managed on the database
+ // thread.
+ // Currently only Autofill profiles (and credit cards) use the new Sync API,
+ // but all the database data should migrate to this API over time.
+ AutofillProfileSyncableService* autofill_profile_syncable_service_;
+
// Whether the database failed to initialize. We use this to avoid
// continually trying to reinit.
bool failed_init_;
« no previous file with comments | « chrome/browser/webdata/autofill_profile_syncable_service_unittest.cc ('k') | chrome/browser/webdata/web_data_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698