Chromium Code Reviews| Index: extensions/renderer/api_event_handler.h |
| diff --git a/extensions/renderer/api_event_handler.h b/extensions/renderer/api_event_handler.h |
| index 13451d4b5cbec6f218d32cdd633b19d6f9659ed7..e3e4ce9c2f36198096717cd6b504dedbb7e0dfbf 100644 |
| --- a/extensions/renderer/api_event_handler.h |
| +++ b/extensions/renderer/api_event_handler.h |
| @@ -75,9 +75,10 @@ class APIEventHandler { |
| const std::string& event_name, |
| v8::Local<v8::Function> function); |
| - // Returns the EventListeners for a given |event_name| and |context|. |
| - size_t GetNumEventListenersForTesting(const std::string& event_name, |
| - v8::Local<v8::Context> context); |
| + // Returns true if there is a listener for the given |event_name| in the |
| + // given |context|. |
| + bool HasListenerForEvent(const std::string& event_name, |
| + v8::Local<v8::Context> context); |
| // Invalidates listeners for the given |context|. It's a shame we have to |
| // have this separately (as opposed to hooking into e.g. a PerContextData |
| @@ -85,6 +86,10 @@ class APIEventHandler { |
| // (because the associated extension ScriptContext needs to be valid). |
| void InvalidateContext(v8::Local<v8::Context> context); |
| + // Returns the EventListeners for a given |event_name| and |context|. |
|
lazyboy
2017/06/05 18:18:32
the number of EventListeners
Devlin
2017/06/09 20:18:02
Done.
|
| + size_t GetNumEventListenersForTesting(const std::string& event_name, |
| + v8::Local<v8::Context> context); |
| + |
| private: |
| // Method to run a given v8::Function. Curried in for testing. |
| binding::RunJSFunction call_js_; |