OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EVENT_BINDINGS_H_ | 5 #ifndef EXTENSIONS_RENDERER_EVENT_BINDINGS_H_ |
6 #define EXTENSIONS_RENDERER_EVENT_BINDINGS_H_ | 6 #define EXTENSIONS_RENDERER_EVENT_BINDINGS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "extensions/renderer/object_backed_native_handler.h" | 13 #include "extensions/renderer/object_backed_native_handler.h" |
14 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
15 | 15 |
| 16 namespace IPC { |
| 17 class Sender; |
| 18 } |
| 19 |
16 namespace base { | 20 namespace base { |
17 class DictionaryValue; | 21 class DictionaryValue; |
18 } | 22 } |
19 | 23 |
20 namespace extensions { | 24 namespace extensions { |
21 class EventMatcher; | 25 class EventMatcher; |
22 | 26 |
23 // This class deals with the javascript bindings related to Event objects. | 27 // This class deals with the javascript bindings related to Event objects. |
24 class EventBindings : public ObjectBackedNativeHandler { | 28 class EventBindings : public ObjectBackedNativeHandler { |
25 public: | 29 public: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // |matcher_id| The ID of the filtered event. | 70 // |matcher_id| The ID of the filtered event. |
67 // |is_manual| false if this is part of the extension unload process where all | 71 // |is_manual| false if this is part of the extension unload process where all |
68 // listeners are automatically detached. | 72 // listeners are automatically detached. |
69 void DetachFilteredEvent(int matcher_id, bool is_manual); | 73 void DetachFilteredEvent(int matcher_id, bool is_manual); |
70 | 74 |
71 void MatchAgainstEventFilter(const v8::FunctionCallbackInfo<v8::Value>& args); | 75 void MatchAgainstEventFilter(const v8::FunctionCallbackInfo<v8::Value>& args); |
72 | 76 |
73 std::unique_ptr<EventMatcher> ParseEventMatcher( | 77 std::unique_ptr<EventMatcher> ParseEventMatcher( |
74 std::unique_ptr<base::DictionaryValue> filter); | 78 std::unique_ptr<base::DictionaryValue> filter); |
75 | 79 |
| 80 IPC::Sender* GetIPCSender(); |
| 81 |
76 // Called when our context, and therefore us, is invalidated. Run any cleanup. | 82 // Called when our context, and therefore us, is invalidated. Run any cleanup. |
77 void OnInvalidated(); | 83 void OnInvalidated(); |
78 | 84 |
79 // The set of attached events and filtered events. Maintain these so that we | 85 // The set of attached events and filtered events. Maintain these so that we |
80 // can detch them on unload. | 86 // can detch them on unload. |
81 std::set<std::string> attached_event_names_; | 87 std::set<std::string> attached_event_names_; |
82 std::set<int> attached_matcher_ids_; | 88 std::set<int> attached_matcher_ids_; |
83 | 89 |
84 DISALLOW_COPY_AND_ASSIGN(EventBindings); | 90 DISALLOW_COPY_AND_ASSIGN(EventBindings); |
85 }; | 91 }; |
86 | 92 |
87 } // namespace extensions | 93 } // namespace extensions |
88 | 94 |
89 #endif // EXTENSIONS_RENDERER_EVENT_BINDINGS_H_ | 95 #endif // EXTENSIONS_RENDERER_EVENT_BINDINGS_H_ |
OLD | NEW |