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 967a793701ccb5bfb4f6bacfcd356e6b3bd9a070..2e936dce58f08efd83929215ba8bbb4482a134d1 100644 |
--- a/chrome/browser/webdata/autofill_profile_syncable_service.cc |
+++ b/chrome/browser/webdata/autofill_profile_syncable_service.cc |
@@ -33,6 +33,13 @@ std::string LimitData(const std::string& data) { |
return sanitized_value; |
} |
+void* UserDataKey() { |
+ // Use the address of a static that COMDAT folding won't ever fold |
+ // with something else. |
+ static int user_data_key = 0; |
+ return reinterpret_cast<void*>(&user_data_key); |
+} |
+ |
} // namespace |
const char kAutofillProfileTag[] = "google_chrome_autofill_profiles"; |
@@ -52,6 +59,21 @@ AutofillProfileSyncableService::~AutofillProfileSyncableService() { |
DCHECK(CalledOnValidThread()); |
} |
+// static |
+void AutofillProfileSyncableService::CreateForWebDataService( |
+ WebDataService* web_data) { |
+ 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)); |
@@ -546,7 +568,7 @@ bool AutofillProfileSyncableService::MergeProfile( |
} |
AutofillTable* AutofillProfileSyncableService::GetAutofillTable() const { |
- return web_data_service_->GetDatabase()->GetAutofillTable(); |
+ return AutofillTable::FromWebDatabase(web_data_service_->GetDatabase()); |
} |
AutofillProfileSyncableService::DataBundle::DataBundle() {} |