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

Side by Side Diff: chrome/browser/extensions/api/declarative/test_rules_registry.h

Issue 9315010: RulesRegistry for declarative APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 SetErrorCallback set_error_callback) OVERRIDE;
31 virtual bool RemoveRules(const std::string& extension_id,
32 const std::vector<std::string>& rule_identifiers,
33 SetErrorCallback set_error_callback) 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_;
43 };
44
45 } // namespace extensions
46
47 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698