| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "extensions/common/event_filter.h" | 12 #include "extensions/common/event_filter.h" |
| 13 #include "extensions/renderer/api_binding_types.h" | 13 #include "extensions/renderer/api_binding_types.h" |
| 14 #include "extensions/renderer/event_emitter.h" | 14 #include "extensions/renderer/event_emitter.h" |
| 15 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class ListValue; | 18 class ListValue; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| 22 class EventFilteringInfo; | 22 struct EventFilteringInfo; |
| 23 | 23 |
| 24 // The object to handle API events. This includes vending v8::Objects for the | 24 // The object to handle API events. This includes vending v8::Objects for the |
| 25 // event; handling adding, removing, and querying listeners; and firing events | 25 // event; handling adding, removing, and querying listeners; and firing events |
| 26 // to subscribed listeners. Designed to be used across JS contexts, but on a | 26 // to subscribed listeners. Designed to be used across JS contexts, but on a |
| 27 // single thread. | 27 // single thread. |
| 28 class APIEventHandler { | 28 class APIEventHandler { |
| 29 public: | 29 public: |
| 30 // The callback to be called when event listeners change. |was_manual| | 30 // The callback to be called when event listeners change. |was_manual| |
| 31 // indicates that the change was due to an extension calling addListener or | 31 // indicates that the change was due to an extension calling addListener or |
| 32 // removeListener, rather than through something like context destruction. | 32 // removeListener, rather than through something like context destruction. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 // The associated EventFilter; shared across all contexts and events. | 104 // The associated EventFilter; shared across all contexts and events. |
| 105 EventFilter event_filter_; | 105 EventFilter event_filter_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(APIEventHandler); | 107 DISALLOW_COPY_AND_ASSIGN(APIEventHandler); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace extensions | 110 } // namespace extensions |
| 111 | 111 |
| 112 #endif // EXTENSIONS_RENDERER_API_EVENT_HANDLER_H_ | 112 #endif // EXTENSIONS_RENDERER_API_EVENT_HANDLER_H_ |
| OLD | NEW |