| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_EVENT_HANDLER_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_EVENT_HANDLER_H_ |
| 6 #define EXTENSIONS_RENDERER_API_EVENT_HANDLER_H_ | 6 #define EXTENSIONS_RENDERER_API_EVENT_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 base::Callback<void(const std::string& event_name, | 35 base::Callback<void(const std::string& event_name, |
| 36 binding::EventListenersChanged, | 36 binding::EventListenersChanged, |
| 37 const base::DictionaryValue* filter, | 37 const base::DictionaryValue* filter, |
| 38 bool was_manual, | 38 bool was_manual, |
| 39 v8::Local<v8::Context>)>; | 39 v8::Local<v8::Context>)>; |
| 40 | 40 |
| 41 APIEventHandler(const binding::RunJSFunction& call_js, | 41 APIEventHandler(const binding::RunJSFunction& call_js, |
| 42 const EventListenersChangedMethod& listeners_changed); | 42 const EventListenersChangedMethod& listeners_changed); |
| 43 ~APIEventHandler(); | 43 ~APIEventHandler(); |
| 44 | 44 |
| 45 // Returns a new v8::Object for an event with the given |event_name|. | 45 // Returns a new v8::Object for an event with the given |event_name|. If |
| 46 // |notify_on_change| is true, notifies whenever listeners state is changed. |
| 46 v8::Local<v8::Object> CreateEventInstance(const std::string& event_name, | 47 v8::Local<v8::Object> CreateEventInstance(const std::string& event_name, |
| 47 bool supports_filters, | 48 bool supports_filters, |
| 48 int max_listeners, | 49 int max_listeners, |
| 50 bool notify_on_change, |
| 49 v8::Local<v8::Context> context); | 51 v8::Local<v8::Context> context); |
| 50 | 52 |
| 51 // Creates a new event without any name. This is used by custom bindings when | 53 // Creates a new event without any name. This is used by custom bindings when |
| 52 // the entirety of the logic for the event is contained in the renderer. These | 54 // the entirety of the logic for the event is contained in the renderer. These |
| 53 // events do not notify of new/removed listeners or allow for dispatching | 55 // events do not notify of new/removed listeners or allow for dispatching |
| 54 // through FireEventInContext(). | 56 // through FireEventInContext(). |
| 55 v8::Local<v8::Object> CreateAnonymousEventInstance( | 57 v8::Local<v8::Object> CreateAnonymousEventInstance( |
| 56 v8::Local<v8::Context> context); | 58 v8::Local<v8::Context> context); |
| 57 | 59 |
| 58 // Invalidates the given |event|. | 60 // Invalidates the given |event|. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 95 |
| 94 // The associated EventFilter; shared across all contexts and events. | 96 // The associated EventFilter; shared across all contexts and events. |
| 95 EventFilter event_filter_; | 97 EventFilter event_filter_; |
| 96 | 98 |
| 97 DISALLOW_COPY_AND_ASSIGN(APIEventHandler); | 99 DISALLOW_COPY_AND_ASSIGN(APIEventHandler); |
| 98 }; | 100 }; |
| 99 | 101 |
| 100 } // namespace extensions | 102 } // namespace extensions |
| 101 | 103 |
| 102 #endif // EXTENSIONS_RENDERER_API_EVENT_HANDLER_H_ | 104 #endif // EXTENSIONS_RENDERER_API_EVENT_HANDLER_H_ |
| OLD | NEW |