@@ -11,16 +11,17 @@ external Chrome get chrome;
11
11
@anonymous
12
12
class Chrome {
13
13
external Action get action;
14
- external Debugger get debugger;
15
14
external Runtime get runtime;
16
- external Scripting get scripting;
17
- external Tabs get tabs;
18
15
}
19
16
17
+ /// chrome.action APIs
18
+ /// https://developer.chrome.com/docs/extensions/reference/action
19
+
20
20
@JS ()
21
21
@anonymous
22
22
class Action {
23
- // https://developer.chrome.com/docs/extensions/reference/action/#event-onClicked
23
+ external void setIcon (IconInfo iconInfo, Function ? callback);
24
+
24
25
external OnClickedHandler get onClicked;
25
26
}
26
27
@@ -32,27 +33,20 @@ class OnClickedHandler {
32
33
33
34
@JS ()
34
35
@anonymous
35
- class Debugger {
36
- // https://developer.chrome.com/docs/extensions/reference/debugger/#method-attach
37
- external void attach (
38
- Debuggee target, String requiredVersion, Function ? callback);
39
-
40
- // https://developer.chrome.com/docs/extensions/reference/debugger/#method-sendCommand
41
- external void sendCommand (Debuggee target, String method,
42
- Object ? commandParams, Function ? callback);
36
+ class IconInfo {
37
+ external String get path;
38
+ external factory IconInfo ({String path});
43
39
}
44
40
41
+ /// chrome.runtime APIs:
42
+ /// https://developer.chrome.com/docs/extensions/reference/runtime
43
+
45
44
@JS ()
46
45
@anonymous
47
46
class Runtime {
48
- // https://developer.chrome.com/docs/extensions/reference/runtime/#method-sendMessage
49
47
external void sendMessage (
50
48
String ? id, Object ? message, Object ? options, Function ? callback);
51
49
52
- // https://developer.chrome.com/docs/extensions/reference/runtime/#method-getURL
53
- external String getURL (String path);
54
-
55
- // https://developer.chrome.com/docs/extensions/reference/runtime/#event-onMessage
56
50
external OnMessageHandler get onMessage;
57
51
}
58
52
@@ -63,32 +57,6 @@ class OnMessageHandler {
63
57
void Function (dynamic , MessageSender , Function ) callback);
64
58
}
65
59
66
- @JS ()
67
- @anonymous
68
- class Scripting {
69
- // https://developer.chrome.com/docs/extensions/reference/scripting/#method-executeScript
70
- external executeScript (InjectDetails details, Function ? callback);
71
- }
72
-
73
- @JS ()
74
- @anonymous
75
- class Tabs {
76
- // https://developer.chrome.com/docs/extensions/reference/tabs/#method-query
77
- external Object query (QueryInfo queryInfo);
78
-
79
- // https://developer.chrome.com/docs/extensions/reference/tabs/#method-create
80
- external Object create (TabInfo tabInfo);
81
- }
82
-
83
- @JS ()
84
- @anonymous
85
- class Debuggee {
86
- external int get tabId;
87
- external String get extensionId;
88
- external String get targetId;
89
- external factory Debuggee ({int tabId, String ? extensionId, String ? targetId});
90
- }
91
-
92
60
@JS ()
93
61
@anonymous
94
62
class MessageSender {
@@ -98,41 +66,9 @@ class MessageSender {
98
66
external factory MessageSender ({String ? id, String ? url, Tab ? tab});
99
67
}
100
68
101
- @JS ()
102
- @anonymous
103
- class TabInfo {
104
- external bool ? get active;
105
- external bool ? get pinned;
106
- external String ? get url;
107
- external factory TabInfo ({bool ? active, bool ? pinned, String ? url});
108
- }
109
-
110
- @JS ()
111
- @anonymous
112
- class QueryInfo {
113
- external bool get active;
114
- external bool get currentWindow;
115
- external factory QueryInfo ({bool ? active, bool ? currentWindow});
116
- }
117
-
118
69
@JS ()
119
70
@anonymous
120
71
class Tab {
121
72
external int get id;
122
73
external String get url;
123
74
}
124
-
125
- @JS ()
126
- @anonymous
127
- class InjectDetails {
128
- external Target get target;
129
- external List <String >? get files;
130
- external factory InjectDetails ({Target target, List <String > files});
131
- }
132
-
133
- @JS ()
134
- @anonymous
135
- class Target {
136
- external int get tabId;
137
- external factory Target ({int tabId});
138
- }
0 commit comments