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

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

Issue 2909673003: [Extensions Bindings] Request JS execution from messaging bindings (Closed)
Patch Set: lazyboy's 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/event_bindings.cc ('k') | extensions/renderer/extension_bindings_system.h » ('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 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_EVENT_EMITTER_H_ 5 #ifndef EXTENSIONS_RENDERER_EVENT_EMITTER_H_
6 #define EXTENSIONS_RENDERER_EVENT_EMITTER_H_ 6 #define EXTENSIONS_RENDERER_EVENT_EMITTER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "extensions/renderer/api_binding_types.h" 10 #include "extensions/renderer/api_binding_types.h"
(...skipping 25 matching lines...) Expand all
36 v8::Isolate* isolate) final; 36 v8::Isolate* isolate) final;
37 37
38 void Fire(v8::Local<v8::Context> context, 38 void Fire(v8::Local<v8::Context> context,
39 std::vector<v8::Local<v8::Value>>* args, 39 std::vector<v8::Local<v8::Value>>* args,
40 const EventFilteringInfo* filter); 40 const EventFilteringInfo* filter);
41 41
42 // Removes all listeners and marks this object as invalid so that no more 42 // Removes all listeners and marks this object as invalid so that no more
43 // are added. 43 // are added.
44 void Invalidate(v8::Local<v8::Context> context); 44 void Invalidate(v8::Local<v8::Context> context);
45 45
46 // TODO(devlin): Consider making this a test-only method and exposing
47 // HasListeners() instead.
46 size_t GetNumListeners() const; 48 size_t GetNumListeners() const;
47 49
48 private: 50 private:
49 // Bound methods for the Event JS object. 51 // Bound methods for the Event JS object.
50 void AddListener(gin::Arguments* arguments); 52 void AddListener(gin::Arguments* arguments);
51 void RemoveListener(gin::Arguments* arguments); 53 void RemoveListener(gin::Arguments* arguments);
52 bool HasListener(v8::Local<v8::Function> function); 54 bool HasListener(v8::Local<v8::Function> function);
53 bool HasListeners(); 55 bool HasListeners();
54 void Dispatch(gin::Arguments* arguments); 56 void Dispatch(gin::Arguments* arguments);
55 57
56 // Whether or not this object is still valid; false upon context release. 58 // Whether or not this object is still valid; false upon context release.
57 // When invalid, no listeners can be added or removed. 59 // When invalid, no listeners can be added or removed.
58 bool valid_ = true; 60 bool valid_ = true;
59 61
60 // Whether the event supports filters. 62 // Whether the event supports filters.
61 bool supports_filters_ = false; 63 bool supports_filters_ = false;
62 64
63 std::unique_ptr<APIEventListeners> listeners_; 65 std::unique_ptr<APIEventListeners> listeners_;
64 66
65 binding::RunJSFunction run_js_; 67 binding::RunJSFunction run_js_;
66 68
67 DISALLOW_COPY_AND_ASSIGN(EventEmitter); 69 DISALLOW_COPY_AND_ASSIGN(EventEmitter);
68 }; 70 };
69 71
70 } // namespace extensions 72 } // namespace extensions
71 73
72 #endif // EXTENSIONS_RENDERER_EVENT_EMITTER_H_ 74 #endif // EXTENSIONS_RENDERER_EVENT_EMITTER_H_
OLDNEW
« no previous file with comments | « extensions/renderer/event_bindings.cc ('k') | extensions/renderer/extension_bindings_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698