Skip to content

Commit 9054266

Browse files
authored
🤖 Merge PR DefinitelyTyped#73965 [chrome] update since Chrome 141-142 by @erwanjugand
1 parent 69142f7 commit 9054266

File tree

2 files changed

+70
-3
lines changed

2 files changed

+70
-3
lines changed

types/chrome/index.d.ts

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,12 @@ declare namespace chrome {
16561656
INCOGNITO_SESSION_ONLY = "incognito_session_only",
16571657
}
16581658

1659+
/** @since Chrome 141 */
1660+
export enum SoundContentSetting {
1661+
ALLOW = "allow",
1662+
BLOCK = "block",
1663+
}
1664+
16591665
/**
16601666
* Whether to allow sites to download multiple files automatically. One of
16611667
*
@@ -6996,16 +7002,26 @@ declare namespace chrome {
69967002
*/
69977003
export namespace loginState {
69987004
export enum ProfileType {
7005+
/** Specifies that the extension is in the signin profile. */
69997006
SIGNIN_PROFILE = "SIGNIN_PROFILE",
7007+
/** Specifies that the extension is in the user profile. */
70007008
USER_PROFILE = "USER_PROFILE",
7009+
/** Specifies that the extension is in the lock screen profile. */
7010+
LOCK_PROFILE = "LOCK_PROFILE",
70017011
}
70027012

70037013
export enum SessionState {
7014+
/** Specifies that the session state is unknown. */
70047015
UNKNOWN = "UNKNOWN",
7016+
/** Specifies that the user is in the out-of-box-experience screen. */
70057017
IN_OOBE_SCREEN = "IN_OOBE_SCREEN",
7018+
/** Specifies that the user is in the login screen. */
70067019
IN_LOGIN_SCREEN = "IN_LOGIN_SCREEN",
7020+
/** Specifies that the user is in the session. */
70077021
IN_SESSION = "IN_SESSION",
7022+
/** Specifies that the user is in the lock screen. */
70087023
IN_LOCK_SCREEN = "IN_LOCK_SCREEN",
7024+
/** Specifies that the device is in RMA mode, finalizing repairs. */
70097025
IN_RMA_SCREEN = "IN_RMA_SCREEN",
70107026
}
70117027

@@ -13780,7 +13796,7 @@ declare namespace chrome {
1378013796
* @since Chrome 86
1378113797
*/
1378213798
export enum HeaderOperation {
13783-
/** Adds a new entry for the specified header. This operation is not supported for request headers. */
13799+
/** Adds a new entry for the specified header. When modifying the headers of a request, this operation is only supported for specific headers. */
1378413800
APPEND = "append",
1378513801
/** Sets a new value for the specified header, removing any existing headers with the same name. */
1378613802
SET = "set",
@@ -14410,6 +14426,21 @@ declare namespace chrome {
1441014426
* @since Chrome 114, MV3
1441114427
*/
1441214428
export namespace sidePanel {
14429+
/** @since Chrome 141 */
14430+
export type CloseOptions =
14431+
| {
14432+
/** The tab in which to close the side panel. If a tab-specific side panel is open in the specified tab, it will be closed for that tab. At least one of this or `windowId` must be provided. */
14433+
tabId: number;
14434+
/** The window in which to close the side panel. If a global side panel is open in the specified window, it will be closed for all tabs in that window where no tab-specific panel is active. At least one of this or `tabId` must be provided. */
14435+
windowId?: number | undefined;
14436+
}
14437+
| {
14438+
/** The tab in which to close the side panel. If a tab-specific side panel is open in the specified tab, it will be closed for that tab. At least one of this or `windowId` must be provided. */
14439+
tabId?: number | undefined;
14440+
/** The window in which to close the side panel. If a global side panel is open in the specified window, it will be closed for all tabs in that window where no tab-specific panel is active. At least one of this or `tabId` must be provided. */
14441+
windowId: number;
14442+
};
14443+
1441314444
export interface GetPanelOptions {
1441414445
/**
1441514446
* If specified, the side panel options for the given tab will be returned.
@@ -14447,11 +14478,31 @@ declare namespace chrome {
1444714478
openPanelOnActionClick?: boolean | undefined;
1444814479
}
1444914480

14481+
/** @since Chrome 142 */
14482+
export interface PanelClosedInfo {
14483+
/** The path of the local resource within the extension package whose content is displayed in the panel. */
14484+
path: string;
14485+
/** The optional ID of the tab where the side panel was closed. This is provided only when the panel is tab-specific. */
14486+
tabId?: number;
14487+
/** The ID of the window where the side panel was closed. This is available for both global and tab-specific panels. */
14488+
windowId: number;
14489+
}
14490+
1445014491
/** @since Chrome 140 */
1445114492
export interface PanelLayout {
1445214493
side: `${Side}`;
1445314494
}
1445414495

14496+
/** @since Chrome 141 */
14497+
export interface PanelOpenedInfo {
14498+
/** The path of the local resource within the extension package whose content is displayed in the panel. */
14499+
path: string;
14500+
/** The optional ID of the tab where the side panel is opened. This is provided only when the panel is tab-specific. */
14501+
tabId?: number;
14502+
/** The ID of the window where the side panel is opened. This is available for both global and tab-specific panels. */
14503+
windowId: number;
14504+
}
14505+
1445514506
export interface PanelOptions {
1445614507
/** Whether the side panel should be enabled. This is optional. The default value is true. */
1445714508
enabled?: boolean | undefined;
@@ -14530,6 +14581,12 @@ declare namespace chrome {
1453014581
*/
1453114582
export function setPanelBehavior(behavior: PanelBehavior): Promise<void>;
1453214583
export function setPanelBehavior(behavior: PanelBehavior, callback: () => void): void;
14584+
14585+
/**
14586+
* Fired when the extension's side panel is opened.
14587+
* @since Chrome 141
14588+
*/
14589+
const onOpened: events.Event<(info: PanelOpenedInfo) => void>;
1453314590
}
1453414591

1453514592
////////////////////

types/chrome/test/index.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,9 @@ function testContentSettings() {
527527
chrome.contentSettings.Scope.INCOGNITO_SESSION_ONLY === "incognito_session_only";
528528
chrome.contentSettings.Scope.REGULAR === "regular";
529529

530+
chrome.contentSettings.SoundContentSetting.ALLOW === "allow";
531+
chrome.contentSettings.SoundContentSetting.BLOCK === "block";
532+
530533
const contentSettingsGetParams: chrome.contentSettings.ContentSettingGetParams = {
531534
primaryUrl: "https://example.com",
532535
secondaryUrl: "https://example2.com",
@@ -6256,6 +6259,12 @@ function testSidePanel() {
62566259
chrome.sidePanel.setPanelBehavior(setPanelBehavior, () => void 0); // $ExpectType void
62576260
// @ts-expect-error
62586261
chrome.sidePanel.setPanelBehavior(setPanelBehavior, () => {}).then(() => {});
6262+
6263+
checkChromeEvent(chrome.sidePanel.onOpened, (info) => {
6264+
info.path; // $ExpectType string
6265+
info.tabId; // $ExpectType number | undefined
6266+
info.windowId; // $ExpectType number
6267+
});
62596268
}
62606269

62616270
// https://developer.chrome.com/docs/extensions/reference/api/instanceID
@@ -6308,6 +6317,7 @@ function testInstanceID() {
63086317
function testLoginState() {
63096318
chrome.loginState.ProfileType.SIGNIN_PROFILE === "SIGNIN_PROFILE";
63106319
chrome.loginState.ProfileType.USER_PROFILE === "USER_PROFILE";
6320+
chrome.loginState.ProfileType.LOCK_PROFILE === "LOCK_PROFILE";
63116321

63126322
chrome.loginState.SessionState.IN_LOCK_SCREEN === "IN_LOCK_SCREEN";
63136323
chrome.loginState.SessionState.IN_LOGIN_SCREEN === "IN_LOGIN_SCREEN";
@@ -6316,9 +6326,9 @@ function testLoginState() {
63166326
chrome.loginState.SessionState.IN_SESSION === "IN_SESSION";
63176327
chrome.loginState.SessionState.UNKNOWN === "UNKNOWN";
63186328

6319-
chrome.loginState.getProfileType(); // $ExpectType Promise<"SIGNIN_PROFILE" | "USER_PROFILE">
6329+
chrome.loginState.getProfileType(); // $ExpectType Promise<"SIGNIN_PROFILE" | "USER_PROFILE" | "LOCK_PROFILE">
63206330
chrome.loginState.getProfileType((result) => { // $ExpectType void
6321-
result; // $ExpectType "SIGNIN_PROFILE" | "USER_PROFILE"
6331+
result; // $ExpectType "SIGNIN_PROFILE" | "USER_PROFILE" | "LOCK_PROFILE"
63226332
});
63236333
// @ts-expect-error
63246334
chrome.loginState.getProfileType(() => {}).then(() => {});

0 commit comments

Comments
 (0)