OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ |
7 | 7 |
8 #include "chrome/browser/extensions/api/declarative/rules_registry_with_cache.h" | 8 #include "chrome/browser/extensions/api/declarative/rules_registry.h" |
9 | 9 |
10 namespace extensions { | 10 namespace extensions { |
11 | 11 |
12 // This is a trivial test RulesRegistry that can only store and retrieve rules. | 12 // This is a trivial test RulesRegistry that can only store and retrieve rules. |
13 class TestRulesRegistry : public RulesRegistryWithCache { | 13 class TestRulesRegistry : public RulesRegistry { |
14 public: | 14 public: |
15 TestRulesRegistry(content::BrowserThread::ID owner_thread, | 15 TestRulesRegistry(content::BrowserThread::ID owner_thread, |
16 const std::string& event_name); | 16 const std::string& event_name); |
17 TestRulesRegistry( | 17 TestRulesRegistry( |
18 Profile* profile, | 18 Profile* profile, |
19 const std::string& event_name, | 19 const std::string& event_name, |
20 content::BrowserThread::ID owner_thread, | 20 content::BrowserThread::ID owner_thread, |
21 scoped_ptr<RulesRegistryWithCache::RuleStorageOnUI>* ui_part); | 21 scoped_ptr<RulesCacheDelegate>* ui_part); |
22 | 22 |
23 // RulesRegistryWithCache implementation: | 23 // RulesRegistry implementation: |
24 virtual std::string AddRulesImpl( | 24 virtual std::string AddRulesImpl( |
25 const std::string& extension_id, | 25 const std::string& extension_id, |
26 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE; | 26 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE; |
27 virtual std::string RemoveRulesImpl( | 27 virtual std::string RemoveRulesImpl( |
28 const std::string& extension_id, | 28 const std::string& extension_id, |
29 const std::vector<std::string>& rule_identifiers) OVERRIDE; | 29 const std::vector<std::string>& rule_identifiers) OVERRIDE; |
30 virtual std::string RemoveAllRulesImpl( | 30 virtual std::string RemoveAllRulesImpl( |
31 const std::string& extension_id) OVERRIDE; | 31 const std::string& extension_id) OVERRIDE; |
32 | 32 |
33 // Sets the result message that will be returned by the next call of | 33 // Sets the result message that will be returned by the next call of |
34 // AddRulesImpl, RemoveRulesImpl and RemoveAllRulesImpl. | 34 // AddRulesImpl, RemoveRulesImpl and RemoveAllRulesImpl. |
35 void SetResult(const std::string& result); | 35 void SetResult(const std::string& result); |
36 | 36 |
37 protected: | 37 protected: |
38 virtual ~TestRulesRegistry(); | 38 virtual ~TestRulesRegistry(); |
39 | 39 |
40 private: | 40 private: |
41 // The string that gets returned by the implementation functions of | 41 // The string that gets returned by the implementation functions of |
42 // RulesRegistryWithCache. Defaults to "". | 42 // RulesRegistry. Defaults to "". |
43 std::string result_; | 43 std::string result_; |
44 | 44 |
45 DISALLOW_COPY_AND_ASSIGN(TestRulesRegistry); | 45 DISALLOW_COPY_AND_ASSIGN(TestRulesRegistry); |
46 }; | 46 }; |
47 | 47 |
48 } // namespace extensions | 48 } // namespace extensions |
49 | 49 |
50 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ | 50 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ |
OLD | NEW |