Reland the ULONG -> SIZE_T change from 317177
[chromium-blink-merge.git] / extensions / renderer / event_bindings.h
blob0f69cd36edf4f6af562c102a3660d16b21e9a154
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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_RENDERER_EVENT_BINDINGS_H_
6 #define EXTENSIONS_RENDERER_EVENT_BINDINGS_H_
8 #include "extensions/renderer/object_backed_native_handler.h"
9 #include "v8/include/v8.h"
11 namespace base {
12 class DictionaryValue;
15 namespace extensions {
16 class Dispatcher;
17 class EventFilter;
18 class EventFilteringInfo;
19 class EventMatcher;
21 // This class deals with the javascript bindings related to Event objects.
22 class EventBindings : public ObjectBackedNativeHandler {
23 public:
24 EventBindings(Dispatcher* dispatcher, ScriptContext* context);
25 ~EventBindings() override;
27 private:
28 // Attach an event name to an object.
29 // |event_name| The name of the event to attach.
30 void AttachEvent(const v8::FunctionCallbackInfo<v8::Value>& args);
32 // Detach an event name from an object.
33 // |event_name| The name of the event to stop listening to.
34 // |is_manual| True if this detach was done by the user via removeListener()
35 // as opposed to automatically during shutdown, in which case we should inform
36 // the browser we are no longer interested in that event.
37 void DetachEvent(const v8::FunctionCallbackInfo<v8::Value>& args);
39 // MatcherID AttachFilteredEvent(string event_name, object filter)
40 // |event_name| Name of the event to attach.
41 // |filter| Which instances of the named event are we interested in.
42 // returns the id assigned to the listener, which will be returned from calls
43 // to MatchAgainstEventFilter where this listener matches.
44 void AttachFilteredEvent(const v8::FunctionCallbackInfo<v8::Value>& args);
46 // void DetachFilteredEvent(int id, bool manual)
47 // id - Id of the event to detach.
48 // manual - false if this is part of the extension unload process where all
49 // listeners are automatically detached.
50 void DetachFilteredEvent(const v8::FunctionCallbackInfo<v8::Value>& args);
52 void MatchAgainstEventFilter(const v8::FunctionCallbackInfo<v8::Value>& args);
54 Dispatcher* dispatcher_;
55 scoped_ptr<EventMatcher> ParseEventMatcher(
56 base::DictionaryValue* filter_dict);
59 } // namespace extensions
61 #endif // EXTENSIONS_RENDERER_EVENT_BINDINGS_H_