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

Unified Diff: chrome/browser/extensions/api/declarative/rules_registry_service.h

Issue 13825014: Change RulesRegistryService to use ProfileKeyedAPI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added static comment Created 7 years, 8 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/api/declarative/rules_registry_service.h
diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service.h b/chrome/browser/extensions/api/declarative/rules_registry_service.h
index 1910d1650b41ccc90603ce133636c4c5f6cfcdb8..8752a4a7a337de8b6f95bd1635aac4c0f6baff39 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_service.h
+++ b/chrome/browser/extensions/api/declarative/rules_registry_service.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/memory/ref_counted.h"
+#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -30,7 +31,8 @@ namespace extensions {
// This class owns all RulesRegistries implementations of an ExtensionService.
// This class lives on the UI thread.
-class RulesRegistryService : public content::NotificationObserver {
+class RulesRegistryService : public ProfileKeyedAPI,
+ public content::NotificationObserver {
public:
explicit RulesRegistryService(Profile* profile);
virtual ~RulesRegistryService();
@@ -39,6 +41,12 @@ class RulesRegistryService : public content::NotificationObserver {
// created by us so that the RulesRegistries can be released.
void Shutdown();
+ // ProfileKeyedAPI implementation.
+ static ProfileKeyedAPIFactory<RulesRegistryService>* GetFactoryInstance();
+
+ // Convenience method to get the RulesRegistryService for a profile.
+ static RulesRegistryService* Get(Profile* profile);
+
// Registers the default RulesRegistries used in Chromium.
void RegisterDefaultRulesRegistries();
@@ -59,6 +67,8 @@ class RulesRegistryService : public content::NotificationObserver {
// For testing.
void SimulateExtensionUnloaded(const std::string& extension_id);
private:
+ friend class ProfileKeyedAPIFactory<RulesRegistryService>;
+
// Maps event names to RuleRegistries that handle these events.
typedef std::map<std::string, scoped_refptr<RulesRegistry> > RulesRegistryMap;
@@ -72,6 +82,11 @@ class RulesRegistryService : public content::NotificationObserver {
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // ProfileKeyedAPI implementation.
+ static const char* service_name() {
+ return "RulesRegistryService";
+ }
+
RulesRegistryMap rule_registries_;
// These are weak pointers to the delegates owned by the RulesRegistry's. We

Powered by Google App Engine
This is Rietveld 408576698