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

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: Delegate renaming and comment cleanup 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..554d201801c3f9af62c43f46fd876cd4f1fca38f 100644
--- a/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
+++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
@@ -43,13 +43,28 @@ 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::OnDatabaseInit(sql::Connection* db) {
+ if (!DOMAction::InitializeTable(db))
+ return false;
+ if (!APIAction::InitializeTable(db))
+ return false;
+ if (!BlockedAction::InitializeTable(db))
+ return false;
+
+ return true;
+}
+
+void FullStreamUIPolicy::OnDatabaseClose() {
+ 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 +85,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