@types/chrome 0.1.3 → 0.1.4

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 +108 -85
  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: Fri, 08 Aug 2025 16:02:23 GMT
11
+ * Last updated: Thu, 14 Aug 2025 07:35:10 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
@@ -2086,7 +2086,12 @@ declare namespace chrome {
2086
2086
  */
2087
2087
  export namespace cookies {
2088
2088
  /** A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set with 'SameSite=None', 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'. 'unspecified' corresponds to a cookie set without the SameSite attribute. **/
2089
- export type SameSiteStatus = "unspecified" | "no_restriction" | "lax" | "strict";
2089
+ export enum SameSiteStatus {
2090
+ NO_RESTRICTION = "no_restriction",
2091
+ LAX = "lax",
2092
+ STRICT = "strict",
2093
+ UNSPECIFIED = "unspecified",
2094
+ }
2090
2095
 
2091
2096
  /** Represents information about an HTTP cookie. */
2092
2097
  export interface Cookie {
@@ -2107,8 +2112,8 @@ declare namespace chrome {
2107
2112
  session: boolean;
2108
2113
  /** True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie). */
2109
2114
  hostOnly: boolean;
2110
- /** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. */
2111
- expirationDate?: number | undefined;
2115
+ /** The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. */
2116
+ expirationDate?: number;
2112
2117
  /** The path of the cookie. */
2113
2118
  path: string;
2114
2119
  /** True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts). */
@@ -2119,10 +2124,13 @@ declare namespace chrome {
2119
2124
  * The cookie's same-site status (i.e. whether the cookie is sent with cross-site requests).
2120
2125
  * @since Chrome 51
2121
2126
  */
2122
- sameSite: SameSiteStatus;
2127
+ sameSite: `${SameSiteStatus}`;
2123
2128
  }
2124
2129
 
2125
- /** Represents a partitioned cookie's partition key. */
2130
+ /**
2131
+ * Represents a partitioned cookie's partition key.
2132
+ * @since Chrome 119
2133
+ */
2126
2134
  export interface CookiePartitionKey {
2127
2135
  /**
2128
2136
  * Indicates if the cookie was set in a cross-cross site context. This prevents a top-level site embedded in a cross-site context from accessing cookies set by the top-level site in a same-site context.
@@ -2142,31 +2150,31 @@ declare namespace chrome {
2142
2150
  }
2143
2151
 
2144
2152
  export interface GetAllDetails {
2145
- /** Optional. Restricts the retrieved cookies to those whose domains match or are subdomains of this one. */
2153
+ /** Restricts the retrieved cookies to those whose domains match or are subdomains of this one. */
2146
2154
  domain?: string | undefined;
2147
- /** Optional. Filters the cookies by name. */
2155
+ /** Filters the cookies by name. */
2148
2156
  name?: string | undefined;
2149
2157
  /**
2150
2158
  * The partition key for reading or modifying cookies with the Partitioned attribute.
2151
2159
  * @since Chrome 119
2152
2160
  */
2153
2161
  partitionKey?: CookiePartitionKey | undefined;
2154
- /** Optional. Restricts the retrieved cookies to those that would match the given URL. */
2162
+ /** Restricts the retrieved cookies to those that would match the given URL. */
2155
2163
  url?: string | undefined;
2156
- /** Optional. The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used. */
2164
+ /** The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used. */
2157
2165
  storeId?: string | undefined;
2158
- /** Optional. Filters out session vs. persistent cookies. */
2166
+ /** Filters out session vs. persistent cookies. */
2159
2167
  session?: boolean | undefined;
2160
- /** Optional. Restricts the retrieved cookies to those whose path exactly matches this string. */
2168
+ /** Restricts the retrieved cookies to those whose path exactly matches this string. */
2161
2169
  path?: string | undefined;
2162
- /** Optional. Filters the cookies by their Secure property. */
2170
+ /** Filters the cookies by their Secure property. */
2163
2171
  secure?: boolean | undefined;
2164
2172
  }
2165
2173
 
2166
2174
  export interface SetDetails {
2167
- /** Optional. The domain of the cookie. If omitted, the cookie becomes a host-only cookie. */
2175
+ /** The domain of the cookie. If omitted, the cookie becomes a host-only cookie. */
2168
2176
  domain?: string | undefined;
2169
- /** Optional. The name of the cookie. Empty by default if omitted. */
2177
+ /** The name of the cookie. Empty by default if omitted. */
2170
2178
  name?: string | undefined;
2171
2179
  /**
2172
2180
  * The partition key for reading or modifying cookies with the Partitioned attribute.
@@ -2175,26 +2183,29 @@ declare namespace chrome {
2175
2183
  partitionKey?: CookiePartitionKey | undefined;
2176
2184
  /** The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail. */
2177
2185
  url: string;
2178
- /** Optional. The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store. */
2186
+ /** The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store. */
2179
2187
  storeId?: string | undefined;
2180
- /** Optional. The value of the cookie. Empty by default if omitted. */
2188
+ /** The value of the cookie. Empty by default if omitted. */
2181
2189
  value?: string | undefined;
2182
- /** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie. */
2190
+ /** The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie. */
2183
2191
  expirationDate?: number | undefined;
2184
- /** Optional. The path of the cookie. Defaults to the path portion of the url parameter. */
2192
+ /** The path of the cookie. Defaults to the path portion of the url parameter. */
2185
2193
  path?: string | undefined;
2186
- /** Optional. Whether the cookie should be marked as HttpOnly. Defaults to false. */
2194
+ /** Whether the cookie should be marked as HttpOnly. Defaults to false. */
2187
2195
  httpOnly?: boolean | undefined;
2188
- /** Optional. Whether the cookie should be marked as Secure. Defaults to false. */
2196
+ /** Whether the cookie should be marked as Secure. Defaults to false. */
2189
2197
  secure?: boolean | undefined;
2190
2198
  /**
2191
- * Optional. The cookie's same-site status. Defaults to "unspecified", i.e., if omitted, the cookie is set without specifying a SameSite attribute.
2199
+ * The cookie's same-site status. Defaults to "unspecified", i.e., if omitted, the cookie is set without specifying a SameSite attribute.
2192
2200
  * @since Chrome 51
2193
2201
  */
2194
- sameSite?: SameSiteStatus | undefined;
2202
+ sameSite?: `${SameSiteStatus}` | undefined;
2195
2203
  }
2196
2204
 
2197
- /** Details to identify the cookie. */
2205
+ /**
2206
+ * Details to identify the cookie.
2207
+ * @since Chrome 88
2208
+ */
2198
2209
  export interface CookieDetails {
2199
2210
  /** The name of the cookie to access. */
2200
2211
  name: string;
@@ -2214,11 +2225,8 @@ declare namespace chrome {
2214
2225
  cookie: Cookie;
2215
2226
  /** True if a cookie was removed. */
2216
2227
  removed: boolean;
2217
- /**
2218
- * @since Chrome 12
2219
- * The underlying reason behind the cookie's change.
2220
- */
2221
- cause: string;
2228
+ /** The underlying reason behind the cookie's change. */
2229
+ cause: `${OnChangedCause}`;
2222
2230
  }
2223
2231
 
2224
2232
  /**
@@ -2227,30 +2235,37 @@ declare namespace chrome {
2227
2235
  */
2228
2236
  export interface FrameDetails {
2229
2237
  /** The unique identifier for the document. If the frameId and/or tabId are provided they will be validated to match the document found by provided document ID. */
2230
- documentId?: string;
2238
+ documentId?: string | undefined;
2231
2239
  /** The unique identifier for the frame within the tab. */
2232
- frameId?: number;
2240
+ frameId?: number | undefined;
2233
2241
  /* The unique identifier for the tab containing the frame. */
2234
- tabId?: number;
2242
+ tabId?: number | undefined;
2235
2243
  }
2236
2244
 
2237
- export interface CookieChangedEvent extends chrome.events.Event<(changeInfo: CookieChangeInfo) => void> {}
2238
-
2239
2245
  /**
2240
- * Lists all existing cookie stores.
2241
- * Parameter cookieStores: All the existing cookie stores.
2246
+ * The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to "chrome.cookies.remove", "cause" will be "explicit". If a cookie was automatically removed due to expiry, "cause" will be "expired". If a cookie was removed due to being overwritten with an already-expired expiration date, "cause" will be set to "expired_overwrite". If a cookie was automatically removed due to garbage collection, "cause" will be "evicted". If a cookie was automatically removed due to a "set" call that overwrote it, "cause" will be "overwrite". Plan your response accordingly.
2247
+ * @since Chrome 44
2242
2248
  */
2243
- export function getAllCookieStores(callback: (cookieStores: CookieStore[]) => void): void;
2249
+ export enum OnChangedCause {
2250
+ EVICTED = "evicted",
2251
+ EXPIRED = "expired",
2252
+ EXPLICIT = "explicit",
2253
+ EXPIRED_OVERWRITE = "expired_overwrite",
2254
+ OVERWRITE = "overwrite",
2255
+ }
2244
2256
 
2245
2257
  /**
2246
2258
  * Lists all existing cookie stores.
2247
- * @return The `getAllCookieStores` method provides its result via callback or returned as a `Promise` (MV3 only).
2259
+ *
2260
+ * Can return its result via Promise in Manifest V3 or later.
2248
2261
  */
2249
2262
  export function getAllCookieStores(): Promise<CookieStore[]>;
2263
+ export function getAllCookieStores(callback: (cookieStores: CookieStore[]) => void): void;
2250
2264
 
2251
2265
  /**
2252
2266
  * The partition key for the frame indicated.
2253
- * Can return its result via Promise in Manifest V3
2267
+ *
2268
+ * Can return its result via Promise in Manifest V3 or later.
2254
2269
  * @since Chrome 132
2255
2270
  */
2256
2271
  export function getPartitionKey(details: FrameDetails): Promise<{ partitionKey: CookiePartitionKey }>;
@@ -2260,62 +2275,41 @@ declare namespace chrome {
2260
2275
  ): void;
2261
2276
 
2262
2277
  /**
2263
- * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first.
2264
- * @param details Information to filter the cookies being retrieved.
2265
- * Parameter cookies: All the existing, unexpired cookies that match the given cookie info.
2266
- */
2267
- export function getAll(details: GetAllDetails, callback: (cookies: Cookie[]) => void): void;
2268
-
2269
- /**
2270
- * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first.
2271
- * @param details Information to filter the cookies being retrieved.
2272
- * @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
2278
+ * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first. This method only retrieves cookies for domains that the extension has host permissions to
2279
+ * @param details Information to identify the cookie to remove.
2280
+ *
2281
+ * Can return its result via Promise in Manifest V3 or later.
2273
2282
  */
2274
2283
  export function getAll(details: GetAllDetails): Promise<Cookie[]>;
2284
+ export function getAll(details: GetAllDetails, callback: (cookies: Cookie[]) => void): void;
2275
2285
 
2276
2286
  /**
2277
2287
  * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
2278
2288
  * @param details Details about the cookie being set.
2279
- * @return The `set` method provides its result via callback or returned as a `Promise` (MV3 only).
2289
+ *
2290
+ * Can return its result via Promise in Manifest V3 or later.
2280
2291
  */
2281
2292
  export function set(details: SetDetails): Promise<Cookie | null>;
2282
-
2283
- /**
2284
- * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
2285
- * @param details Details about the cookie being set.
2286
- * Optional parameter cookie: Contains details about the cookie that's been set. If setting failed for any reason, this will be "null", and "chrome.runtime.lastError" will be set.
2287
- */
2288
2293
  export function set(details: SetDetails, callback: (cookie: Cookie | null) => void): void;
2289
2294
 
2290
2295
  /**
2291
2296
  * Deletes a cookie by name.
2292
- * @param details Information to identify the cookie to remove.
2293
- * @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only).
2297
+ *
2298
+ * Can return its result via Promise in Manifest V3 or later.
2294
2299
  */
2295
2300
  export function remove(details: CookieDetails): Promise<CookieDetails>;
2296
-
2297
- /**
2298
- * Deletes a cookie by name.
2299
- * @param details Information to identify the cookie to remove.
2300
- */
2301
2301
  export function remove(details: CookieDetails, callback?: (details: CookieDetails) => void): void;
2302
2302
 
2303
2303
  /**
2304
2304
  * Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned.
2305
- * @param details Details to identify the cookie being retrieved.
2306
- * Parameter cookie: Contains details about the cookie. This parameter is null if no such cookie was found.
2307
- */
2308
- export function get(details: CookieDetails, callback: (cookie: Cookie | null) => void): void;
2309
-
2310
- /**
2311
- * Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned.
2312
- * @param details Details to identify the cookie being retrieved.
2313
- * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
2305
+ *
2306
+ * Can return its result via Promise in Manifest V3 or later.
2314
2307
  */
2315
2308
  export function get(details: CookieDetails): Promise<Cookie | null>;
2309
+ export function get(details: CookieDetails, callback: (cookie: Cookie | null) => void): void;
2316
2310
 
2317
2311
  /** Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of "overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with "cause" "explicit". */
2318
- export var onChanged: CookieChangedEvent;
2312
+ export const onChanged: events.Event<(changeInfo: CookieChangeInfo) => void>;
2319
2313
  }
2320
2314
 
2321
2315
  ////////////////////
@@ -2623,31 +2617,39 @@ declare namespace chrome {
2623
2617
  * Permissions: "desktopCapture"
2624
2618
  */
2625
2619
  export namespace desktopCapture {
2626
- /** Contains properties that describe the stream. */
2620
+ /** Enum used to define set of desktop media sources used in {@link chooseDesktopMedia}. */
2621
+ export enum DesktopCaptureSourceType {
2622
+ SCREEN = "screen",
2623
+ WINDOW = "window",
2624
+ TAB = "tab",
2625
+ AUDIO = "audio",
2626
+ }
2627
+
2628
+ /**
2629
+ * Contains properties that describe the stream.
2630
+ * @since Chrome 57
2631
+ */
2627
2632
  export interface StreamOptions {
2628
2633
  /** True if "audio" is included in parameter sources, and the end user does not uncheck the "Share audio" checkbox. Otherwise false, and in this case, one should not ask for audio stream through getUserMedia call. */
2629
2634
  canRequestAudioTrack: boolean;
2630
2635
  }
2631
2636
  /**
2632
2637
  * Shows desktop media picker UI with the specified set of sources.
2633
- * @param sources Set of sources that should be shown to the user.
2634
- * Parameter streamId: An opaque string that can be passed to getUserMedia() API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty streamId. The created streamId can be used only once and expires after a few seconds when it is not used.
2638
+ * @param sources Set of sources that should be shown to the user. The sources order in the set decides the tab order in the picker.
2639
+ * @param targetTab Optional tab for which the stream is created. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches `tab.url`. The tab's origin must be a secure origin, e.g. HTTPS.
2640
+ * @param callback streamId: An opaque string that can be passed to `getUserMedia()` API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty `streamId`. The created `streamId` can be used only once and expires after a few seconds when it is not used.
2641
+ * @return An id that can be passed to cancelChooseDesktopMedia() in case the prompt need to be canceled.
2635
2642
  */
2636
2643
  export function chooseDesktopMedia(
2637
- sources: string[],
2644
+ sources: `${DesktopCaptureSourceType}`[],
2638
2645
  callback: (streamId: string, options: StreamOptions) => void,
2639
2646
  ): number;
2640
- /**
2641
- * Shows desktop media picker UI with the specified set of sources.
2642
- * @param sources Set of sources that should be shown to the user.
2643
- * @param targetTab Optional tab for which the stream is created. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches tab.url.
2644
- * Parameter streamId: An opaque string that can be passed to getUserMedia() API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty streamId. The created streamId can be used only once and expires after a few seconds when it is not used.
2645
- */
2646
2647
  export function chooseDesktopMedia(
2647
- sources: string[],
2648
- targetTab: chrome.tabs.Tab,
2648
+ sources: `${DesktopCaptureSourceType}`[],
2649
+ targetTab: tabs.Tab | undefined,
2649
2650
  callback: (streamId: string, options: StreamOptions) => void,
2650
2651
  ): number;
2652
+
2651
2653
  /**
2652
2654
  * Hides desktop media picker dialog shown by chooseDesktopMedia().
2653
2655
  * @param desktopMediaRequestId Id returned by chooseDesktopMedia()
@@ -4262,6 +4264,24 @@ declare namespace chrome {
4262
4264
  export function getHardwarePlatformInfo(callback: (info: HardwarePlatformInfo) => void): void;
4263
4265
  }
4264
4266
 
4267
+ ////////////////////
4268
+ // Enterprise Login
4269
+ ////////////////////
4270
+ /**
4271
+ * Use the `chrome.enterprise.login` API to exit Managed Guest sessions. Note: This API is only available to extensions installed by enterprise policy in ChromeOS Managed Guest sessions.
4272
+ *
4273
+ * Permissions: "enterprise.login"
4274
+ *
4275
+ * Note: Only available to policy installed extensions.
4276
+ * @platform ChromeOS only
4277
+ * @since Chrome 139
4278
+ */
4279
+ export namespace enterprise.login {
4280
+ /** Exits the current managed guest session. */
4281
+ export function exitCurrentManagedGuestSession(): Promise<void>;
4282
+ export function exitCurrentManagedGuestSession(callback: () => void): void;
4283
+ }
4284
+
4265
4285
  ////////////////////
4266
4286
  // Enterprise Networking Attributes
4267
4287
  ////////////////////
@@ -8571,6 +8591,8 @@ declare namespace chrome {
8571
8591
  MIPS = "mips",
8572
8592
  /** Specifies the processer architecture as mips64. */
8573
8593
  MIPS64 = "mips64",
8594
+ /** Specifies the processer architecture as riscv64. */
8595
+ RISCV64 = "riscv64",
8574
8596
  }
8575
8597
 
8576
8598
  /**
@@ -8737,7 +8759,7 @@ declare namespace chrome {
8737
8759
  /** The machine's processor architecture. */
8738
8760
  arch: `${PlatformArch}`;
8739
8761
  /** The native client architecture. This may be different from arch on some platforms. */
8740
- nacl_arch: `${PlatformNaclArch}`;
8762
+ nacl_arch?: `${PlatformNaclArch}`;
8741
8763
  }
8742
8764
 
8743
8765
  /** An object which allows two way communication with other pages. */
@@ -8826,6 +8848,7 @@ declare namespace chrome {
8826
8848
  | "downloads.ui"
8827
8849
  | "enterprise.deviceAttributes"
8828
8850
  | "enterprise.hardwarePlatform"
8851
+ | "enterprise.login"
8829
8852
  | "enterprise.networkingAttributes"
8830
8853
  | "enterprise.platformKeys"
8831
8854
  | "experimental"
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
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": "076782c72553668c0fd190651d3de0085465e5085354e58f14803262e1f5a2a0",
97
+ "typesPublisherContentHash": "eb74f1a2e293946d48df085e621691e4fa23a2c5af6aea88f3ed4d5d1e7fefb6",
98
98
  "typeScriptVersion": "5.2"
99
99
  }