Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d918a7a1b97769eb6ee0e346f12889ad52b6e9dc |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/declarative/rules_registry_service.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |
| +#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |
| +#pragma once |
| + |
| +#include <map> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/memory/linked_ptr.h" |
| +#include "base/memory/scoped_ptr.h" |
| + |
| +namespace extensions { |
| +class RulesRegistry; |
| +} |
| + |
| +namespace extensions { |
| + |
| +// This class owns all RulesRegistries implementations of an ExtensionService. |
| +class RulesRegistryService { |
| + public: |
| + RulesRegistryService(); |
| + virtual ~RulesRegistryService(); |
| + |
| + // Registers a RulesRegistry and wraps it in an InitializingRulesRegistry. |
| + void RegisterRulesRegistry(const std::string& event_name, |
| + scoped_ptr<RulesRegistry> rule_registry); |
| + |
| + // Returns the RulesRegistry for |event_name|. Such a RulesRegistry |
| + // 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.
|
| + RulesRegistry* GetRulesRegistry(const std::string& event_name) const; |
| + |
| + // Notifies all RulesRegistries that |extension_id| was unloaded. |
| + void OnExtensionUnloaded(const std::string& extension_id); |
| + |
| + private: |
| + // Maps event names to RuleRegistries that handle these events. |
| + typedef std::map<std::string, linked_ptr<RulesRegistry> > RulesRegistryMap; |
| + RulesRegistryMap rule_registries_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |