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_TEST_RULES_REGISTRY_H__ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "chrome/browser/extensions/api/declarative/rules_registry.h" | |
| 10 | |
| 11 #include <map> | |
| 12 | |
| 13 #include "base/basictypes.h" | |
| 14 | |
| 15 namespace extensions { | |
| 16 | |
| 17 // This is currently a trivial stub that can only store and retrieve rules. | |
| 18 // | |
| 19 // TODO(battre): Generalize this into a StoringRulesRegistry from which | |
| 20 // other concrete RulesRegistries can derive. The purpose of this class | |
| 21 // would then be to handle just the storage of rules. | |
| 22 class TestRulesRegistry : public RulesRegistry { | |
| 23 public: | |
| 24 TestRulesRegistry(); | |
| 25 virtual ~TestRulesRegistry(); | |
| 26 | |
| 27 // RulesRegistry implementation: | |
| 28 virtual bool AddRules(const std::string& extension_id, | |
| 29 const std::vector<DictionaryValue*>& rules, | |
| 30 std::string* error) OVERRIDE; | |
| 31 virtual bool RemoveRules(const std::string& extension_id, | |
| 32 const std::vector<std::string>& rule_identifiers, | |
| 33 std::string* error) OVERRIDE; | |
| 34 virtual void GetRules(const std::string& extension_id, | |
| 35 const std::vector<std::string>& rule_identifiers, | |
| 36 std::vector<DictionaryValue*>* out) OVERRIDE; | |
| 37 virtual void OnExtensionUnloaded(const std::string& extension_id) OVERRIDE; | |
| 38 | |
| 39 private: | |
| 40 // Map of rule identifier to actual rule. | |
| 41 // TODO(battre): consider the extension_ids as part of the key. | |
| 42 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.
| |
| 43 }; | |
| 44 | |
| 45 } // namespace extensions | |
| 46 | |
| 47 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ | |
| OLD | NEW |