| 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 EXTENSIONS_BROWSER_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ | 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ |
| 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ | 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ |
| 7 | 7 |
| 8 #include "extensions/browser/api/declarative/rules_registry.h" | 8 #include "extensions/browser/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 RulesRegistry { | 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 const WebViewKey& webview_key); | 17 const WebViewKey& webview_key); |
| 18 TestRulesRegistry( | 18 TestRulesRegistry( |
| 19 content::BrowserContext* browser_context, | 19 content::BrowserContext* browser_context, |
| 20 const std::string& event_name, | 20 const std::string& event_name, |
| 21 content::BrowserThread::ID owner_thread, | 21 content::BrowserThread::ID owner_thread, |
| 22 RulesCacheDelegate* cache_delegate, | 22 RulesCacheDelegate* cache_delegate, |
| 23 const WebViewKey& webview_key); | 23 const WebViewKey& webview_key); |
| 24 | 24 |
| 25 // RulesRegistry implementation: | 25 // RulesRegistry implementation: |
| 26 virtual std::string AddRulesImpl( | 26 virtual std::string AddRulesImpl( |
| 27 const std::string& extension_id, | 27 const std::string& extension_id, |
| 28 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE; | 28 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) override; |
| 29 virtual std::string RemoveRulesImpl( | 29 virtual std::string RemoveRulesImpl( |
| 30 const std::string& extension_id, | 30 const std::string& extension_id, |
| 31 const std::vector<std::string>& rule_identifiers) OVERRIDE; | 31 const std::vector<std::string>& rule_identifiers) override; |
| 32 virtual std::string RemoveAllRulesImpl( | 32 virtual std::string RemoveAllRulesImpl( |
| 33 const std::string& extension_id) OVERRIDE; | 33 const std::string& extension_id) override; |
| 34 | 34 |
| 35 // Sets the result message that will be returned by the next call of | 35 // Sets the result message that will be returned by the next call of |
| 36 // AddRulesImpl, RemoveRulesImpl and RemoveAllRulesImpl. | 36 // AddRulesImpl, RemoveRulesImpl and RemoveAllRulesImpl. |
| 37 void SetResult(const std::string& result); | 37 void SetResult(const std::string& result); |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 virtual ~TestRulesRegistry(); | 40 virtual ~TestRulesRegistry(); |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 // The string that gets returned by the implementation functions of | 43 // The string that gets returned by the implementation functions of |
| 44 // RulesRegistry. Defaults to "". | 44 // RulesRegistry. Defaults to "". |
| 45 std::string result_; | 45 std::string result_; |
| 46 | 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(TestRulesRegistry); | 47 DISALLOW_COPY_AND_ASSIGN(TestRulesRegistry); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace extensions | 50 } // namespace extensions |
| 51 | 51 |
| 52 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ | 52 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ |
| OLD | NEW |