Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <map> | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/memory/linked_ptr.h" | |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 | |
| 16 namespace extensions { | |
| 17 class RulesRegistry; | |
| 18 } | |
| 19 | |
| 20 namespace extensions { | |
| 21 | |
| 22 // This class owns all RulesRegistries implementations of an ExtensionService. | |
| 23 class RulesRegistryService { | |
| 24 public: | |
| 25 RulesRegistryService(); | |
| 26 virtual ~RulesRegistryService(); | |
| 27 | |
| 28 // Registers a RulesRegistry and wraps it in an InitializingRulesRegistry. | |
| 29 void RegisterRulesRegistry(const std::string& event_name, | |
| 30 scoped_ptr<RulesRegistry> rule_registry); | |
| 31 | |
| 32 // Returns the RulesRegistry for |event_name|. Such a RulesRegistry | |
| 33 // must have been registered before. | |
|
not at google - send to devlin
2012/02/07 23:54:57
If you push up the assertion to the API level, thi
battre
2012/02/08 12:49:54
Done.
| |
| 34 RulesRegistry* GetRulesRegistry(const std::string& event_name) const; | |
| 35 | |
| 36 // Notifies all RulesRegistries that |extension_id| was unloaded. | |
| 37 void OnExtensionUnloaded(const std::string& extension_id); | |
| 38 | |
| 39 private: | |
| 40 // Maps event names to RuleRegistries that handle these events. | |
| 41 typedef std::map<std::string, linked_ptr<RulesRegistry> > RulesRegistryMap; | |
| 42 RulesRegistryMap rule_registries_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); | |
| 45 }; | |
| 46 | |
| 47 } // namespace extensions | |
| 48 | |
| 49 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | |
| OLD | NEW |