OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_RENDERER_API_BINDING_JS_UTIL_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_BINDING_JS_UTIL_H_ |
6 #define EXTENSIONS_RENDERER_API_BINDING_JS_UTIL_H_ | 6 #define EXTENSIONS_RENDERER_API_BINDING_JS_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 const std::vector<v8::Local<v8::Value>>& request_args); | 44 const std::vector<v8::Local<v8::Value>>& request_args); |
45 | 45 |
46 // A handler to register an argument massager for a specific event. | 46 // A handler to register an argument massager for a specific event. |
47 // Replacement for event_bindings.registerArgumentMassager. | 47 // Replacement for event_bindings.registerArgumentMassager. |
48 void RegisterEventArgumentMassager(gin::Arguments* arguments, | 48 void RegisterEventArgumentMassager(gin::Arguments* arguments, |
49 const std::string& event_name, | 49 const std::string& event_name, |
50 v8::Local<v8::Function> massager); | 50 v8::Local<v8::Function> massager); |
51 | 51 |
52 // A handler to allow custom bindings to create custom extension API event | 52 // A handler to allow custom bindings to create custom extension API event |
53 // objects (e.g. foo.onBar). | 53 // objects (e.g. foo.onBar). |
54 // TODO(devlin): Currently, we ignore schema and options. We'll need to take | 54 // Note: The JS version allows for constructing declarative events; it's |
55 // at least options into account. | 55 // unclear if we'll need to support this. |
| 56 // TODO(devlin): Currently, we ignore schema. We may want to take it into |
| 57 // account. |
56 void CreateCustomEvent(gin::Arguments* arguments, | 58 void CreateCustomEvent(gin::Arguments* arguments, |
57 v8::Local<v8::Value> v8_event_name, | 59 v8::Local<v8::Value> v8_event_name, |
58 v8::Local<v8::Value> unused_schema, | 60 v8::Local<v8::Value> unused_schema, |
59 v8::Local<v8::Value> unused_event_options); | 61 bool supports_filters); |
60 | 62 |
61 // Invalidates an event, removing its listeners and preventing any more from | 63 // Invalidates an event, removing its listeners and preventing any more from |
62 // being added. | 64 // being added. |
63 void InvalidateEvent(gin::Arguments* arguments, v8::Local<v8::Object> event); | 65 void InvalidateEvent(gin::Arguments* arguments, v8::Local<v8::Object> event); |
64 | 66 |
65 // Type references. Guaranteed to outlive this object. | 67 // Type references. Guaranteed to outlive this object. |
66 const APITypeReferenceMap* type_refs_; | 68 const APITypeReferenceMap* type_refs_; |
67 | 69 |
68 // The request handler. Guaranteed to outlive this object. | 70 // The request handler. Guaranteed to outlive this object. |
69 APIRequestHandler* request_handler_; | 71 APIRequestHandler* request_handler_; |
70 | 72 |
71 // The event handler. Guaranteed to outlive this object. | 73 // The event handler. Guaranteed to outlive this object. |
72 APIEventHandler* event_handler_; | 74 APIEventHandler* event_handler_; |
73 | 75 |
74 DISALLOW_COPY_AND_ASSIGN(APIBindingJSUtil); | 76 DISALLOW_COPY_AND_ASSIGN(APIBindingJSUtil); |
75 }; | 77 }; |
76 | 78 |
77 } // namespace extensions | 79 } // namespace extensions |
78 | 80 |
79 #endif // EXTENSIONS_RENDERER_API_BINDING_JS_UTIL_H_ | 81 #endif // EXTENSIONS_RENDERER_API_BINDING_JS_UTIL_H_ |
OLD | NEW |