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

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

Issue 12543034: Move creation of the various WebDatabaseTable types out of WebDatabase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows release builds (COMDAT folding combined static functions being used for keys. 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_table.h ('k') | chrome/browser/webdata/autofill_table_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/autofill_table.cc
diff --git a/chrome/browser/webdata/autofill_table.cc b/chrome/browser/webdata/autofill_table.cc
index 734c28ae8448bbed7732ce743e360e097e64c7c7..b3ccb52e5a31a82a38f685e04e964eb00aa585d4 100644
--- a/chrome/browser/webdata/autofill_table.cc
+++ b/chrome/browser/webdata/autofill_table.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/password_manager/encryptor.h"
#include "chrome/browser/webdata/autofill_change.h"
#include "chrome/browser/webdata/autofill_entry.h"
+#include "chrome/browser/webdata/web_database.h"
#include "components/autofill/browser/autofill_country.h"
#include "components/autofill/browser/autofill_profile.h"
#include "components/autofill/browser/autofill_type.h"
@@ -319,23 +320,37 @@ bool RemoveAutofillProfilePieces(const std::string& guid, sql::Connection* db) {
return s3.Run();
}
+int table_key = 0;
+
+WebDatabaseTable::TypeKey GetKey() {
+ return reinterpret_cast<void*>(&table_key);
+}
+
} // namespace
// The maximum length allowed for form data.
const size_t AutofillTable::kMaxDataLength = 1024;
-AutofillTable::AutofillTable(sql::Connection* db, sql::MetaTable* meta_table)
- : WebDatabaseTable(db, meta_table) {
+AutofillTable::AutofillTable() {
}
AutofillTable::~AutofillTable() {
}
-bool AutofillTable::Init() {
- return (InitMainTable() && InitCreditCardsTable() && InitDatesTable() &&
- InitProfilesTable() && InitProfileNamesTable() &&
- InitProfileEmailsTable() && InitProfilePhonesTable() &&
- InitProfileTrashTable());
+AutofillTable* AutofillTable::FromWebDatabase(WebDatabase* db) {
+ return static_cast<AutofillTable*>(db->GetTable(GetKey()));
+}
+
+WebDatabaseTable::TypeKey AutofillTable::GetTypeKey() const {
+ return GetKey();
+}
+
+bool AutofillTable::Init(sql::Connection* db, sql::MetaTable* meta_table) {
+ WebDatabaseTable::Init(db, meta_table);
+ return (InitMainTable() && InitCreditCardsTable() && InitDatesTable() &&
+ InitProfilesTable() && InitProfileNamesTable() &&
+ InitProfileEmailsTable() && InitProfilePhonesTable() &&
+ InitProfileTrashTable());
}
bool AutofillTable::IsSyncable() {
« no previous file with comments | « chrome/browser/webdata/autofill_table.h ('k') | chrome/browser/webdata/autofill_table_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698