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

Unified Diff: chrome/browser/webdata/autofill_profile_syncable_service.cc

Issue 12494020: Remove knowledge of Chrome-specific SyncableService classes from WebDataService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add DCHECK. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/webdata/autofill_profile_syncable_service.cc
diff --git a/chrome/browser/webdata/autofill_profile_syncable_service.cc b/chrome/browser/webdata/autofill_profile_syncable_service.cc
index 980ca80777024864aac2a495c4c06dd88a39bff7..38ffcd5c9e7349f73d3c51908e44855112a6b23c 100644
--- a/chrome/browser/webdata/autofill_profile_syncable_service.cc
+++ b/chrome/browser/webdata/autofill_profile_syncable_service.cc
@@ -33,6 +33,11 @@ std::string LimitData(const std::string& data) {
return sanitized_value;
}
+void* UserDataKey() {
+ return reinterpret_cast<void*>(
+ &AutofillProfileSyncableService::CreateForWebDataService);
+}
+
} // namespace
const char kAutofillProfileTag[] = "google_chrome_autofill_profiles";
@@ -52,6 +57,21 @@ AutofillProfileSyncableService::~AutofillProfileSyncableService() {
DCHECK(CalledOnValidThread());
}
+// static
+void AutofillProfileSyncableService::CreateForWebDataService(
+ WebDataService* web_data) {
Cait (Slow) 2013/03/19 19:49:46 It seems like the syncable services should be hung
Cait (Slow) 2013/03/19 20:24:24 Just saw your TODOs on this -- I'll work on conver
+ web_data->GetDBUserData()->SetUserData(
+ UserDataKey(), new AutofillProfileSyncableService(web_data));
+}
+
+// static
+AutofillProfileSyncableService*
+AutofillProfileSyncableService::FromWebDataService(
+ WebDataService* service) {
+ return static_cast<AutofillProfileSyncableService*>(
+ service->GetDBUserData()->GetUserData(UserDataKey()));
+}
+
AutofillProfileSyncableService::AutofillProfileSyncableService()
: web_data_service_(NULL) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
« no previous file with comments | « chrome/browser/webdata/autofill_profile_syncable_service.h ('k') | chrome/browser/webdata/web_data_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698