| 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_DECLARATIVE_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_API_H_ | 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_API_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "extensions/browser/api/declarative/rules_registry.h" | 10 #include "extensions/browser/api/declarative/rules_registry.h" |
| 11 #include "extensions/browser/extension_function.h" | 11 #include "extensions/browser/extension_function.h" |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 | 14 |
| 15 class RulesFunction : public AsyncExtensionFunction { | 15 class RulesFunction : public AsyncExtensionFunction { |
| 16 public: | 16 public: |
| 17 RulesFunction(); | 17 RulesFunction(); |
| 18 | 18 |
| 19 protected: | 19 protected: |
| 20 virtual ~RulesFunction(); | 20 virtual ~RulesFunction(); |
| 21 | 21 |
| 22 // ExtensionFunction: | 22 // ExtensionFunction: |
| 23 virtual bool HasPermission() OVERRIDE; | 23 virtual bool HasPermission() override; |
| 24 virtual bool RunAsync() OVERRIDE; | 24 virtual bool RunAsync() override; |
| 25 | 25 |
| 26 // Concrete implementation of the RulesFunction that is being called | 26 // Concrete implementation of the RulesFunction that is being called |
| 27 // on the thread on which the respective RulesRegistry lives. | 27 // on the thread on which the respective RulesRegistry lives. |
| 28 // Returns false in case of errors. | 28 // Returns false in case of errors. |
| 29 virtual bool RunAsyncOnCorrectThread() = 0; | 29 virtual bool RunAsyncOnCorrectThread() = 0; |
| 30 | 30 |
| 31 scoped_refptr<RulesRegistry> rules_registry_; | 31 scoped_refptr<RulesRegistry> rules_registry_; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 class EventsEventAddRulesFunction : public RulesFunction { | 34 class EventsEventAddRulesFunction : public RulesFunction { |
| 35 public: | 35 public: |
| 36 DECLARE_EXTENSION_FUNCTION("events.addRules", EVENTS_ADDRULES) | 36 DECLARE_EXTENSION_FUNCTION("events.addRules", EVENTS_ADDRULES) |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 virtual ~EventsEventAddRulesFunction() {} | 39 virtual ~EventsEventAddRulesFunction() {} |
| 40 | 40 |
| 41 // RulesFunction: | 41 // RulesFunction: |
| 42 virtual bool RunAsyncOnCorrectThread() OVERRIDE; | 42 virtual bool RunAsyncOnCorrectThread() override; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class EventsEventRemoveRulesFunction : public RulesFunction { | 45 class EventsEventRemoveRulesFunction : public RulesFunction { |
| 46 public: | 46 public: |
| 47 DECLARE_EXTENSION_FUNCTION("events.removeRules", EVENTS_REMOVERULES) | 47 DECLARE_EXTENSION_FUNCTION("events.removeRules", EVENTS_REMOVERULES) |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 virtual ~EventsEventRemoveRulesFunction() {} | 50 virtual ~EventsEventRemoveRulesFunction() {} |
| 51 | 51 |
| 52 // RulesFunction: | 52 // RulesFunction: |
| 53 virtual bool RunAsyncOnCorrectThread() OVERRIDE; | 53 virtual bool RunAsyncOnCorrectThread() override; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 class EventsEventGetRulesFunction : public RulesFunction { | 56 class EventsEventGetRulesFunction : public RulesFunction { |
| 57 public: | 57 public: |
| 58 DECLARE_EXTENSION_FUNCTION("events.getRules", EVENTS_GETRULES) | 58 DECLARE_EXTENSION_FUNCTION("events.getRules", EVENTS_GETRULES) |
| 59 | 59 |
| 60 protected: | 60 protected: |
| 61 virtual ~EventsEventGetRulesFunction() {} | 61 virtual ~EventsEventGetRulesFunction() {} |
| 62 | 62 |
| 63 // RulesFunction: | 63 // RulesFunction: |
| 64 virtual bool RunAsyncOnCorrectThread() OVERRIDE; | 64 virtual bool RunAsyncOnCorrectThread() override; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace extensions | 67 } // namespace extensions |
| 68 | 68 |
| 69 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_API_H_ | 69 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_API_H_ |
| OLD | NEW |