Chromium Code Reviews| Index: chrome/browser/extensions/api/declarative/test_rules_registry.h |
| diff --git a/chrome/browser/extensions/api/declarative/test_rules_registry.h b/chrome/browser/extensions/api/declarative/test_rules_registry.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..814f429eba23aade34026674cbcf16d0a2f6daad |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/declarative/test_rules_registry.h |
| @@ -0,0 +1,47 @@ |
| +// 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_TEST_RULES_REGISTRY_H__ |
| +#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ |
| +#pragma once |
| + |
| +#include "chrome/browser/extensions/api/declarative/rules_registry.h" |
| + |
| +#include <map> |
| + |
| +#include "base/basictypes.h" |
| + |
| +namespace extensions { |
| + |
| +// This is currently a trivial stub that can only store and retrieve rules. |
| +// |
| +// TODO(battre): Generalize this into a StoringRulesRegistry from which |
| +// other concrete RulesRegistries can derive. The purpose of this class |
| +// would then be to handle just the storage of rules. |
| +class TestRulesRegistry : public RulesRegistry { |
| + public: |
| + TestRulesRegistry(); |
| + virtual ~TestRulesRegistry(); |
| + |
| + // RulesRegistry implementation: |
| + virtual bool AddRules(const std::string& extension_id, |
| + const std::vector<DictionaryValue*>& rules, |
| + std::string* error) OVERRIDE; |
| + virtual bool RemoveRules(const std::string& extension_id, |
| + const std::vector<std::string>& rule_identifiers, |
| + std::string* error) OVERRIDE; |
| + virtual void GetRules(const std::string& extension_id, |
| + const std::vector<std::string>& rule_identifiers, |
| + std::vector<DictionaryValue*>* out) OVERRIDE; |
| + virtual void OnExtensionUnloaded(const std::string& extension_id) OVERRIDE; |
| + |
| + private: |
| + // Map of rule identifier to actual rule. |
| + // TODO(battre): consider the extension_ids as part of the key. |
| + std::map<std::string, DictionaryValue*> rules_; |
|
not at google - send to devlin
2012/02/07 03:28:10
also: linked_ptr<DictionaryValue> rather than manu
battre
2012/02/07 18:45:33
Done.
|
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ |