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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log.cc

Issue 2980503002: [Extensions][TaskScheduler] Update ActivityLog for scheduling migration (Closed)
Patch Set: . Created 3 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/activity_log/activity_log.h" 5 #include "chrome/browser/extensions/activity_log/activity_log.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 switches::kEnableExtensionActivityLogTesting); 573 switches::kEnableExtensionActivityLogTesting);
574 574
575 // Check if the watchdog extension is previously installed and active. 575 // Check if the watchdog extension is previously installed and active.
576 cached_consumer_count_ = 576 cached_consumer_count_ =
577 profile_->GetPrefs()->GetInteger(prefs::kWatchdogExtensionActive); 577 profile_->GetPrefs()->GetInteger(prefs::kWatchdogExtensionActive);
578 578
579 observers_ = new base::ObserverListThreadSafe<Observer>; 579 observers_ = new base::ObserverListThreadSafe<Observer>;
580 580
581 // Check that the right threads exist for logging to the database. 581 // Check that the right threads exist for logging to the database.
582 // If not, we shouldn't try to do things that require them. 582 // If not, we shouldn't try to do things that require them.
583 // TODO(devlin): We can clean this up now that we use sequenced task runners.
583 if (!BrowserThread::IsMessageLoopValid(BrowserThread::DB) || 584 if (!BrowserThread::IsMessageLoopValid(BrowserThread::DB) ||
584 !BrowserThread::IsMessageLoopValid(BrowserThread::FILE) || 585 !BrowserThread::IsMessageLoopValid(BrowserThread::FILE) ||
585 !BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { 586 !BrowserThread::IsMessageLoopValid(BrowserThread::IO)) {
586 has_threads_ = false; 587 has_threads_ = false;
587 } 588 }
588 589
589 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); 590 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
590 CheckActive(true); // use cached 591 CheckActive(true); // use cached
591 extension_system_->ready().Post( 592 extension_system_->ready().Post(
592 FROM_HERE, 593 FROM_HERE,
(...skipping 22 matching lines...) Expand all
615 switch (policy_type) { 616 switch (policy_type) {
616 case ActivityLogPolicy::POLICY_FULLSTREAM: 617 case ActivityLogPolicy::POLICY_FULLSTREAM:
617 database_policy_ = new FullStreamUIPolicy(profile_); 618 database_policy_ = new FullStreamUIPolicy(profile_);
618 break; 619 break;
619 case ActivityLogPolicy::POLICY_COUNTS: 620 case ActivityLogPolicy::POLICY_COUNTS:
620 database_policy_ = new CountingPolicy(profile_); 621 database_policy_ = new CountingPolicy(profile_);
621 break; 622 break;
622 default: 623 default:
623 NOTREACHED(); 624 NOTREACHED();
624 } 625 }
626 LOG(WARNING) << "Initing";
625 database_policy_->Init(); 627 database_policy_->Init();
628 LOG(WARNING) << "inited";
626 database_policy_type_ = policy_type; 629 database_policy_type_ = policy_type;
627 } 630 }
628 631
629 ActivityLog::~ActivityLog() { 632 ActivityLog::~ActivityLog() {
630 if (database_policy_) 633 if (database_policy_)
631 database_policy_->Close(); 634 database_policy_->Close();
632 if (is_active_) 635 if (is_active_)
633 g_activity_log_state.Get().RemoveActiveContext(profile_); 636 g_activity_log_state.Get().RemoveActiveContext(profile_);
634 } 637 }
635 638
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 } 942 }
940 } 943 }
941 944
942 template <> 945 template <>
943 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() { 946 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() {
944 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); 947 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
945 DependsOn(ExtensionRegistryFactory::GetInstance()); 948 DependsOn(ExtensionRegistryFactory::GetInstance());
946 } 949 }
947 950
948 } // namespace extensions 951 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698