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

Unified Diff: chrome/browser/extensions/activity_log/fullstream_ui_policy.cc

Issue 18660004: Extension activity log database refactoring (step 1) (Closed) Base URL: http://git.chromium.org/chromium/src.git@incognito-tests
Patch Set: Fix potential null pointer dereference Created 7 years, 5 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_log/fullstream_ui_policy.cc
diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc b/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
index 654f6c1168351bf696d7495a9979172c082e6484..e6da9d2697557f23e2eaa82dc794b97f07c869ae 100644
--- a/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
+++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
@@ -43,13 +43,33 @@ namespace extensions {
FullStreamUIPolicy::FullStreamUIPolicy(Profile* profile)
: ActivityLogPolicy(profile) {
- db_ = new ActivityDatabase();
+ db_ = new ActivityDatabase(this);
FilePath database_name = profile_base_path_.Append(
chrome::kExtensionActivityLogFilename);
ScheduleAndForget(db_, &ActivityDatabase::Init, database_name);
}
-FullStreamUIPolicy::~FullStreamUIPolicy() {
+bool FullStreamUIPolicy::DatabaseInitCallback(sql::Connection* db) {
+ // Create the DOMAction database.
Matt Perry 2013/07/10 23:19:30 nit: these comments are redundant
mvrable 2013/07/11 17:30:33 Deleted, though all this code will be gone soon in
+ if (!DOMAction::InitializeTable(db))
+ return false;
+
+ // Create the APIAction database.
+ if (!APIAction::InitializeTable(db))
+ return false;
+
+ // Create the BlockedAction database.
+ if (!BlockedAction::InitializeTable(db))
+ return false;
+
+ return true;
+}
+
+void FullStreamUIPolicy::DatabaseCloseCallback() {
+ delete this;
+}
+
+void FullStreamUIPolicy::Close() {
// The policy object should have never been created if there's no DB thread.
DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::DB));
ScheduleAndForget(db_, &ActivityDatabase::Close);
@@ -70,11 +90,6 @@ void FullStreamUIPolicy::ReadData(
callback);
}
-void FullStreamUIPolicy::SetSaveStateOnRequestOnly() {
- ScheduleAndForget(db_, &ActivityDatabase::SetBatchModeForTesting, false);
- ActivityLogPolicy::SetSaveStateOnRequestOnly();
-}
-
std::string FullStreamUIPolicy::GetKey(ActivityLogPolicy::KeyType key_ty) const
{
switch (key_ty) {

Powered by Google App Engine
This is Rietveld 408576698