2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
+ import 'dart:html' ;
6
+
5
7
import 'package:js/js.dart' ;
6
8
7
9
@JS ()
@@ -12,6 +14,7 @@ external Chrome get chrome;
12
14
class Chrome {
13
15
external Action get action;
14
16
external Debugger get debugger;
17
+ external Devtools get devtools;
15
18
external Notifications get notifications;
16
19
external Runtime get runtime;
17
20
external Scripting get scripting;
@@ -87,6 +90,50 @@ class Debuggee {
87
90
external factory Debuggee ({int tabId, String ? extensionId, String ? targetId});
88
91
}
89
92
93
+ /// chrome.devtools APIs:
94
+
95
+ @JS ()
96
+ @anonymous
97
+ class Devtools {
98
+ // https://developer.chrome.com/docs/extensions/reference/devtools_inspectedWindow
99
+ external InspectedWindow get inspectedWindow;
100
+
101
+ // https://developer.chrome.com/docs/extensions/reference/devtools_panels/
102
+ external Panels get panels;
103
+ }
104
+
105
+ @JS ()
106
+ @anonymous
107
+ class InspectedWindow {
108
+ external int get tabId;
109
+ }
110
+
111
+ @JS ()
112
+ @anonymous
113
+ class Panels {
114
+ external void create (String title, String iconPath, String pagePath,
115
+ void Function (ExtensionPanel )? callback);
116
+ }
117
+
118
+ @JS ()
119
+ @anonymous
120
+ class ExtensionPanel {
121
+ external OnHiddenHandler get onHidden;
122
+ external OnShownHandler get onShown;
123
+ }
124
+
125
+ @JS ()
126
+ @anonymous
127
+ class OnHiddenHandler {
128
+ external void addListener (void Function () callback);
129
+ }
130
+
131
+ @JS ()
132
+ @anonymous
133
+ class OnShownHandler {
134
+ external void addListener (void Function (Window window) callback);
135
+ }
136
+
90
137
/// chrome.notification APIs:
91
138
/// https://developer.chrome.com/docs/extensions/reference/notifications
92
139
@@ -211,6 +258,8 @@ class Storage {
211
258
external StorageArea get local;
212
259
213
260
external StorageArea get session;
261
+
262
+ external OnChangedHandler get onChanged;
214
263
}
215
264
216
265
@JS ()
@@ -223,6 +272,14 @@ class StorageArea {
223
272
external Object remove (List <String > keys, void Function ()? callback);
224
273
}
225
274
275
+ @JS ()
276
+ @anonymous
277
+ class OnChangedHandler {
278
+ external void addListener (
279
+ void Function (Object changes, String areaName) callback,
280
+ );
281
+ }
282
+
226
283
/// chrome.tabs APIs
227
284
/// https://developer.chrome.com/docs/extensions/reference/tabs
228
285
0 commit comments