| 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 <set> | 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.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 base { | 16 namespace base { |
| 17 class DictionaryValue; | 17 class DictionaryValue; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 class EventMatcher; | 21 class EventMatcher; |
| 22 | 22 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // Detaches a filtered event. Unlike a normal event, a filtered event is | 64 // Detaches a filtered event. Unlike a normal event, a filtered event is |
| 65 // identified by a unique ID per filter, not its name. | 65 // identified by a unique ID per filter, not its name. |
| 66 // |matcher_id| The ID of the filtered event. | 66 // |matcher_id| The ID of the filtered event. |
| 67 // |is_manual| false if this is part of the extension unload process where all | 67 // |is_manual| false if this is part of the extension unload process where all |
| 68 // listeners are automatically detached. | 68 // listeners are automatically detached. |
| 69 void DetachFilteredEvent(int matcher_id, bool is_manual); | 69 void DetachFilteredEvent(int matcher_id, bool is_manual); |
| 70 | 70 |
| 71 void MatchAgainstEventFilter(const v8::FunctionCallbackInfo<v8::Value>& args); | 71 void MatchAgainstEventFilter(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 72 | 72 |
| 73 scoped_ptr<EventMatcher> ParseEventMatcher( | 73 std::unique_ptr<EventMatcher> ParseEventMatcher( |
| 74 scoped_ptr<base::DictionaryValue> filter); | 74 std::unique_ptr<base::DictionaryValue> filter); |
| 75 | 75 |
| 76 // Called when our context, and therefore us, is invalidated. Run any cleanup. | 76 // Called when our context, and therefore us, is invalidated. Run any cleanup. |
| 77 void OnInvalidated(); | 77 void OnInvalidated(); |
| 78 | 78 |
| 79 // The set of attached events and filtered events. Maintain these so that we | 79 // The set of attached events and filtered events. Maintain these so that we |
| 80 // can detch them on unload. | 80 // can detch them on unload. |
| 81 std::set<std::string> attached_event_names_; | 81 std::set<std::string> attached_event_names_; |
| 82 std::set<int> attached_matcher_ids_; | 82 std::set<int> attached_matcher_ids_; |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(EventBindings); | 84 DISALLOW_COPY_AND_ASSIGN(EventBindings); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace extensions | 87 } // namespace extensions |
| 88 | 88 |
| 89 #endif // EXTENSIONS_RENDERER_EVENT_BINDINGS_H_ | 89 #endif // EXTENSIONS_RENDERER_EVENT_BINDINGS_H_ |
| OLD | NEW |