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

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

Issue 12805007: wd5-syncableServices for try only (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wd5-syncableServices with debug test fix 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
« no previous file with comments | « chrome/browser/webdata/autofill_profile_syncable_service.h ('k') | chrome/browser/webdata/autofill_table.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {}
« no previous file with comments | « chrome/browser/webdata/autofill_profile_syncable_service.h ('k') | chrome/browser/webdata/autofill_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698