Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: extensions/renderer/event_bindings.h

Issue 2940893002: [Extensions] Pass EventFilteringInfo directly in DispatchEvent message (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/event_bindings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 { 16 namespace IPC {
17 class Sender; 17 class Sender;
18 } 18 }
19 19
20 namespace base { 20 namespace base {
21 class DictionaryValue;
22 class ListValue; 21 class ListValue;
23 } 22 }
24 23
25 namespace extensions { 24 namespace extensions {
25 struct EventFilteringInfo;
26 26
27 // This class deals with the javascript bindings related to Event objects. 27 // This class deals with the javascript bindings related to Event objects.
28 class EventBindings : public ObjectBackedNativeHandler { 28 class EventBindings : public ObjectBackedNativeHandler {
29 public: 29 public:
30 explicit EventBindings(ScriptContext* context); 30 explicit EventBindings(ScriptContext* context);
31 ~EventBindings() override; 31 ~EventBindings() override;
32 32
33 // Returns true if there is a listener for the given |event| in the given 33 // Returns true if there is a listener for the given |event| in the given
34 // |context|. 34 // |context|.
35 static bool HasListener(ScriptContext* context, 35 static bool HasListener(ScriptContext* context,
36 const std::string& event_name); 36 const std::string& event_name);
37 37
38 // Dispatches the event in the given |context| with the provided 38 // Dispatches the event in the given |context| with the provided
39 // |event_args| and |filtering_info|. 39 // |event_args| and |filtering_info|.
40 static void DispatchEventInContext( 40 static void DispatchEventInContext(const std::string& event_name,
41 const std::string& event_name, 41 const base::ListValue* event_args,
42 const base::ListValue* event_args, 42 const EventFilteringInfo* filtering_info,
43 const base::DictionaryValue* filtering_info, 43 ScriptContext* context);
44 ScriptContext* context);
45 44
46 private: 45 private:
47 // JavaScript handler which forwards to AttachEvent(). 46 // JavaScript handler which forwards to AttachEvent().
48 // args[0] forwards to |event_name|. 47 // args[0] forwards to |event_name|.
49 void AttachEventHandler(const v8::FunctionCallbackInfo<v8::Value>& args); 48 void AttachEventHandler(const v8::FunctionCallbackInfo<v8::Value>& args);
50 49
51 // Attach an event name to an object. 50 // Attach an event name to an object.
52 // |event_name| The name of the event to attach. 51 // |event_name| The name of the event to attach.
53 void AttachEvent(const std::string& event_name); 52 void AttachEvent(const std::string& event_name);
54 53
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // can detch them on unload. 96 // can detch them on unload.
98 std::set<std::string> attached_event_names_; 97 std::set<std::string> attached_event_names_;
99 std::set<int> attached_matcher_ids_; 98 std::set<int> attached_matcher_ids_;
100 99
101 DISALLOW_COPY_AND_ASSIGN(EventBindings); 100 DISALLOW_COPY_AND_ASSIGN(EventBindings);
102 }; 101 };
103 102
104 } // namespace extensions 103 } // namespace extensions
105 104
106 #endif // EXTENSIONS_RENDERER_EVENT_BINDINGS_H_ 105 #endif // EXTENSIONS_RENDERER_EVENT_BINDINGS_H_
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/event_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698