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

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

Issue 2912883004: [Extensions Bindings] Don't allow `event` module with native bindings (Closed)
Patch Set: jbroman'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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_DECLARATIVE_EVENT_H_ 5 #ifndef EXTENSIONS_RENDERER_DECLARATIVE_EVENT_H_
6 #define EXTENSIONS_RENDERER_DECLARATIVE_EVENT_H_ 6 #define EXTENSIONS_RENDERER_DECLARATIVE_EVENT_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "gin/wrappable.h" 10 #include "gin/wrappable.h"
11 #include "v8/include/v8.h" 11 #include "v8/include/v8.h"
12 12
13 namespace gin { 13 namespace gin {
14 class Arguments; 14 class Arguments;
15 } 15 }
16 16
17 namespace extensions { 17 namespace extensions {
18 class APIRequestHandler; 18 class APIRequestHandler;
19 class APITypeReferenceMap; 19 class APITypeReferenceMap;
20 20
21 // A gin::Wrappable object for declarative events (i.e., events that support 21 // A gin::Wrappable object for declarative events (i.e., events that support
22 // "rules"). Unlike regular events, these do not have associated listeners, and 22 // "rules"). Unlike regular events, these do not have associated listeners, and
23 // extensions register an action to perform when the event happens. 23 // extensions register an action to perform when the event happens.
24 class DeclarativeEvent final : public gin::Wrappable<DeclarativeEvent> { 24 class DeclarativeEvent final : public gin::Wrappable<DeclarativeEvent> {
25 public: 25 public:
26 DeclarativeEvent(const std::string& name, 26 DeclarativeEvent(const std::string& name,
27 APITypeReferenceMap* type_refs, 27 APITypeReferenceMap* type_refs,
28 APIRequestHandler* request_handler, 28 APIRequestHandler* request_handler,
29 const std::vector<std::string>& actions_list, 29 const std::vector<std::string>& actions_list,
30 const std::vector<std::string>& conditions_list); 30 const std::vector<std::string>& conditions_list,
31 int webview_instance_id);
31 ~DeclarativeEvent() override; 32 ~DeclarativeEvent() override;
32 33
33 static gin::WrapperInfo kWrapperInfo; 34 static gin::WrapperInfo kWrapperInfo;
34 35
35 // gin::Wrappable: 36 // gin::Wrappable:
36 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( 37 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
37 v8::Isolate* isolate) final; 38 v8::Isolate* isolate) final;
38 39
39 private: 40 private:
40 // Bound methods for the JS object. 41 // Bound methods for the JS object.
41 void AddRules(gin::Arguments* arguments); 42 void AddRules(gin::Arguments* arguments);
42 void RemoveRules(gin::Arguments* arguments); 43 void RemoveRules(gin::Arguments* arguments);
43 void GetRules(gin::Arguments* arguments); 44 void GetRules(gin::Arguments* arguments);
44 45
45 void HandleFunction(const std::string& signature_name, 46 void HandleFunction(const std::string& signature_name,
46 const std::string& request_name, 47 const std::string& request_name,
47 gin::Arguments* arguments); 48 gin::Arguments* arguments);
48 49
49 std::string event_name_; 50 std::string event_name_;
50 51
51 APITypeReferenceMap* type_refs_; 52 APITypeReferenceMap* type_refs_;
52 53
53 APIRequestHandler* request_handler_; 54 APIRequestHandler* request_handler_;
54 55
56 int webview_instance_id_;
lazyboy 2017/06/13 17:46:01 const;
Devlin 2017/06/13 22:30:53 Done.
57
55 DISALLOW_COPY_AND_ASSIGN(DeclarativeEvent); 58 DISALLOW_COPY_AND_ASSIGN(DeclarativeEvent);
56 }; 59 };
57 60
58 } // namespace extensions 61 } // namespace extensions
59 62
60 #endif // EXTENSIONS_RENDERER_DECLARATIVE_EVENT_H_ 63 #endif // EXTENSIONS_RENDERER_DECLARATIVE_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698