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

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

Issue 8184001: The AutofillProfileSyncableService's lifetime should be managed by the WebDataService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ensure that destruction occurs on the DB thread 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/autofill_table.cc
diff --git a/chrome/browser/webdata/autofill_table.cc b/chrome/browser/webdata/autofill_table.cc
index fd152e1e7b0bf079c692ed4ff78bf80f226203a2..d288ef0382cc8c7bede04a20087c37025a84b8af 100644
--- a/chrome/browser/webdata/autofill_table.cc
+++ b/chrome/browser/webdata/autofill_table.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/autofill/credit_card.h"
#include "chrome/browser/autofill/personal_data_manager.h"
#include "chrome/browser/password_manager/encryptor.h"
+#include "chrome/browser/webdata/autofill_profile_syncable_service.h"
#include "chrome/browser/webdata/autofill_change.h"
#include "chrome/common/guid.h"
#include "sql/statement.h"
@@ -346,6 +347,15 @@ bool RemoveAutofillProfilePieces(const std::string& guid, sql::Connection* db) {
} // namespace
+
+AutofillTable::AutofillTable(sql::Connection* db, sql::MetaTable* meta_table)
+ : WebDatabaseTable(db, meta_table),
+ autofill_profile_syncable_service_(NULL) {
+}
+
+AutofillTable::~AutofillTable() {
+}
+
bool AutofillTable::Init() {
return (InitMainTable() && InitCreditCardsTable() && InitDatesTable() &&
InitProfilesTable() && InitProfileNamesTable() &&
@@ -357,6 +367,19 @@ bool AutofillTable::IsSyncable() {
return true;
}
+AutofillProfileSyncableService* AutofillTable::GetSyncableService(
+ WebDatabase* web_database,
+ Profile* profile) {
+ if (!autofill_profile_syncable_service_.get()) {
+ autofill_profile_syncable_service_.reset(
+ new AutofillProfileSyncableService(web_database, profile));
+ }
+
+ DCHECK_EQ(web_database, autofill_profile_syncable_service_->web_database());
akalin 2011/10/10 21:58:57 this seems kinda gross. It seems to me that WebDa
Ilya Sherman 2011/10/10 22:33:13 This would still be "needed" even if the WebDataba
+ DCHECK_EQ(profile, autofill_profile_syncable_service_->profile());
+ return autofill_profile_syncable_service_.get();
+}
+
bool AutofillTable::AddFormFieldValues(const std::vector<FormField>& elements,
std::vector<AutofillChange>* changes) {
return AddFormFieldValuesTime(elements, changes, Time::Now());

Powered by Google App Engine
This is Rietveld 408576698