@types/chrome 0.0.322 → 0.0.324

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +315 -371
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (https://developer.chrome.com/
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 12 May 2025 12:44:33 GMT
11
+ * Last updated: Fri, 30 May 2025 00:47:14 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -2,6 +2,9 @@
2
2
  /// <reference path="./har-format/index.d.ts" />
3
3
  /// <reference path="./chrome-cast/index.d.ts" />
4
4
 
5
+ // Helpers
6
+ type SetRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
7
+
5
8
  ////////////////////
6
9
  // Global object
7
10
  ////////////////////
@@ -147,20 +150,17 @@ declare namespace chrome {
147
150
  * @since Chrome 88, MV3
148
151
  */
149
152
  export namespace action {
150
- /** @deprecated Use BadgeColorDetails instead. */
151
- export interface BadgeBackgroundColorDetails extends BadgeColorDetails {}
152
-
153
153
  export interface BadgeColorDetails {
154
- /** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with a CSS value, with opaque red being #FF0000 or #F00. */
154
+ /** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is `[255, 0, 0, 255]`. Can also be a string with a CSS value, with opaque red being `#FF0000` or `#F00`. */
155
155
  color: string | ColorArray;
156
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
156
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
157
157
  tabId?: number | undefined;
158
158
  }
159
159
 
160
160
  export interface BadgeTextDetails {
161
- /** Any number of characters can be passed, but only about four can fit in the space. */
162
- text: string;
163
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
161
+ /** Any number of characters can be passed, but only about four can fit in the space. If an empty string (`''`) is passed, the badge text is cleared. If `tabId` is specified and `text` is null, the text for the specified tab is cleared and defaults to the global badge text. */
162
+ text?: string | undefined;
163
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
164
164
  tabId?: number | undefined;
165
165
  }
166
166
 
@@ -169,33 +169,34 @@ declare namespace chrome {
169
169
  export interface TitleDetails {
170
170
  /** The string the action should display when moused over. */
171
171
  title: string;
172
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
172
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
173
173
  tabId?: number | undefined;
174
174
  }
175
175
 
176
176
  export interface PopupDetails {
177
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
177
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
178
178
  tabId?: number | undefined;
179
- /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */
179
+ /** The html file to show in a popup. If set to the empty string (`''`), no popup is shown. */
180
180
  popup: string;
181
181
  }
182
182
 
183
183
  export interface TabIconDetails {
184
- /** Optional. Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' */
184
+ /** Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}' */
185
185
  path?: string | { [index: number]: string } | undefined;
186
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
186
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
187
187
  tabId?: number | undefined;
188
- /** Optional. Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' */
188
+ /** Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}' */
189
189
  imageData?: ImageData | { [index: number]: ImageData } | undefined;
190
190
  }
191
191
 
192
+ /** @since Chrome 99 */
192
193
  export interface OpenPopupOptions {
193
- /** Optional. The id of the window to open the action popup in. Defaults to the currently-active window if unspecified. */
194
+ /** The id of the window to open the action popup in. Defaults to the currently-active window if unspecified. */
194
195
  windowId?: number | undefined;
195
196
  }
196
197
 
197
198
  export interface TabDetails {
198
- /** Optional. The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
199
+ /** The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
199
200
  tabId?: number | undefined;
200
201
  }
201
202
 
@@ -215,232 +216,154 @@ declare namespace chrome {
215
216
  }
216
217
 
217
218
  /**
218
- * @since Chrome 88
219
219
  * Disables the action for a tab.
220
- * @param tabId The id of the tab for which you want to modify the action.
221
- * @return The `disable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
220
+ * @param tabId The ID of the tab for which you want to modify the action.
221
+ *
222
+ * Can return its result via Promise.
222
223
  */
223
224
  export function disable(tabId?: number): Promise<void>;
224
-
225
- /**
226
- * @since Chrome 88
227
- * Disables the action for a tab.
228
- * @param tabId The id of the tab for which you want to modify the action.
229
- * @param callback
230
- */
231
225
  export function disable(callback: () => void): void;
232
- export function disable(tabId: number, callback: () => void): void;
226
+ export function disable(tabId: number | undefined, callback: () => void): void;
233
227
 
234
228
  /**
235
- * @since Chrome 88
236
229
  * Enables the action for a tab. By default, actions are enabled.
237
- * @param tabId The id of the tab for which you want to modify the action.
238
- * @return The `enable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
230
+ * @param tabId The ID of the tab for which you want to modify the action.
231
+ *
232
+ * Can return its result via Promise.
239
233
  */
240
234
  export function enable(tabId?: number): Promise<void>;
241
-
242
- /**
243
- * @since Chrome 88
244
- * Enables the action for a tab. By default, actions are enabled.
245
- * @param tabId The id of the tab for which you want to modify the action.
246
- * @param callback
247
- */
248
235
  export function enable(callback: () => void): void;
249
- export function enable(tabId: number, callback: () => void): void;
236
+ export function enable(tabId: number | undefined, callback: () => void): void;
250
237
 
251
238
  /**
252
- * @since Chrome 88
253
- * Gets the background color of the action.
254
- */
255
- export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
256
- /**
257
- * @since Chrome 88
258
239
  * Gets the background color of the action.
259
- * @return The `getBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only).
240
+ *
241
+ * Can return its result via Promise.
260
242
  */
261
243
  export function getBadgeBackgroundColor(details: TabDetails): Promise<ColorArray>;
244
+ export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
262
245
 
263
246
  /**
264
- * @since Chrome 88
265
- * Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.
266
- * If displayActionCountAsBadgeText is enabled, a placeholder text will be returned unless the
267
- * declarativeNetRequestFeedback permission is present or tab-specific badge text was provided.
268
- */
269
- export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
270
-
271
- /**
272
- * @since Chrome 88
273
- * Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.
274
- * If displayActionCountAsBadgeText is enabled, a placeholder text will be returned unless the
275
- * declarativeNetRequestFeedback permission is present or tab-specific badge text was provided.
276
- * @return The `getBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only).
247
+ * Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned. If {@link declarativeNetRequest.ExtensionActionOptions.displayActionCountAsBadgeText displayActionCountAsBadgeText} is enabled, a placeholder text will be returned unless the {@link runtime.ManifestPermissions declarativeNetRequestFeedback} permission is present or tab-specific badge text was provided.
248
+ *
249
+ * Can return its result via Promise.
277
250
  */
278
251
  export function getBadgeText(details: TabDetails): Promise<string>;
252
+ export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
279
253
 
280
254
  /**
281
- * @since Chrome 110
282
255
  * Gets the text color of the action.
283
- */
284
- export function getBadgeTextColor(details: TabDetails, callback: (result: ColorArray) => void): void;
285
-
286
- /**
256
+ *
257
+ * Can return its result via Promise.
287
258
  * @since Chrome 110
288
- * Gets the text color of the action.
289
- * @return The `getBadgeTextColor` method provides its result via callback or returned as a `Promise` (MV3 only).
290
259
  */
291
260
  export function getBadgeTextColor(details: TabDetails): Promise<ColorArray>;
261
+ export function getBadgeTextColor(details: TabDetails, callback: (result: ColorArray) => void): void;
292
262
 
293
263
  /**
294
- * @since Chrome 88
295
- * Gets the html document set as the popup for this action.
296
- */
297
- export function getPopup(details: TabDetails, callback: (result: string) => void): void;
298
-
299
- /**
300
- * @since Chrome 88
301
264
  * Gets the html document set as the popup for this action.
302
- * @return The `getPopup` method provides its result via callback or returned as a `Promise` (MV3 only).
265
+ *
266
+ * Can return its result via Promise.
303
267
  */
304
268
  export function getPopup(details: TabDetails): Promise<string>;
269
+ export function getPopup(details: TabDetails, callback: (result: string) => void): void;
305
270
 
306
271
  /**
307
- * @since Chrome 88
308
- * Gets the title of the action.
309
- */
310
- export function getTitle(details: TabDetails, callback: (result: string) => void): void;
311
-
312
- /**
313
- * @since Chrome 88
314
272
  * Gets the title of the action.
315
- * @return The `getTitle` method provides its result via callback or returned as a `Promise` (MV3 only).
273
+ *
274
+ * Can return its result via Promise.
316
275
  */
317
276
  export function getTitle(details: TabDetails): Promise<string>;
277
+ export function getTitle(details: TabDetails, callback: (result: string) => void): void;
318
278
 
319
279
  /**
320
- * @since Chrome 91
321
280
  * Returns the user-specified settings relating to an extension's action.
322
- */
323
- export function getUserSettings(callback: (userSettings: UserSettings) => void): void;
324
-
325
- /**
281
+ *
282
+ * Can return its result via Promise.
326
283
  * @since Chrome 91
327
- * Returns the user-specified settings relating to an extension's action.
328
- * @return The `getUserSettings` method provides its result via callback or returned as a `Promise` (MV3 only).
329
284
  */
330
285
  export function getUserSettings(): Promise<UserSettings>;
286
+ export function getUserSettings(callback: (userSettings: UserSettings) => void): void;
331
287
 
332
288
  /**
289
+ * Indicates whether the extension action is enabled for a tab (or globally if no `tabId` is provided). Actions enabled using only {@link declarativeContent} always return false.
290
+ *
291
+ * Can return its result via Promise.
333
292
  * @since Chrome 110
334
- * Indicates whether the extension action is enabled for a tab (or globally if no tabId is provided). Actions enabled using only declarativeContent always return false.
335
- */
336
- export function isEnabled(tabId: number | undefined, callback: (isEnabled: boolean) => void): void;
337
-
338
- /**
339
- * @since Chrome 110
340
- * Indicates whether the extension action is enabled for a tab (or globally if no tabId is provided). Actions enabled using only declarativeContent always return false.
341
- * @return True if the extension action is enabled.
342
293
  */
343
294
  export function isEnabled(tabId?: number): Promise<boolean>;
295
+ export function isEnabled(callback: (isEnabled: boolean) => void): void;
296
+ export function isEnabled(tabId: number | undefined, callback: (isEnabled: boolean) => void): void;
344
297
 
345
298
  /**
346
- * @since Chrome 99
347
- * Opens the extension's popup.
299
+ * Opens the extension's popup. Between Chrome 118 and Chrome 126, this is only available to policy installed extensions.
300
+ *
348
301
  * @param options Specifies options for opening the popup.
349
- * () => {...}
350
- * @return The `openPopup` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
302
+ *
303
+ * Can return its result via Promise.
304
+ * @since Chrome 127
351
305
  */
352
306
  export function openPopup(options?: OpenPopupOptions): Promise<void>;
353
-
354
- /**
355
- * @since Chrome 99
356
- * Opens the extension's popup.
357
- * @param options Specifies options for opening the popup.
358
- */
359
307
  export function openPopup(callback: () => void): void;
360
- export function openPopup(options: OpenPopupOptions, callback: () => void): void;
308
+ export function openPopup(options: OpenPopupOptions | undefined, callback: () => void): void;
361
309
 
362
310
  /**
363
- * @since Chrome 88
364
311
  * Sets the background color for the badge.
365
- * @return The `setBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
312
+ *
313
+ * Can return its result via Promise.
366
314
  */
367
315
  export function setBadgeBackgroundColor(details: BadgeColorDetails): Promise<void>;
368
-
369
- /**
370
- * @since Chrome 88
371
- * Sets the background color for the badge.
372
- */
373
316
  export function setBadgeBackgroundColor(details: BadgeColorDetails, callback: () => void): void;
374
317
 
375
318
  /**
376
- * @since Chrome 88
377
319
  * Sets the badge text for the action. The badge is displayed on top of the icon.
378
- * @return The `setBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
320
+ *
321
+ * Can return its result via Promise.
379
322
  */
380
323
  export function setBadgeText(details: BadgeTextDetails): Promise<void>;
381
-
382
- /**
383
- * @since Chrome 88
384
- * Sets the badge text for the action. The badge is displayed on top of the icon.
385
- */
386
324
  export function setBadgeText(details: BadgeTextDetails, callback: () => void): void;
387
325
 
388
326
  /**
389
- * @since Chrome 110
390
327
  * Sets the text color for the badge.
391
- * @return The `setBadgeTextColor` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
328
+ *
329
+ * Can return its result via Promise.
330
+ * @since Chrome 110
392
331
  */
393
332
  export function setBadgeTextColor(details: BadgeColorDetails): Promise<void>;
394
-
395
- /**
396
- * @since Chrome 100
397
- * Sets the text color for the badge.
398
- */
399
333
  export function setBadgeTextColor(details: BadgeColorDetails, callback: () => void): void;
400
334
 
401
335
  /**
402
- * @since Chrome 88
403
- * Sets the icon for the action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element,
404
- * or as dictionary of either one of those. Either the path or the imageData property must be specified.
405
- * @return The `setIcon` method provides its result via callback or returned as a `Promise` (MV3 only). Since Chrome 96.
336
+ * Sets the icon for the action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified.
337
+ *
338
+ * Can return its result via Promise.
406
339
  */
407
340
  export function setIcon(details: TabIconDetails): Promise<void>;
408
341
  export function setIcon(details: TabIconDetails, callback: () => void): void;
409
342
 
410
343
  /**
411
- * @since Chrome 88
412
344
  * Sets the html document to be opened as a popup when the user clicks on the action's icon.
413
- * @return The `setPopup` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
345
+ *
346
+ * Can return its result via Promise.
414
347
  */
415
348
  export function setPopup(details: PopupDetails): Promise<void>;
416
-
417
- /**
418
- * @since Chrome 88
419
- * Sets the html document to be opened as a popup when the user clicks on the action's icon.
420
- */
421
349
  export function setPopup(details: PopupDetails, callback: () => void): void;
422
350
 
423
351
  /**
424
- * @since Chrome 88
425
352
  * Sets the title of the action. This shows up in the tooltip.
426
- * @return The `setTitle` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
353
+ *
354
+ * Can return its result via Promise.
427
355
  */
428
356
  export function setTitle(details: TitleDetails): Promise<void>;
429
-
430
- /**
431
- * @since Chrome 88
432
- * Sets the title of the action. This shows up in the tooltip.
433
- */
434
357
  export function setTitle(details: TitleDetails, callback: () => void): void;
435
358
 
436
359
  /** Fired when an action icon is clicked. This event will not fire if the action has a popup. */
437
- export const onClicked: chrome.events.Event<(tab: chrome.tabs.Tab) => void>;
360
+ export const onClicked: events.Event<(tab: chrome.tabs.Tab) => void>;
438
361
 
439
362
  /**
440
363
  * Fired when user-specified settings relating to an extension's action change.
441
364
  * @since Chrome 130
442
365
  */
443
- export const onUserSettingsChanged: chrome.events.Event<(change: UserSettingsChange) => void>;
366
+ export const onUserSettingsChanged: events.Event<(change: UserSettingsChange) => void>;
444
367
  }
445
368
 
446
369
  ////////////////////
@@ -4494,6 +4417,84 @@ declare namespace chrome {
4494
4417
  export var onRequestExternal: OnRequestEvent;
4495
4418
  }
4496
4419
 
4420
+ ////////////////////
4421
+ // Extension Types
4422
+ ////////////////////
4423
+ /** The `chrome.extensionTypes` API contains type declarations for Chrome extensions. */
4424
+ export namespace extensionTypes {
4425
+ /**
4426
+ * The origin of injected CSS.
4427
+ * @since Chrome 66
4428
+ */
4429
+ export type CSSOrigin = "author" | "user";
4430
+
4431
+ /**
4432
+ * The document lifecycle of the frame.
4433
+ * @since Chrome 106
4434
+ */
4435
+ export type DocumentLifecycle = "prerender" | "active" | "cached" | "pending_deletion";
4436
+
4437
+ /**
4438
+ * The type of frame.
4439
+ * @since Chrome 106
4440
+ */
4441
+ export type FrameType = "outermost_frame" | "fenced_frame" | "sub_frame";
4442
+
4443
+ /** Details about the format and quality of an image. */
4444
+ export interface ImageDetails {
4445
+ /** The format of the resulting image. Default is `"jpeg"`. */
4446
+ format?: ImageFormat | undefined;
4447
+ /** When format is `"jpeg"`, controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease. */
4448
+ quality?: number | undefined;
4449
+ }
4450
+
4451
+ /**
4452
+ * The format of an image.
4453
+ * @since Chrome 44
4454
+ */
4455
+ export type ImageFormat = "jpeg" | "png";
4456
+
4457
+ /** Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. */
4458
+ export interface InjectDetails {
4459
+ /** If allFrames is `true`, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's `false` and is only injected into the top frame. If `true` and `frameId` is set, then the code is inserted in the selected frame and all of its child frames. */
4460
+ allFrames?: boolean | undefined;
4461
+ /**
4462
+ * JavaScript or CSS code to inject.
4463
+ *
4464
+ * **Warning:** Be careful using the `code` parameter. Incorrect use of it may open your extension to cross site scripting attacks
4465
+ */
4466
+ code?: string | undefined;
4467
+ /**
4468
+ * The origin of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to `"author"`.
4469
+ * @since Chrome 66
4470
+ */
4471
+ cssOrigin?: CSSOrigin | undefined;
4472
+ /** JavaScript or CSS file to inject. */
4473
+ file?: string | undefined;
4474
+ /**
4475
+ * The frame where the script or CSS should be injected. Defaults to 0 (the top-level frame).
4476
+ * @since Chrome 50
4477
+ */
4478
+ frameId?: number | undefined;
4479
+ /** If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is `false`. */
4480
+ matchAboutBlank?: boolean;
4481
+ /** The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle". */
4482
+ runAt?: RunAt | undefined;
4483
+ }
4484
+
4485
+ /**
4486
+ * The soonest that the JavaScript or CSS will be injected into the tab.
4487
+ *
4488
+ * "document_start" : Script is injected after any files from css, but before any other DOM is constructed or any other script is run.
4489
+ *
4490
+ * "document_end" : Script is injected immediately after the DOM is complete, but before subresources like images and frames have loaded.
4491
+ *
4492
+ * "document_idle" : The browser chooses a time to inject the script between "document_end" and immediately after the `window.onload` event fires. The exact moment of injection depends on how complex the document is and how long it is taking to load, and is optimized for page load speed. Content scripts running at "document_idle" don't need to listen for the `window.onload` event; they are guaranteed to run after the DOM completes. If a script definitely needs to run after `window.onload`, the extension can check if `onload` has already fired by using the `document.readyState` property.
4493
+ * @since Chrome 44
4494
+ */
4495
+ export type RunAt = "document_start" | "document_end" | "document_idle";
4496
+ }
4497
+
4497
4498
  ////////////////////
4498
4499
  // File Browser Handler
4499
4500
  ////////////////////
@@ -7019,181 +7020,177 @@ declare namespace chrome {
7019
7020
  * Permissions: "notifications"
7020
7021
  */
7021
7022
  export namespace notifications {
7022
- export type TemplateType = "basic" | "image" | "list" | "progress";
7023
-
7024
- export interface ButtonOptions {
7023
+ export interface NotificationButton {
7024
+ /** @deprecated since Chrome 59. Button icons not visible for Mac OS X users. */
7025
+ iconUrl?: string;
7025
7026
  title: string;
7026
- iconUrl?: string | undefined;
7027
7027
  }
7028
7028
 
7029
- export interface ItemOptions {
7030
- /** Title of one item of a list notification. */
7031
- title: string;
7029
+ export interface NotificationItem {
7032
7030
  /** Additional details about this item. */
7033
7031
  message: string;
7032
+ /** Title of one item of a list notification. */
7033
+ title: string;
7034
7034
  }
7035
7035
 
7036
- export type NotificationOptions<T extends boolean = false> =
7037
- & {
7038
- /**
7039
- * Optional.
7040
- * Alternate notification content with a lower-weight font.
7041
- * @since Chrome 31
7042
- */
7043
- contextMessage?: string | undefined;
7044
- /** Optional. Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. */
7045
- priority?: number | undefined;
7046
- /** Optional. A timestamp associated with the notification, in milliseconds past the epoch (e.g. Date.now() + n). */
7047
- eventTime?: number | undefined;
7048
- /** Optional. Text and icons for up to two notification action buttons. */
7049
- buttons?: ButtonOptions[] | undefined;
7050
- /** Optional. Items for multi-item notifications. */
7051
- items?: ItemOptions[] | undefined;
7052
- /**
7053
- * Optional.
7054
- * Current progress ranges from 0 to 100.
7055
- * @since Chrome 30
7056
- */
7057
- progress?: number | undefined;
7058
- /**
7059
- * Optional.
7060
- * Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.
7061
- * @since Chrome 32
7062
- */
7063
- isClickable?: boolean | undefined;
7064
- /**
7065
- * Optional.
7066
- * A URL to the app icon mask. URLs have the same restrictions as iconUrl. The app icon mask should be in alpha channel, as only the alpha channel of the image will be considered.
7067
- * @since Chrome 38
7068
- */
7069
- appIconMaskUrl?: string | undefined;
7070
- /** Optional. A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as iconUrl. */
7071
- imageUrl?: string | undefined;
7072
- /**
7073
- * Indicates that the notification should remain visible on screen until the user activates or dismisses the notification.
7074
- * This defaults to false.
7075
- * @since Chrome 50
7076
- */
7077
- requireInteraction?: boolean | undefined;
7078
- /**
7079
- * Optional.
7080
- * Indicates that no sounds or vibrations should be made when the notification is being shown. This defaults to false.
7081
- * @since Chrome 70
7082
- */
7083
- silent?: boolean | undefined;
7084
- }
7085
- & (T extends true ? {
7086
- /**
7087
- * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
7088
- * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method.
7089
- */
7090
- iconUrl: string;
7091
- /** Main notification content. Required for notifications.create method. */
7092
- message: string;
7093
- /** Which type of notification to display. Required for notifications.create method. */
7094
- type: TemplateType;
7095
- /** Title of the notification (e.g. sender name for email). Required for notifications.create method. */
7096
- title: string;
7097
- }
7098
- : {
7099
- /**
7100
- * Optional.
7101
- * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
7102
- * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method.
7103
- */
7104
- iconUrl?: string | undefined;
7105
- /** Optional. Main notification content. Required for notifications.create method. */
7106
- message?: string | undefined;
7107
- /** Optional. Which type of notification to display. Required for notifications.create method. */
7108
- type?: TemplateType | undefined;
7109
- /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
7110
- title?: string | undefined;
7111
- });
7112
-
7113
- export interface NotificationClosedEvent
7114
- extends chrome.events.Event<(notificationId: string, byUser: boolean) => void>
7115
- {}
7116
-
7117
- export interface NotificationClickedEvent extends chrome.events.Event<(notificationId: string) => void> {}
7036
+ export interface NotificationOptions {
7037
+ /**
7038
+ * A URL to the app icon mask. URLs have the same restrictions as {@link notifications.NotificationOptions.iconUrl iconUrl}.
7039
+ *
7040
+ * The app icon mask should be in alpha channel, as only the alpha channel of the image will be considered.
7041
+ * @deprecated since Chrome 59. The app icon mask is not visible for Mac OS X users.
7042
+ */
7043
+ appIconMaskUrl?: string;
7044
+ /** Text and icons for up to two notification action buttons. */
7045
+ buttons?: NotificationButton[];
7046
+ /** Alternate notification content with a lower-weight font. */
7047
+ contextMessage?: string;
7048
+ /** A timestamp associated with the notification, in milliseconds past the epoch (e.g. `Date.now() + n`). */
7049
+ eventTime?: number;
7050
+ /**
7051
+ * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
7052
+ *
7053
+ * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file
7054
+ *
7055
+ * **Note:** This value is required for the {@link notifications.create}() method.
7056
+ */
7057
+ iconUrl?: string;
7058
+ /**
7059
+ * A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as {@link notifications.NotificationOptions.iconUrl iconUrl}.
7060
+ * @deprecated since Chrome 59. The image is not visible for Mac OS X users.
7061
+ */
7062
+ imageUrl?: string;
7063
+ /** @deprecated since Chrome 67. This UI hint is ignored as of Chrome 67 */
7064
+ isClickable?: boolean;
7065
+ /** Items for multi-item notifications. Users on Mac OS X only see the first item. */
7066
+ items?: NotificationItem[];
7067
+ /**
7068
+ * Main notification content.
7069
+ *
7070
+ * **Note:** This value is required for the {@link notifications.create}() method.
7071
+ */
7072
+ message?: string;
7073
+ /** Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. On platforms that don't support a notification center (Windows, Linux & Mac), -2 and -1 result in an error as notifications with those priorities will not be shown at all. */
7074
+ priority?: number;
7075
+ /** Current progress ranges from 0 to 100. */
7076
+ progress?: number;
7077
+ /**
7078
+ * Indicates that the notification should remain visible on screen until the user activates or dismisses the notification. This defaults to false.
7079
+ * @since Chrome 50
7080
+ */
7081
+ requireInteraction?: boolean;
7082
+ /**
7083
+ * Indicates that no sounds or vibrations should be made when the notification is being shown. This defaults to false.
7084
+ * @since Chrome 70
7085
+ */
7086
+ silent?: boolean;
7087
+ /**
7088
+ * Title of the notification (e.g. sender name for email).
7089
+ *
7090
+ * **Note:** This value is required for the {@link notifications.create}() method.
7091
+ */
7092
+ title?: string;
7093
+ /** Which type of notification to display.
7094
+ *
7095
+ * **Note:** This value is required for the {@link notifications.create}() method.
7096
+ */
7097
+ type?: `${TemplateType}`;
7098
+ }
7118
7099
 
7119
- export interface NotificationButtonClickedEvent
7120
- extends chrome.events.Event<(notificationId: string, buttonIndex: number) => void>
7121
- {}
7100
+ type NotificationCreateOptions = SetRequired<NotificationOptions, "type" | "title" | "message" | "iconUrl">;
7122
7101
 
7123
- export interface NotificationPermissionLevelChangedEvent extends chrome.events.Event<(level: string) => void> {}
7102
+ export enum PermissionLevel {
7103
+ /** Specifies that the user has elected to show notifications from the app or extension. This is the default at install time. */
7104
+ GRANTED = "granted",
7105
+ /** Specifies that the user has elected not to show notifications from the app or extension. */
7106
+ DENIED = "denied",
7107
+ }
7124
7108
 
7125
- export interface NotificationShowSettingsEvent extends chrome.events.Event<() => void> {}
7109
+ export enum TemplateType {
7110
+ /** Contains an icon, title, message, expandedMessage, and up to two buttons. */
7111
+ BASIC = "basic",
7112
+ /** Contains an icon, title, message, expandedMessage, image, and up to two buttons. */
7113
+ IMAGE = "image",
7114
+ /** Contains an icon, title, message, items, and up to two buttons. Users on Mac OS X only see the first item. */
7115
+ LIST = "list",
7116
+ /** Contains an icon, title, message, progress, and up to two buttons. */
7117
+ PROGRESS = "progress",
7118
+ }
7126
7119
 
7127
- /** The notification closed, either by the system or by user action. */
7128
- export var onClosed: NotificationClosedEvent;
7129
- /** The user clicked in a non-button area of the notification. */
7130
- export var onClicked: NotificationClickedEvent;
7131
- /** The user pressed a button in the notification. */
7132
- export var onButtonClicked: NotificationButtonClickedEvent;
7133
7120
  /**
7134
- * The user changes the permission level.
7135
- * @since Chrome 32
7136
- */
7137
- export var onPermissionLevelChanged: NotificationPermissionLevelChangedEvent;
7138
- /**
7139
- * The user clicked on a link for the app's notification settings.
7140
- * @since Chrome 32
7121
+ * Clears the specified notification.
7122
+ * @param notificationId The id of the notification to be cleared. This is returned by {@link notifications.create} method.
7123
+ *
7124
+ * Can return its result via Promise since Chrome 116
7141
7125
  */
7142
- export var onShowSettings: NotificationShowSettingsEvent;
7126
+ export function clear(notificationId: string): Promise<boolean>;
7127
+ export function clear(notificationId: string, callback: (wasCleared: boolean) => void): void;
7143
7128
 
7144
7129
  /**
7145
7130
  * Creates and displays a notification.
7146
- * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation.
7147
- * The notificationId parameter is required before Chrome 42.
7131
+ * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. The identifier may not be longer than 500 characters.
7132
+ *
7133
+ * The `notificationId` parameter is required before Chrome 42.
7148
7134
  * @param options Contents of the notification.
7149
- * @param callback Returns the notification id (either supplied or generated) that represents the created notification.
7150
- * The callback is required before Chrome 42.
7135
+ *
7136
+ * Can return its result via Promise since Chrome 116
7151
7137
  */
7138
+ export function create(notificationId: string, options: NotificationCreateOptions): Promise<string>;
7139
+ export function create(options: NotificationCreateOptions): Promise<string>;
7152
7140
  export function create(
7153
7141
  notificationId: string,
7154
- options: NotificationOptions<true>,
7155
- callback?: (notificationId: string) => void,
7142
+ options: NotificationCreateOptions,
7143
+ callback: (notificationId: string) => void,
7156
7144
  ): void;
7145
+ export function create(options: NotificationCreateOptions, callback: (notificationId: string) => void): void;
7146
+
7157
7147
  /**
7158
- * Creates and displays a notification.
7159
- * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation.
7160
- * The notificationId parameter is required before Chrome 42.
7161
- * @param options Contents of the notification.
7162
- * @param callback Returns the notification id (either supplied or generated) that represents the created notification.
7163
- * The callback is required before Chrome 42.
7148
+ * Retrieves all the notifications of this app or extension.
7149
+ *
7150
+ * Can return its result via Promise since Chrome 116
7151
+ */
7152
+ export function getAll(): Promise<{ [key: string]: true }>;
7153
+ export function getAll(callback: (notifications: { [key: string]: true }) => void): void;
7154
+
7155
+ /**
7156
+ * Retrieves whether the user has enabled notifications from this app or extension.
7157
+ *
7158
+ * Can return its result via Promise since Chrome 116
7164
7159
  */
7165
- export function create(options: NotificationOptions<true>, callback?: (notificationId: string) => void): void;
7160
+ export function getPermissionLevel(): Promise<`${PermissionLevel}`>;
7161
+ export function getPermissionLevel(callback: (level: `${PermissionLevel}`) => void): void;
7162
+
7166
7163
  /**
7167
7164
  * Updates an existing notification.
7168
- * @param notificationId The id of the notification to be updated. This is returned by notifications.create method.
7165
+ * @param notificationId The id of the notification to be updated. This is returned by {@link notifications.create} method.
7169
7166
  * @param options Contents of the notification to update to.
7170
- * @param callback Called to indicate whether a matching notification existed.
7171
- * The callback is required before Chrome 42.
7167
+ *
7168
+ * Can return its result via Promise since Chrome 116
7172
7169
  */
7170
+ export function update(notificationId: string, options: NotificationOptions): Promise<boolean>;
7173
7171
  export function update(
7174
7172
  notificationId: string,
7175
7173
  options: NotificationOptions,
7176
- callback?: (wasUpdated: boolean) => void,
7174
+ callback: (wasUpdated: boolean) => void,
7177
7175
  ): void;
7176
+
7177
+ /** The user pressed a button in the notification. */
7178
+ export const onButtonClicked: events.Event<(notificationId: string, buttonIndex: number) => void>;
7179
+
7180
+ /** The user clicked in a non-button area of the notification. */
7181
+ export const onClicked: events.Event<(notificationId: string) => void>;
7182
+
7183
+ /** The notification closed, either by the system or by user action. */
7184
+ export const onClosed: events.Event<(notificationId: string, byUser: boolean) => void>;
7185
+
7186
+ /** The user changes the permission level. As of Chrome 47, only ChromeOS has UI that dispatches this event. */
7187
+ export const onPermissionLevelChanged: events.Event<(level: `${PermissionLevel}`) => void>;
7188
+
7178
7189
  /**
7179
- * Clears the specified notification.
7180
- * @param notificationId The id of the notification to be cleared. This is returned by notifications.create method.
7181
- * @param callback Called to indicate whether a matching notification existed.
7182
- * The callback is required before Chrome 42.
7183
- */
7184
- export function clear(notificationId: string, callback?: (wasCleared: boolean) => void): void;
7185
- /**
7186
- * Retrieves all the notifications.
7187
- * @since Chrome 29
7188
- * @param callback Returns the set of notification_ids currently in the system.
7189
- */
7190
- export function getAll(callback: (notifications: { [key: string]: true }) => void): void;
7191
- /**
7192
- * Retrieves whether the user has enabled notifications from this app or extension.
7193
- * @since Chrome 32
7194
- * @param callback Returns the current permission level.
7190
+ * The user clicked on a link for the app's notification settings. As of Chrome 47, only ChromeOS has UI that dispatches this event. As of Chrome 65, that UI has been removed from ChromeOS, too.
7191
+ * @deprecated since Chrome 65. Custom notification settings button is no longer supported.
7195
7192
  */
7196
- export function getPermissionLevel(callback: (level: string) => void): void;
7193
+ export const onShowSettings: events.Event<() => void>;
7197
7194
  }
7198
7195
 
7199
7196
  ////////////////////
@@ -8707,9 +8704,6 @@ declare namespace chrome {
8707
8704
  export function addListener(callback: (info: OnReceiveErrorInfo) => void): void;
8708
8705
  }
8709
8706
 
8710
- type DocumentLifecycle = "prerender" | "active" | "cached" | "pending_deletion";
8711
- type FrameType = "outermost_frame" | "fenced_frame" | "sub_frame";
8712
-
8713
8707
  ////////////////////
8714
8708
  // Runtime
8715
8709
  ////////////////////
@@ -8865,7 +8859,7 @@ declare namespace chrome {
8865
8859
  * The lifecycle the document that opened the connection is in at the time the port was created. Note that the lifecycle state of the document may have changed since port creation.
8866
8860
  * @since Chrome 106
8867
8861
  */
8868
- documentLifecycle?: DocumentLifecycle | undefined;
8862
+ documentLifecycle?: extensionTypes.DocumentLifecycle | undefined;
8869
8863
  /**
8870
8864
  * A UUID of the document that opened the connection.
8871
8865
  * @since Chrome 106
@@ -9699,7 +9693,7 @@ declare namespace chrome {
9699
9693
  js?: string[];
9700
9694
  matches?: string[];
9701
9695
  persistAcrossSessions?: boolean;
9702
- runAt?: "document_start" | "document_end" | "document_idle";
9696
+ runAt?: extensionTypes.RunAt;
9703
9697
  world?: ExecutionWorld;
9704
9698
  }
9705
9699
 
@@ -11144,45 +11138,6 @@ declare namespace chrome {
11144
11138
  defaultZoomFactor?: number | undefined;
11145
11139
  }
11146
11140
 
11147
- export interface InjectDetails {
11148
- /**
11149
- * Optional.
11150
- * If allFrames is true, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's false and is only injected into the top frame.
11151
- */
11152
- allFrames?: boolean | undefined;
11153
- /**
11154
- * Optional. JavaScript or CSS code to inject.
11155
- * Warning: Be careful using the code parameter. Incorrect use of it may open your extension to cross site scripting attacks.
11156
- */
11157
- code?: string | undefined;
11158
- /**
11159
- * Optional. The soonest that the JavaScript or CSS will be injected into the tab.
11160
- * One of: "document_start", "document_end", or "document_idle"
11161
- * @since Chrome 20
11162
- */
11163
- runAt?: string | undefined;
11164
- /** Optional. JavaScript or CSS file to inject. */
11165
- file?: string | undefined;
11166
- /**
11167
- * Optional.
11168
- * The frame where the script or CSS should be injected. Defaults to 0 (the top-level frame).
11169
- * @since Chrome 39
11170
- */
11171
- frameId?: number | undefined;
11172
- /**
11173
- * Optional.
11174
- * If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is false.
11175
- * @since Chrome 39
11176
- */
11177
- matchAboutBlank?: boolean | undefined;
11178
- /**
11179
- * Optional. The origin of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to "author".
11180
- * One of: "author", or "user"
11181
- * @since Chrome 66
11182
- */
11183
- cssOrigin?: string | undefined;
11184
- }
11185
-
11186
11141
  export interface CreateProperties {
11187
11142
  /** Optional. The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window. */
11188
11143
  index?: number | undefined;
@@ -11264,19 +11219,6 @@ declare namespace chrome {
11264
11219
  autoDiscardable?: boolean | undefined;
11265
11220
  }
11266
11221
 
11267
- export interface CaptureVisibleTabOptions {
11268
- /**
11269
- * Optional.
11270
- * When format is "jpeg", controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease.
11271
- */
11272
- quality?: number | undefined;
11273
- /**
11274
- * Optional. The format of an image.
11275
- * One of: "jpeg", or "png"
11276
- */
11277
- format?: string | undefined;
11278
- }
11279
-
11280
11222
  export interface ReloadProperties {
11281
11223
  /** Optional. Whether using any local cache. Default is false. */
11282
11224
  bypassCache?: boolean | undefined;
@@ -11539,21 +11481,21 @@ declare namespace chrome {
11539
11481
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11540
11482
  * @return The `executeScript` method provides its result via callback or returned as a `Promise` (MV3 only). The result of the script in every injected frame.
11541
11483
  */
11542
- export function executeScript(details: InjectDetails): Promise<any[]>;
11484
+ export function executeScript(details: extensionTypes.InjectDetails): Promise<any[]>;
11543
11485
  /**
11544
11486
  * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
11545
11487
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11546
11488
  * @param callback Optional. Called after all the JavaScript has been executed.
11547
11489
  * Parameter result: The result of the script in every injected frame.
11548
11490
  */
11549
- export function executeScript(details: InjectDetails, callback?: (result: any[]) => void): void;
11491
+ export function executeScript(details: extensionTypes.InjectDetails, callback?: (result: any[]) => void): void;
11550
11492
  /**
11551
11493
  * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
11552
11494
  * @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window.
11553
11495
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11554
11496
  * @return The `executeScript` method provides its result via callback or returned as a `Promise` (MV3 only). The result of the script in every injected frame.
11555
11497
  */
11556
- export function executeScript(tabId: number, details: InjectDetails): Promise<any[]>;
11498
+ export function executeScript(tabId: number, details: extensionTypes.InjectDetails): Promise<any[]>;
11557
11499
  /**
11558
11500
  * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
11559
11501
  * @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window.
@@ -11561,7 +11503,11 @@ declare namespace chrome {
11561
11503
  * @param callback Optional. Called after all the JavaScript has been executed.
11562
11504
  * Parameter result: The result of the script in every injected frame.
11563
11505
  */
11564
- export function executeScript(tabId: number, details: InjectDetails, callback?: (result: any[]) => void): void;
11506
+ export function executeScript(
11507
+ tabId: number,
11508
+ details: extensionTypes.InjectDetails,
11509
+ callback?: (result: any[]) => void,
11510
+ ): void;
11565
11511
  /** Retrieves details about the specified tab. */
11566
11512
  export function get(tabId: number, callback: (tab: Tab) => void): void;
11567
11513
  /**
@@ -11736,14 +11682,17 @@ declare namespace chrome {
11736
11682
  * @param options Optional. Details about the format and quality of an image.
11737
11683
  * @return The `captureVisibleTab` method provides its result via callback or returned as a `Promise` (MV3 only). A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
11738
11684
  */
11739
- export function captureVisibleTab(options: CaptureVisibleTabOptions): Promise<string>;
11685
+ export function captureVisibleTab(options: extensionTypes.ImageDetails): Promise<string>;
11740
11686
  /**
11741
11687
  * Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
11742
11688
  * @param options Optional. Details about the format and quality of an image.
11743
11689
  * @param callback
11744
11690
  * Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
11745
11691
  */
11746
- export function captureVisibleTab(options: CaptureVisibleTabOptions, callback: (dataUrl: string) => void): void;
11692
+ export function captureVisibleTab(
11693
+ options: extensionTypes.ImageDetails,
11694
+ callback: (dataUrl: string) => void,
11695
+ ): void;
11747
11696
  /**
11748
11697
  * Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
11749
11698
  * @param windowId Optional. The target window. Defaults to the current window.
@@ -11752,7 +11701,7 @@ declare namespace chrome {
11752
11701
  */
11753
11702
  export function captureVisibleTab(
11754
11703
  windowId: number,
11755
- options: CaptureVisibleTabOptions,
11704
+ options: extensionTypes.ImageDetails,
11756
11705
  ): Promise<string>;
11757
11706
  /**
11758
11707
  * Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
@@ -11763,7 +11712,7 @@ declare namespace chrome {
11763
11712
  */
11764
11713
  export function captureVisibleTab(
11765
11714
  windowId: number,
11766
- options: CaptureVisibleTabOptions,
11715
+ options: extensionTypes.ImageDetails,
11767
11716
  callback: (dataUrl: string) => void,
11768
11717
  ): void;
11769
11718
  /**
@@ -11880,27 +11829,27 @@ declare namespace chrome {
11880
11829
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11881
11830
  * @return The `insertCSS` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
11882
11831
  */
11883
- export function insertCSS(details: InjectDetails): Promise<void>;
11832
+ export function insertCSS(details: extensionTypes.InjectDetails): Promise<void>;
11884
11833
  /**
11885
11834
  * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
11886
11835
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11887
11836
  * @param callback Optional. Called when all the CSS has been inserted.
11888
11837
  */
11889
- export function insertCSS(details: InjectDetails, callback: () => void): void;
11838
+ export function insertCSS(details: extensionTypes.InjectDetails, callback: () => void): void;
11890
11839
  /**
11891
11840
  * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
11892
11841
  * @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
11893
11842
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11894
11843
  * @return The `insertCSS` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
11895
11844
  */
11896
- export function insertCSS(tabId: number, details: InjectDetails): Promise<void>;
11845
+ export function insertCSS(tabId: number, details: extensionTypes.InjectDetails): Promise<void>;
11897
11846
  /**
11898
11847
  * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
11899
11848
  * @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
11900
11849
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11901
11850
  * @param callback Optional. Called when all the CSS has been inserted.
11902
11851
  */
11903
- export function insertCSS(tabId: number, details: InjectDetails, callback: () => void): void;
11852
+ export function insertCSS(tabId: number, details: extensionTypes.InjectDetails, callback: () => void): void;
11904
11853
  /**
11905
11854
  * Highlights the given tabs.
11906
11855
  * @since Chrome 16
@@ -12959,11 +12908,11 @@ declare namespace chrome {
12959
12908
  /** A UUID of the document loaded. */
12960
12909
  documentId: string;
12961
12910
  /** The lifecycle the document is in. */
12962
- documentLifecycle: DocumentLifecycle;
12911
+ documentLifecycle: extensionTypes.DocumentLifecycle;
12963
12912
  /** True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. */
12964
12913
  errorOccurred: boolean;
12965
12914
  /** The type of frame the navigation occurred in. */
12966
- frameType: FrameType;
12915
+ frameType: extensionTypes.FrameType;
12967
12916
  /** A UUID of the parent document owning this frame. This is not set if there is no parent. */
12968
12917
  parentDocumentId?: string | undefined;
12969
12918
  /** ID of frame that wraps the frame. Set to -1 of no parent frame exists. */
@@ -13002,11 +12951,11 @@ declare namespace chrome {
13002
12951
  /** 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process. */
13003
12952
  frameId: number;
13004
12953
  /** The type of frame the navigation occurred in. */
13005
- frameType: FrameType;
12954
+ frameType: extensionTypes.FrameType;
13006
12955
  /** A UUID of the document loaded. (This is not set for onBeforeNavigate callbacks.) */
13007
12956
  documentId?: string | undefined;
13008
12957
  /** The lifecycle the document is in. */
13009
- documentLifecycle: DocumentLifecycle;
12958
+ documentLifecycle: extensionTypes.DocumentLifecycle;
13010
12959
  /** A UUID of the parent document owning this frame. This is not set if there is no parent. */
13011
12960
  parentDocumentId?: string | undefined;
13012
12961
  /**
@@ -13289,8 +13238,8 @@ declare namespace chrome {
13289
13238
  /** Optional. The HTTP request headers that are going to be sent out with this request. */
13290
13239
  requestHeaders?: HttpHeader[] | undefined;
13291
13240
  documentId: string;
13292
- documentLifecycle: DocumentLifecycle;
13293
- frameType: FrameType;
13241
+ documentLifecycle: extensionTypes.DocumentLifecycle;
13242
+ frameType: extensionTypes.FrameType;
13294
13243
  frameId: number;
13295
13244
  initiator?: string | undefined;
13296
13245
  parentDocumentId?: string | undefined;
@@ -14908,7 +14857,7 @@ declare namespace chrome {
14908
14857
  /** Specifies which pages this user script will be injected into. See Match Patterns for more details on the syntax of these strings. This property must be specified for ${ref:register}. */
14909
14858
  matches?: string[];
14910
14859
  /** Specifies when JavaScript files are injected into the web page. The preferred and default value is document_idle */
14911
- runAt?: RunAt;
14860
+ runAt?: extensionTypes.RunAt;
14912
14861
  /** The JavaScript execution environment to run the script in. The default is `USER_SCRIPT` */
14913
14862
  world?: ExecutionWorld;
14914
14863
  /**
@@ -14942,11 +14891,6 @@ declare namespace chrome {
14942
14891
  file?: string;
14943
14892
  }
14944
14893
 
14945
- /**
14946
- * Enum for the run-at property.
14947
- */
14948
- export type RunAt = "document_start" | "document_end" | "document_idle";
14949
-
14950
14894
  /**
14951
14895
  * Configures the `USER_SCRIPT` execution environment.
14952
14896
  *
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.322",
3
+ "version": "0.0.324",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -94,6 +94,6 @@
94
94
  "@types/har-format": "*"
95
95
  },
96
96
  "peerDependencies": {},
97
- "typesPublisherContentHash": "d2211cafb9d168b91482e87001e7cbfcd764551a4d73eac6e6f957699d0b7015",
97
+ "typesPublisherContentHash": "3608251c1dcc614ccdb865ee939d2bd75468aba9bd27570e630bf6de852dce15",
98
98
  "typeScriptVersion": "5.1"
99
99
  }