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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // ExtensionFunction: | 22 // ExtensionFunction: |
23 bool HasPermission() override; | 23 bool HasPermission() override; |
24 bool RunAsync() override; | 24 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 // Records UMA metrics for the kind of declarative API call. |
| 32 virtual void RecordUMA(const std::string& event_name) const = 0; |
| 33 |
31 scoped_refptr<RulesRegistry> rules_registry_; | 34 scoped_refptr<RulesRegistry> rules_registry_; |
32 }; | 35 }; |
33 | 36 |
34 class EventsEventAddRulesFunction : public RulesFunction { | 37 class EventsEventAddRulesFunction : public RulesFunction { |
35 public: | 38 public: |
36 DECLARE_EXTENSION_FUNCTION("events.addRules", EVENTS_ADDRULES) | 39 DECLARE_EXTENSION_FUNCTION("events.addRules", EVENTS_ADDRULES) |
37 | 40 |
38 protected: | 41 protected: |
39 ~EventsEventAddRulesFunction() override {} | 42 ~EventsEventAddRulesFunction() override {} |
40 | 43 |
41 // RulesFunction: | 44 // RulesFunction: |
42 bool RunAsyncOnCorrectThread() override; | 45 bool RunAsyncOnCorrectThread() override; |
| 46 void RecordUMA(const std::string& event_name) const override; |
43 }; | 47 }; |
44 | 48 |
45 class EventsEventRemoveRulesFunction : public RulesFunction { | 49 class EventsEventRemoveRulesFunction : public RulesFunction { |
46 public: | 50 public: |
47 DECLARE_EXTENSION_FUNCTION("events.removeRules", EVENTS_REMOVERULES) | 51 DECLARE_EXTENSION_FUNCTION("events.removeRules", EVENTS_REMOVERULES) |
48 | 52 |
49 protected: | 53 protected: |
50 ~EventsEventRemoveRulesFunction() override {} | 54 ~EventsEventRemoveRulesFunction() override {} |
51 | 55 |
52 // RulesFunction: | 56 // RulesFunction: |
53 bool RunAsyncOnCorrectThread() override; | 57 bool RunAsyncOnCorrectThread() override; |
| 58 void RecordUMA(const std::string& event_name) const override; |
54 }; | 59 }; |
55 | 60 |
56 class EventsEventGetRulesFunction : public RulesFunction { | 61 class EventsEventGetRulesFunction : public RulesFunction { |
57 public: | 62 public: |
58 DECLARE_EXTENSION_FUNCTION("events.getRules", EVENTS_GETRULES) | 63 DECLARE_EXTENSION_FUNCTION("events.getRules", EVENTS_GETRULES) |
59 | 64 |
60 protected: | 65 protected: |
61 ~EventsEventGetRulesFunction() override {} | 66 ~EventsEventGetRulesFunction() override {} |
62 | 67 |
63 // RulesFunction: | 68 // RulesFunction: |
64 bool RunAsyncOnCorrectThread() override; | 69 bool RunAsyncOnCorrectThread() override; |
| 70 void RecordUMA(const std::string& event_name) const override; |
65 }; | 71 }; |
66 | 72 |
67 } // namespace extensions | 73 } // namespace extensions |
68 | 74 |
69 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_API_H_ | 75 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_API_H_ |
OLD | NEW |