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

Unified Diff: chrome/browser/extensions/activity_database.cc

Issue 12262025: Alter the ActivityLog db table schemas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/extensions/activity_database.cc
diff --git a/chrome/browser/extensions/activity_database.cc b/chrome/browser/extensions/activity_database.cc
index 576aee7b43cd51751cceddf182aa95d6329b8953..0583312fb653672b159e2866514f8888e18a40d9 100644
--- a/chrome/browser/extensions/activity_database.cc
+++ b/chrome/browser/extensions/activity_database.cc
@@ -50,9 +50,8 @@ void ActivityDatabase::Init(const base::FilePath& db_name) {
db_.Preload();
- // Create the UrlAction database.
- if (InitializeTable(UrlAction::kTableName, UrlAction::kTableStructure) !=
- sql::INIT_OK)
+ // Create the DOMAction database.
+ if (!DOMAction::InitializeTable(&db_))
return LogInitFailure();
// Create the APIAction database.
@@ -60,8 +59,7 @@ void ActivityDatabase::Init(const base::FilePath& db_name) {
return LogInitFailure();
// Create the BlockedAction database.
- if (InitializeTable(BlockedAction::kTableName, BlockedAction::kTableStructure)
- != sql::INIT_OK)
+ if (!BlockedAction::InitializeTable(&db_))
return LogInitFailure();
sql::InitStatus stat = committer.Commit() ? sql::INIT_OK : sql::INIT_FAILURE;
@@ -75,19 +73,6 @@ void ActivityDatabase::LogInitFailure() {
LOG(ERROR) << "Couldn't initialize the activity log database.";
}
-sql::InitStatus ActivityDatabase::InitializeTable(const char* table_name,
- const char* table_structure) {
- if (!db_.DoesTableExist(table_name)) {
- char table_creator[1000];
- base::snprintf(table_creator,
- arraysize(table_creator),
- "CREATE TABLE %s %s", table_name, table_structure);
- if (!db_.Execute(table_creator))
- return sql::INIT_FAILURE;
- }
- return sql::INIT_OK;
-}
-
void ActivityDatabase::RecordAction(scoped_refptr<Action> action) {
if (initialized_)
action->Record(&db_);
« no previous file with comments | « chrome/browser/extensions/activity_database.h ('k') | chrome/browser/extensions/activity_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698