@types/chrome 0.0.309 → 0.0.310

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 +1164 -930
  3. chrome/package.json +2 -2
chrome/index.d.ts CHANGED
@@ -766,265 +766,243 @@ declare namespace chrome {
766
766
  export namespace bookmarks {
767
767
  /** A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder. */
768
768
  export interface BookmarkTreeNode {
769
- /** Optional. The 0-based position of this node within its parent folder. */
770
- index?: number | undefined;
771
- /** Optional. When this node was created, in milliseconds since the epoch (new Date(dateAdded)). */
772
- dateAdded?: number | undefined;
773
- /** The text displayed for the node. */
774
- title: string;
775
- /** Optional. The URL navigated to when a user clicks the bookmark. Omitted for folders. */
776
- url?: string | undefined;
777
- /** Optional. When the contents of this folder last changed, in milliseconds since the epoch. */
778
- dateGroupModified?: number | undefined;
779
- /** The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted. */
769
+ /** An ordered list of children of this node. */
770
+ children?: BookmarkTreeNode[];
771
+ /** When this node was created, in milliseconds since the epoch (`new Date(dateAdded)`). */
772
+ dateAdded?: number;
773
+ /** When the contents of this folder last changed, in milliseconds since the epoch. */
774
+ dateGroupModified?: number;
775
+ /**
776
+ * When this node was last opened, in milliseconds since the epoch. Not set for folders.
777
+ * @since Chrome 114
778
+ */
779
+ dateLastUsed?: number;
780
+ /**
781
+ * If present, this is a folder that is added by the browser and that cannot be modified by the user or the extension. Child nodes may be modified, if this node does not have the `unmodifiable` property set. Omitted if the node can be modified by the user and the extension (default).
782
+ *
783
+ * There may be zero, one or multiple nodes of each folder type. A folder may be added or removed by the browser, but not via the extensions API.
784
+ * @since Chrome 134
785
+ */
786
+ folderType?: `${FolderType}`;
787
+ /** The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted. */
780
788
  id: string;
781
- /** Optional. The id of the parent folder. Omitted for the root node. */
782
- parentId?: string | undefined;
783
- /** Optional. An ordered list of children of this node. */
784
- children?: BookmarkTreeNode[] | undefined;
789
+ /** The 0-based position of this node within its parent folder. */
790
+ index?: number;
791
+ /** The `id` of the parent folder. Omitted for the root node. */
792
+ parentId?: string;
785
793
  /**
786
- * Optional.
787
- * @since Chrome 37
788
- * Indicates the reason why this node is unmodifiable. The managed value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default).
794
+ * Whether this node is synced with the user's remote account storage by the browser. This can be used to distinguish between account and local-only versions of the same {@link FolderType}. The value of this property may change for an existing node, for example as a result of user action.
795
+ *
796
+ * Note: this reflects whether the node is saved to the browser's built-in account provider. It is possible that a node could be synced via a third-party, even if this value is false.
797
+ *
798
+ * For managed nodes (nodes where `unmodifiable` is set to `true`), this property will always be `false`.
799
+ * @since Chrome 134
789
800
  */
790
- unmodifiable?: "managed" | undefined;
791
- }
792
-
793
- export interface BookmarkRemoveInfo {
794
- index: number;
795
- parentId: string;
796
- node: BookmarkTreeNode;
797
- }
798
-
799
- export interface BookmarkMoveInfo {
800
- index: number;
801
- oldIndex: number;
802
- parentId: string;
803
- oldParentId: string;
804
- }
805
-
806
- export interface BookmarkChangeInfo {
807
- url?: string | undefined;
801
+ syncing: boolean;
802
+ /** The text displayed for the node. */
808
803
  title: string;
804
+ /** Indicates the reason why this node is unmodifiable. The `managed` value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default). */
805
+ unmodifiable?: `${BookmarkTreeNodeUnmodifiable}`;
806
+ /* The URL navigated to when a user clicks the bookmark. Omitted for folders. */
807
+ url?: string;
809
808
  }
810
809
 
811
- export interface BookmarkReorderInfo {
812
- childIds: string[];
813
- }
814
-
815
- export interface BookmarkRemovedEvent
816
- extends chrome.events.Event<(id: string, removeInfo: BookmarkRemoveInfo) => void>
817
- {}
818
-
819
- export interface BookmarkImportEndedEvent extends chrome.events.Event<() => void> {}
820
-
821
- export interface BookmarkMovedEvent
822
- extends chrome.events.Event<(id: string, moveInfo: BookmarkMoveInfo) => void>
823
- {}
824
-
825
- export interface BookmarkImportBeganEvent extends chrome.events.Event<() => void> {}
826
-
827
- export interface BookmarkChangedEvent
828
- extends chrome.events.Event<(id: string, changeInfo: BookmarkChangeInfo) => void>
829
- {}
830
-
831
- export interface BookmarkCreatedEvent
832
- extends chrome.events.Event<(id: string, bookmark: BookmarkTreeNode) => void>
833
- {}
834
-
835
- export interface BookmarkChildrenReordered
836
- extends chrome.events.Event<(id: string, reorderInfo: BookmarkReorderInfo) => void>
837
- {}
838
-
839
- export interface BookmarkSearchQuery {
840
- query?: string | undefined;
841
- url?: string | undefined;
842
- title?: string | undefined;
810
+ /**
811
+ * Indicates the reason why this node is unmodifiable. The `managed` value indicates that this node was configured by the system administrator. Omitted if the node can be modified by the user and the extension (default).
812
+ * @since Chrome 44
813
+ */
814
+ export enum BookmarkTreeNodeUnmodifiable {
815
+ MANAGED = "managed",
843
816
  }
844
817
 
845
- export interface BookmarkCreateArg {
846
- /** Optional. Defaults to the Other Bookmarks folder. */
847
- parentId?: string | undefined;
848
- index?: number | undefined;
849
- title?: string | undefined;
850
- url?: string | undefined;
818
+ /** Object passed to the create() function. */
819
+ export interface CreateDetails {
820
+ index?: number;
821
+ /** Defaults to the Other Bookmarks folder. */
822
+ parentId?: string;
823
+ title?: string;
824
+ url?: string;
851
825
  }
852
826
 
853
- export interface BookmarkDestinationArg {
854
- parentId?: string | undefined;
855
- index?: number | undefined;
856
- }
827
+ /**
828
+ * Indicates the type of folder.
829
+ * @since Chrome 134
830
+ */
857
831
 
858
- export interface BookmarkChangesArg {
859
- title?: string | undefined;
860
- url?: string | undefined;
832
+ export enum FolderType {
833
+ /** The folder whose contents is displayed at the top of the browser window. */
834
+ BOOKMARKS_BAR = "bookmarks-bar",
835
+ /** Bookmarks which are displayed in the full list of bookmarks on all platforms. */
836
+ OTHER = "other",
837
+ /** Bookmarks generally available on the user's mobile devices, but modifiable by extension or in the bookmarks manager. */
838
+ MOBILE = "mobile",
839
+ /** A top-level folder that may be present if the system administrator or the custodian of a supervised user has configured bookmarks. */
840
+ MANAGED = "managed",
861
841
  }
862
842
 
863
- /** @deprecated since Chrome 38. Bookmark write operations are no longer limited by Chrome. */
864
- export var MAX_WRITE_OPERATIONS_PER_HOUR: number;
865
- /** @deprecated since Chrome 38. Bookmark write operations are no longer limited by Chrome. */
866
- export var MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number;
843
+ /** @deprecated Bookmark write operations are no longer limited by Chrome. */
844
+ export const MAX_WRITE_OPERATIONS_PER_HOUR: 1000000;
845
+ /** @deprecated Bookmark write operations are no longer limited by Chrome. */
846
+ export const MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: 1000000;
867
847
 
868
848
  /**
869
- * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.
870
- * @param query A string of words and quoted phrases that are matched against bookmark URLs and titles.
871
- */
872
- export function search(query: string, callback: (results: BookmarkTreeNode[]) => void): void;
873
- /**
874
- * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.
875
- * @param query A string of words and quoted phrases that are matched against bookmark URLs and titles.
876
- * @return The `search` method provides its result via callback or returned as a `Promise` (MV3 only).
877
- */
878
- export function search(query: string): Promise<BookmarkTreeNode[]>;
879
- /**
880
- * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.
881
- * @param query An object with one or more of the properties query, url, and title specified. Bookmarks matching all specified properties will be produced.
882
- */
883
- export function search(query: BookmarkSearchQuery, callback: (results: BookmarkTreeNode[]) => void): void;
884
- /**
885
- * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.
886
- * @param query An object with one or more of the properties query, url, and title specified. Bookmarks matching all specified properties will be produced.
887
- * @return The `search` method provides its result via callback or returned as a `Promise` (MV3 only).
888
- */
889
- export function search(query: BookmarkSearchQuery): Promise<BookmarkTreeNode[]>;
890
- /**
891
- * Retrieves the entire Bookmarks hierarchy.
849
+ * Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.
850
+ *
851
+ * Can return its result via Promise since Chrome 90.
892
852
  */
893
- export function getTree(callback: (results: BookmarkTreeNode[]) => void): void;
853
+ export function create(bookmark: CreateDetails): Promise<BookmarkTreeNode>;
854
+ export function create(bookmark: CreateDetails, callback: (result: BookmarkTreeNode) => void): void;
855
+
894
856
  /**
895
- * Retrieves the entire Bookmarks hierarchy.
896
- * @return The `getTree` method provides its result via callback or returned as a `Promise` (MV3 only).
857
+ * Retrieves the specified BookmarkTreeNode(s).
858
+ * @param idOrIdList A single string-valued id, or an array of string-valued ids
859
+ *
860
+ * Can return its result via Promise since Chrome 90.
897
861
  */
898
- export function getTree(): Promise<BookmarkTreeNode[]>;
862
+ export function get(idOrIdList: string | [string, ...string[]]): Promise<BookmarkTreeNode[]>;
863
+ export function get(
864
+ idOrIdList: string | [string, ...string[]],
865
+ callback: (results: BookmarkTreeNode[]) => void,
866
+ ): void;
867
+
899
868
  /**
900
- * Retrieves the recently added bookmarks.
901
- * @param numberOfItems The maximum number of items to return.
869
+ * Retrieves the children of the specified BookmarkTreeNode id.
870
+ *
871
+ * Can return its result via Promise since Chrome Chrome 90
902
872
  */
903
- export function getRecent(numberOfItems: number, callback: (results: BookmarkTreeNode[]) => void): void;
873
+ export function getChildren(id: string): Promise<BookmarkTreeNode[]>;
874
+ export function getChildren(id: string, callback: (results: BookmarkTreeNode[]) => void): void;
875
+
904
876
  /**
905
877
  * Retrieves the recently added bookmarks.
906
878
  * @param numberOfItems The maximum number of items to return.
907
- * @return The `getRecent` method provides its result via callback or returned as a `Promise` (MV3 only).
879
+ *
880
+ * Can return its result via Promise since Chrome Chrome 90
908
881
  */
909
882
  export function getRecent(numberOfItems: number): Promise<BookmarkTreeNode[]>;
883
+ export function getRecent(numberOfItems: number, callback: (results: BookmarkTreeNode[]) => void): void;
884
+
910
885
  /**
911
- * Retrieves the specified BookmarkTreeNode.
912
- * @param id A single string-valued id
913
- */
914
- export function get(id: string, callback: (results: BookmarkTreeNode[]) => void): void;
915
- /**
916
- * Retrieves the specified BookmarkTreeNode.
917
- * @param id A single string-valued id
918
- * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
919
- */
920
- export function get(id: string): Promise<BookmarkTreeNode[]>;
921
- /**
922
- * Retrieves the specified BookmarkTreeNode.
923
- * @param idList An array of string-valued ids
924
- */
925
- export function get(idList: string[], callback: (results: BookmarkTreeNode[]) => void): void;
926
- /**
927
- * Retrieves the specified BookmarkTreeNode.
928
- * @param idList An array of string-valued ids
929
- * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
930
- */
931
- export function get(idList: string[]): Promise<BookmarkTreeNode[]>;
932
- /**
933
- * Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.
934
- * @return The `create` method provides its result via callback or returned as a `Promise` (MV3 only).
935
- */
936
- export function create(bookmark: BookmarkCreateArg): Promise<BookmarkTreeNode>;
937
- /**
938
- * Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.
886
+ * Retrieves part of the Bookmarks hierarchy, starting at the specified node.
887
+ * @param id The ID of the root of the subtree to retrieve.
888
+ *
889
+ * Can return its result via Promise since Chrome Chrome 90
939
890
  */
940
- export function create(bookmark: BookmarkCreateArg, callback: (result: BookmarkTreeNode) => void): void;
891
+ export function getSubTree(id: string): Promise<BookmarkTreeNode[]>;
892
+ export function getSubTree(id: string, callback: (results: BookmarkTreeNode[]) => void): void;
893
+
941
894
  /**
942
- * Moves the specified BookmarkTreeNode to the provided location.
943
- * @return The `move` method provides its result via callback or returned as a `Promise` (MV3 only).
895
+ * Retrieves the entire Bookmarks hierarchy.
896
+ *
897
+ * Can return its result via Promise since Chrome Chrome 90
944
898
  */
945
- export function move(
946
- id: string,
947
- destination: BookmarkDestinationArg,
948
- ): Promise<BookmarkTreeNode>;
899
+ export function getTree(): Promise<BookmarkTreeNode[]>;
900
+ export function getTree(callback: (results: BookmarkTreeNode[]) => void): void;
901
+
902
+ interface MoveDestination {
903
+ parentId?: string;
904
+ index?: number;
905
+ }
906
+
949
907
  /**
950
908
  * Moves the specified BookmarkTreeNode to the provided location.
909
+ *
910
+ * Can return its result via Promise since Chrome Chrome 90
951
911
  */
912
+ export function move(id: string, destination: MoveDestination): Promise<BookmarkTreeNode>;
952
913
  export function move(
953
914
  id: string,
954
- destination: BookmarkDestinationArg,
955
- callback: (result: BookmarkTreeNode) => void,
956
- ): void;
957
- /**
958
- * Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. Note: Currently, only 'title' and 'url' are supported.
959
- * @return The `update` method provides its result via callback or returned as a `Promise` (MV3 only).
960
- */
961
- export function update(
962
- id: string,
963
- changes: BookmarkChangesArg,
964
- ): Promise<BookmarkTreeNode>;
965
- /**
966
- * Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. Note: Currently, only 'title' and 'url' are supported.
967
- */
968
- export function update(
969
- id: string,
970
- changes: BookmarkChangesArg,
915
+ destination: MoveDestination,
971
916
  callback: (result: BookmarkTreeNode) => void,
972
917
  ): void;
918
+
973
919
  /**
974
920
  * Removes a bookmark or an empty bookmark folder.
975
- * @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
921
+ *
922
+ * Can return its result via Promise since Chrome Chrome 90
976
923
  */
977
924
  export function remove(id: string): Promise<void>;
978
- /**
979
- * Removes a bookmark or an empty bookmark folder.
980
- */
981
- export function remove(id: string, callback: Function): void;
982
- /**
983
- * Retrieves the children of the specified BookmarkTreeNode id.
984
- */
985
- export function getChildren(id: string, callback: (results: BookmarkTreeNode[]) => void): void;
986
- /**
987
- * Retrieves the children of the specified BookmarkTreeNode id.
988
- * @return The `getChildren` method provides its result via callback or returned as a `Promise` (MV3 only).
989
- */
990
- export function getChildren(id: string): Promise<BookmarkTreeNode[]>;
991
- /**
992
- * @since Chrome 14
993
- * Retrieves part of the Bookmarks hierarchy, starting at the specified node.
994
- * @param id The ID of the root of the subtree to retrieve.
995
- */
996
- export function getSubTree(id: string, callback: (results: BookmarkTreeNode[]) => void): void;
997
- /**
998
- * @since Chrome 14
999
- * Retrieves part of the Bookmarks hierarchy, starting at the specified node.
1000
- * @param id The ID of the root of the subtree to retrieve.
1001
- * @return The `getSubTree` method provides its result via callback or returned as a `Promise` (MV3 only).
1002
- */
1003
- export function getSubTree(id: string): Promise<BookmarkTreeNode[]>;
925
+ export function remove(id: string, callback: () => void): void;
926
+
1004
927
  /**
1005
928
  * Recursively removes a bookmark folder.
1006
- * @return The `removeTree` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
929
+ *
930
+ * Can return its result via Promise since Chrome Chrome 90
1007
931
  */
1008
932
  export function removeTree(id: string): Promise<void>;
933
+ export function removeTree(id: string, callback: () => void): void;
934
+
935
+ interface SearchQuery {
936
+ /** A string of words and quoted phrases that are matched against bookmark URLs and titles.*/
937
+ query?: string;
938
+ /** The URL of the bookmark; matches verbatim. Note that folders have no URL. */
939
+ url?: string;
940
+ /** The title of the bookmark; matches verbatim. */
941
+ title?: string;
942
+ }
943
+
1009
944
  /**
1010
- * Recursively removes a bookmark folder.
945
+ * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.
946
+ * @param query Either a string of words and quoted phrases that are matched against bookmark URLs and titles, or an object. If an object, the properties `query`, `url`, and `title` may be specified and bookmarks matching all specified properties will be produced.
947
+ *
948
+ * Can return its result via Promise since Chrome Chrome 90
1011
949
  */
1012
- export function removeTree(id: string, callback: Function): void;
950
+ export function search(query: string | SearchQuery): Promise<BookmarkTreeNode[]>;
951
+ export function search(query: string | SearchQuery, callback: (results: BookmarkTreeNode[]) => void): void;
952
+
953
+ interface UpdateChanges {
954
+ title?: string;
955
+ url?: string;
956
+ }
957
+
958
+ /**
959
+ * Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. **Note:** Currently, only 'title' and 'url' are supported.
960
+ *
961
+ * Can return its result via Promise since Chrome Chrome 90
962
+ */
963
+ export function update(id: string, changes: UpdateChanges): Promise<BookmarkTreeNode>;
964
+ export function update(id: string, changes: UpdateChanges, callback: (result: BookmarkTreeNode) => void): void;
965
+
966
+ /** Fired when a bookmark or folder changes. **Note:** Currently, only title and url changes trigger this.*/
967
+ export const onChanged: events.Event<(id: string, changeInfo: { title: string; url?: string }) => void>;
968
+
969
+ /** Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move(). */
970
+ export const onChildrenReordered: events.Event<(id: string, reorderInfo: { childIds: string[] }) => void>;
971
+
972
+ /** Fired when a bookmark or folder is created. */
973
+ export const onCreated: events.Event<(id: string, bookmark: BookmarkTreeNode) => void>;
1013
974
 
1014
- /** Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents. */
1015
- export var onRemoved: BookmarkRemovedEvent;
1016
- /** Fired when a bookmark import session is ended. */
1017
- export var onImportEnded: BookmarkImportEndedEvent;
1018
975
  /** Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately. */
1019
- export var onImportBegan: BookmarkImportBeganEvent;
1020
- /** Fired when a bookmark or folder changes. Note: Currently, only title and url changes trigger this. */
1021
- export var onChanged: BookmarkChangedEvent;
976
+ export const onImportBegan: events.Event<() => void>;
977
+
978
+ /** Fired when a bookmark import session is ended. */
979
+ export const onImportEnded: events.Event<() => void>;
980
+
1022
981
  /** Fired when a bookmark or folder is moved to a different parent folder. */
1023
- export var onMoved: BookmarkMovedEvent;
1024
- /** Fired when a bookmark or folder is created. */
1025
- export var onCreated: BookmarkCreatedEvent;
1026
- /** Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move(). */
1027
- export var onChildrenReordered: BookmarkChildrenReordered;
982
+ export const onMoved: events.Event<
983
+ (
984
+ id: string,
985
+ moveInfo: {
986
+ parentId: string;
987
+ index: number;
988
+ oldParentId: string;
989
+ oldIndex: number;
990
+ },
991
+ ) => void
992
+ >;
993
+
994
+ /** Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents. */
995
+ export const onRemoved: events.Event<
996
+ (
997
+ id: string,
998
+ removeInfo: {
999
+ parentId: string;
1000
+ index: number;
1001
+ /** @since Chrome 48 */
1002
+ node: BookmarkTreeNode;
1003
+ },
1004
+ ) => void
1005
+ >;
1028
1006
  }
1029
1007
 
1030
1008
  ////////////////////
@@ -1526,320 +1504,356 @@ declare namespace chrome {
1526
1504
  * Permissions: "contentSettings"
1527
1505
  */
1528
1506
  export namespace contentSettings {
1529
- type ScopeEnum = "regular" | "incognito_session_only";
1507
+ /** @since Chrome 113 */
1508
+ export enum AutoVerifyContentSetting {
1509
+ ALLOW = "allow",
1510
+ BLOCK = "block",
1511
+ }
1530
1512
 
1531
- export interface ClearDetails {
1532
- /**
1533
- * Optional.
1534
- * Where to clear the setting (default: regular).
1535
- * The scope of the ContentSetting. One of
1536
- * * regular: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere),
1537
- * * incognito_session_only: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings).
1538
- */
1539
- scope?: ScopeEnum | undefined;
1513
+ /** @since Chrome 46 */
1514
+ export enum CameraContentSetting {
1515
+ ALLOW = "allow",
1516
+ BLOCK = "block",
1517
+ ASK = "ask",
1540
1518
  }
1541
1519
 
1542
- type DefaultContentSettingDetails = "allow" | "ask" | "block" | "detect_important_content" | "session_only";
1520
+ /** @since Chrome 121 */
1521
+ export enum ClipboardContentSetting {
1522
+ ALLOW = "allow",
1523
+ BLOCK = "block",
1524
+ ASK = "ask",
1525
+ }
1543
1526
 
1544
- export interface SetDetails {
1545
- /** Optional. The resource identifier for the content type. */
1546
- resourceIdentifier?: ResourceIdentifier | undefined;
1547
- /** The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values. */
1548
- setting: DefaultContentSettingDetails;
1549
- /** Optional. The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see Content Setting Patterns. */
1550
- secondaryPattern?: string | undefined;
1551
- /** Optional. Where to set the setting (default: regular). */
1552
- scope?: ScopeEnum | undefined;
1553
- /** The pattern for the primary URL. For details on the format of a pattern, see Content Setting Patterns. */
1554
- primaryPattern: string;
1527
+ interface ContentSettingClearParams {
1528
+ /** Where to clear the setting (default: regular). */
1529
+ scope?: `${Scope}`;
1555
1530
  }
1556
1531
 
1557
- export interface CookieSetDetails extends SetDetails {
1558
- setting: "allow" | "block" | "session_only";
1532
+ interface ContentSettingGetParams {
1533
+ /** Whether to check the content settings for an incognito session. (default false) */
1534
+ incognito?: boolean;
1535
+ /** The primary URL for which the content setting should be retrieved. Note that the meaning of a primary URL depends on the content type. */
1536
+ primaryUrl: string;
1537
+ /** The secondary URL for which the content setting should be retrieved. Defaults to the primary URL. Note that the meaning of a secondary URL depends on the content type, and not all content types use secondary URLs. */
1538
+ secondaryUrl?: string;
1539
+ /** A more specific identifier of the type of content for which the settings should be retrieved. */
1540
+ resourceIdentifier?: ResourceIdentifier;
1559
1541
  }
1560
1542
 
1561
- export interface ImagesSetDetails extends SetDetails {
1562
- setting: "allow" | "block";
1543
+ interface ContentSettingGetResult<T> {
1544
+ /** The content setting. See the description of the individual ContentSetting objects for the possible values. */
1545
+ setting: T;
1563
1546
  }
1564
1547
 
1565
- export interface JavascriptSetDetails extends SetDetails {
1566
- setting: "allow" | "block";
1548
+ interface ContentSettingSetParams<T> {
1549
+ /** The pattern for the primary URL. For details on the format of a pattern, see Content Setting Patterns. */
1550
+ primaryPattern: string;
1551
+ /** The resource identifier for the content type. */
1552
+ resourceIdentifier?: ResourceIdentifier;
1553
+ /** Where to set the setting (default: regular). */
1554
+ scope?: `${Scope}`;
1555
+ /** The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see Content Setting Patterns.*/
1556
+ secondaryPattern?: string;
1557
+ /** The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values. */
1558
+ setting: T;
1567
1559
  }
1568
1560
 
1569
- export interface LocationSetDetails extends SetDetails {
1570
- setting: "allow" | "block" | "ask";
1561
+ export interface ContentSetting<T extends string> {
1562
+ /**
1563
+ * Clear all content setting rules set by this extension.
1564
+ *
1565
+ * Can return its result via Promise since Chrome 96.
1566
+ */
1567
+ clear(details: ContentSettingClearParams): Promise<void>;
1568
+ clear(details: ContentSettingClearParams, callback: () => void): void;
1569
+
1570
+ /**
1571
+ * Gets the current content setting for a given pair of URLs.
1572
+ *
1573
+ * Can return its result via Promise since Chrome 96.
1574
+ */
1575
+ get(details: ContentSettingGetParams): Promise<ContentSettingGetResult<T>>;
1576
+ get(details: ContentSettingGetParams, callback: (details: ContentSettingGetResult<T>) => void): void;
1577
+
1578
+ /** Can return its result via Promise since Chrome 96. */
1579
+ getResourceIdentifiers(): Promise<ResourceIdentifier[] | undefined>;
1580
+ getResourceIdentifiers(callback: (resourceIdentifiers?: ResourceIdentifier[]) => void): void;
1581
+
1582
+ /**
1583
+ * Applies a new content setting rule.
1584
+ *
1585
+ * Can return its result via Promise since Chrome 96.
1586
+ */
1587
+ set(details: ContentSettingSetParams<T>): Promise<void>;
1588
+ set(details: ContentSettingSetParams<T>, callback: () => void): void;
1571
1589
  }
1572
1590
 
1573
- export interface PluginsSetDetails extends SetDetails {
1574
- setting: "allow" | "block" | "detect_important_content";
1591
+ /** @since Chrome 44 */
1592
+ export enum CookiesContentSetting {
1593
+ ALLOW = "allow",
1594
+ BLOCK = "block",
1595
+ SESSION_ONLY = "session_only",
1575
1596
  }
1576
1597
 
1577
- export interface PopupsSetDetails extends SetDetails {
1578
- setting: "allow" | "block";
1598
+ /** @since Chrome 44 */
1599
+ export enum FullscreenContentSetting {
1600
+ ALLOW = "allow",
1579
1601
  }
1580
1602
 
1581
- export interface NotificationsSetDetails extends SetDetails {
1582
- setting: "allow" | "block" | "ask";
1603
+ /** @since Chrome 44 */
1604
+ export enum ImagesContentSetting {
1605
+ ALLOW = "allow",
1606
+ BLOCK = "block",
1583
1607
  }
1584
1608
 
1585
- export interface FullscreenSetDetails extends SetDetails {
1586
- setting: "allow";
1609
+ /** @since Chrome 44 */
1610
+ export enum JavascriptContentSetting {
1611
+ ALLOW = "allow",
1612
+ BLOCK = "block",
1587
1613
  }
1588
1614
 
1589
- export interface MouselockSetDetails extends SetDetails {
1590
- setting: "allow";
1615
+ /** @since Chrome 44 */
1616
+ export enum LocationContentSetting {
1617
+ ALLOW = "allow",
1618
+ BLOCK = "block",
1619
+ ASK = "ask",
1591
1620
  }
1592
1621
 
1593
- export interface MicrophoneSetDetails extends SetDetails {
1594
- setting: "allow" | "block" | "ask";
1622
+ /** @since Chrome 46 */
1623
+ export enum MicrophoneContentSetting {
1624
+ ALLOW = "allow",
1625
+ BLOCK = "block",
1626
+ ASK = "ask",
1595
1627
  }
1596
1628
 
1597
- export interface CameraSetDetails extends SetDetails {
1598
- setting: "allow" | "block" | "ask";
1629
+ /** @since Chrome 44 */
1630
+ export enum MouselockContentSetting {
1631
+ ALLOW = "allow",
1599
1632
  }
1600
1633
 
1601
- export interface PpapiBrokerSetDetails extends SetDetails {
1602
- setting: "allow" | "block" | "ask";
1634
+ /** @since Chrome 44 */
1635
+ export enum MultipleAutomaticDownloadsContentSetting {
1636
+ ALLOW = "allow",
1637
+ BLOCK = "block",
1638
+ ASK = "ask",
1603
1639
  }
1604
1640
 
1605
- export interface MultipleAutomaticDownloadsSetDetails extends SetDetails {
1606
- setting: "allow" | "block" | "ask";
1641
+ /** @since Chrome 44 */
1642
+ export enum NotificationsContentSetting {
1643
+ ALLOW = "allow",
1644
+ BLOCK = "block",
1645
+ ASK = "ask",
1607
1646
  }
1608
1647
 
1609
- export interface GetDetails {
1610
- /** Optional. The secondary URL for which the content setting should be retrieved. Defaults to the primary URL. Note that the meaning of a secondary URL depends on the content type, and not all content types use secondary URLs. */
1611
- secondaryUrl?: string | undefined;
1612
- /** Optional. A more specific identifier of the type of content for which the settings should be retrieved. */
1613
- resourceIdentifier?: ResourceIdentifier | undefined;
1614
- /** Optional. Whether to check the content settings for an incognito session. (default false) */
1615
- incognito?: boolean | undefined;
1616
- /** The primary URL for which the content setting should be retrieved. Note that the meaning of a primary URL depends on the content type. */
1617
- primaryUrl: string;
1648
+ /** @since Chrome 44 */
1649
+ export enum PluginsContentSetting {
1650
+ BLOCK = "block",
1618
1651
  }
1619
1652
 
1620
- export interface ReturnedDetails {
1621
- /** The content setting. See the description of the individual ContentSetting objects for the possible values. */
1622
- setting: DefaultContentSettingDetails;
1653
+ /** @since Chrome 44 */
1654
+ export enum PopupsContentSetting {
1655
+ ALLOW = "allow",
1656
+ BLOCK = "block",
1623
1657
  }
1624
1658
 
1625
- export interface ContentSetting {
1626
- /**
1627
- * Clear all content setting rules set by this extension.
1628
- */
1629
- clear(details: ClearDetails, callback?: () => void): void;
1630
- /**
1631
- * Applies a new content setting rule.
1632
- */
1633
- set(details: SetDetails, callback?: () => void): void;
1634
- getResourceIdentifiers(
1635
- callback: (
1636
- /**
1637
- * A list of resource identifiers for this content type, or undefined if this content type does not use resource identifiers.
1638
- */
1639
- resourceIdentifiers?: ResourceIdentifier[],
1640
- ) => void,
1641
- ): void;
1642
- /**
1643
- * Gets the current content setting for a given pair of URLs.
1644
- */
1645
- get(details: GetDetails, callback: (details: ReturnedDetails) => void): void;
1646
- }
1647
-
1648
- export interface CookieContentSetting extends ContentSetting {
1649
- set(details: CookieSetDetails, callback?: () => void): void;
1650
- get(details: GetDetails, callback: (details: CookieSetDetails) => void): void;
1651
- }
1652
-
1653
- export interface PopupsContentSetting extends ContentSetting {
1654
- set(details: PopupsSetDetails, callback?: () => void): void;
1655
- get(details: GetDetails, callback: (details: PopupsSetDetails) => void): void;
1656
- }
1657
-
1658
- export interface JavascriptContentSetting extends ContentSetting {
1659
- set(details: JavascriptSetDetails, callback?: () => void): void;
1660
- get(details: GetDetails, callback: (details: JavascriptSetDetails) => void): void;
1661
- }
1662
-
1663
- export interface NotificationsContentSetting extends ContentSetting {
1664
- set(details: NotificationsSetDetails, callback?: () => void): void;
1665
- get(details: GetDetails, callback: (details: NotificationsSetDetails) => void): void;
1666
- }
1667
-
1668
- export interface PluginsContentSetting extends ContentSetting {
1669
- set(details: PluginsSetDetails, callback?: () => void): void;
1670
- get(details: GetDetails, callback: (details: PluginsSetDetails) => void): void;
1671
- }
1672
-
1673
- export interface ImagesContentSetting extends ContentSetting {
1674
- set(details: ImagesSetDetails, callback?: () => void): void;
1675
- get(details: GetDetails, callback: (details: ImagesSetDetails) => void): void;
1676
- }
1677
-
1678
- export interface LocationContentSetting extends ContentSetting {
1679
- set(details: LocationSetDetails, callback?: () => void): void;
1680
- get(details: GetDetails, callback: (details: LocationSetDetails) => void): void;
1681
- }
1682
-
1683
- export interface FullscreenContentSetting extends ContentSetting {
1684
- set(details: FullscreenSetDetails, callback?: () => void): void;
1685
- get(details: GetDetails, callback: (details: FullscreenSetDetails) => void): void;
1686
- }
1687
-
1688
- export interface MouselockContentSetting extends ContentSetting {
1689
- set(details: MouselockSetDetails, callback?: () => void): void;
1690
- get(details: GetDetails, callback: (details: MouselockSetDetails) => void): void;
1691
- }
1692
-
1693
- export interface MicrophoneContentSetting extends ContentSetting {
1694
- set(details: MicrophoneSetDetails, callback?: () => void): void;
1695
- get(details: GetDetails, callback: (details: MicrophoneSetDetails) => void): void;
1696
- }
1697
-
1698
- export interface CameraContentSetting extends ContentSetting {
1699
- set(details: CameraSetDetails, callback?: () => void): void;
1700
- get(details: GetDetails, callback: (details: CameraSetDetails) => void): void;
1701
- }
1702
-
1703
- export interface PpapiBrokerContentSetting extends ContentSetting {
1704
- set(details: PpapiBrokerSetDetails, callback?: () => void): void;
1705
- get(details: GetDetails, callback: (details: PpapiBrokerSetDetails) => void): void;
1706
- }
1707
-
1708
- export interface MultipleAutomaticDownloadsContentSetting extends ContentSetting {
1709
- set(details: MultipleAutomaticDownloadsSetDetails, callback?: () => void): void;
1710
- get(details: GetDetails, callback: (details: MultipleAutomaticDownloadsSetDetails) => void): void;
1659
+ /** @since Chrome 44 */
1660
+ export enum PpapiBrokerContentSetting {
1661
+ BLOCK = "block",
1711
1662
  }
1712
1663
 
1713
1664
  /** The only content type using resource identifiers is contentSettings.plugins. For more information, see Resource Identifiers. */
1714
1665
  export interface ResourceIdentifier {
1666
+ /** A human readable description of the resource. */
1667
+ description?: string;
1715
1668
  /** The resource identifier for the given content type. */
1716
1669
  id: string;
1717
- /** Optional. A human readable description of the resource. */
1718
- description?: string | undefined;
1719
1670
  }
1720
1671
 
1721
1672
  /**
1722
- * Whether to allow cookies and other local data to be set by websites. One of
1723
- * allow: Accept cookies,
1724
- * block: Block cookies,
1725
- * session_only: Accept cookies only for the current session.
1726
- * Default is allow.
1727
- * The primary URL is the URL representing the cookie origin. The secondary URL is the URL of the top-level frame.
1728
- */
1729
- export var cookies: CookieContentSetting;
1730
- /**
1731
- * Whether to allow sites to show pop-ups. One of
1732
- * allow: Allow sites to show pop-ups,
1733
- * block: Don't allow sites to show pop-ups.
1734
- * Default is block.
1735
- * The primary URL is the URL of the top-level frame. The secondary URL is not used.
1673
+ * The scope of the ContentSetting. One of
1674
+ *
1675
+ * `regular`: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere),
1676
+ *
1677
+ * `incognito_session_only`: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings).
1678
+ * @since Chrome 44
1736
1679
  */
1737
- export var popups: PopupsContentSetting;
1680
+ export enum Scope {
1681
+ REGULAR = "regular",
1682
+ INCOGNITO_SESSION_ONLY = "incognito_session_only",
1683
+ }
1684
+
1738
1685
  /**
1739
- * Whether to run JavaScript. One of
1740
- * allow: Run JavaScript,
1741
- * block: Don't run JavaScript.
1742
- * Default is allow.
1686
+ * Whether to allow sites to download multiple files automatically. One of
1687
+ *
1688
+ * `allow`: Allow sites to download multiple files automatically,
1689
+ *
1690
+ * `block`: Don't allow sites to download multiple files automatically,
1691
+ *
1692
+ * `ask`: Ask when a site wants to download files automatically after the first file.
1693
+ *
1694
+ * Default is `ask`.
1695
+ *
1743
1696
  * The primary URL is the URL of the top-level frame. The secondary URL is not used.
1744
1697
  */
1745
- export var javascript: JavascriptContentSetting;
1698
+ export const automaticDownloads: ContentSetting<`${MultipleAutomaticDownloadsContentSetting}`>;
1699
+
1746
1700
  /**
1747
- * Whether to allow sites to show desktop notifications. One of
1748
- * allow: Allow sites to show desktop notifications,
1749
- * block: Don't allow sites to show desktop notifications,
1750
- * ask: Ask when a site wants to show desktop notifications.
1751
- * Default is ask.
1752
- * The primary URL is the URL of the document which wants to show the notification. The secondary URL is not used.
1701
+ * Whether to allow sites to use the Private State Tokens API. One of
1702
+ *
1703
+ * `allow`: Allow sites to use the Private State Tokens API,
1704
+ *
1705
+ * `block`: Block sites from using the Private State Tokens API.
1706
+ *
1707
+ * Default is `allow`.
1708
+ *
1709
+ * When calling `set()`, the primary URL pattern must be `<all_urls>`. The secondary URL is not used.
1710
+ * @since Chrome 113
1753
1711
  */
1754
- export var notifications: NotificationsContentSetting;
1712
+ export const autoVerify: ContentSetting<`${AutoVerifyContentSetting}`>;
1713
+
1755
1714
  /**
1756
- * Whether to run plugins. One of
1757
- * allow: Run plugins automatically,
1758
- * block: Don't run plugins automatically,
1759
- * detect_important_content: Only run automatically those plugins that are detected as the website's main content.
1760
- * Default is allow.
1761
- * The primary URL is the URL of the top-level frame. The secondary URL is not used.
1715
+ * Whether to allow sites to access the camera. One of
1716
+ *
1717
+ * `allow`: Allow sites to access the camera,
1718
+ *
1719
+ * `block`: Don't allow sites to access the camera,
1720
+ *
1721
+ * `ask`: Ask when a site wants to access the camera.
1722
+ *
1723
+ * Default is `ask`.
1724
+ *
1725
+ * The primary URL is the URL of the document which requested camera access. The secondary URL is not used. NOTE: The 'allow' setting is not valid if both patterns are '<all\_urls>'.
1726
+ * @since Chrome 46
1762
1727
  */
1763
- export var plugins: PluginsContentSetting;
1728
+ export const camera: ContentSetting<`${CameraContentSetting}`>;
1729
+
1764
1730
  /**
1765
- * Whether to show images. One of
1766
- * allow: Show images,
1767
- * block: Don't show images.
1768
- * Default is allow.
1769
- * The primary URL is the URL of the top-level frame. The secondary URL is the URL of the image.
1731
+ * Whether to allow sites to access the clipboard via advanced capabilities of the Async Clipboard API. "Advanced" capabilities include anything besides writing built-in formats after a user gesture, i.e. the ability to read, the ability to write custom formats, and the ability to write without a user gesture. One of
1732
+ *
1733
+ * `allow`: Allow sites to use advanced clipboard capabilities,
1734
+ *
1735
+ * `block`: Don't allow sites to use advanced clipboard capabilties,
1736
+ *
1737
+ * `ask`: Ask when a site wants to use advanced clipboard capabilities.
1738
+ *
1739
+ * Default is `ask`.
1740
+ *
1741
+ * The primary URL is the URL of the document which requested clipboard access. The secondary URL is not used.
1742
+ * @since Chrome 121
1770
1743
  */
1771
- export var images: ImagesContentSetting;
1744
+ export const clipboard: ContentSetting<`${ClipboardContentSetting}`>;
1745
+
1772
1746
  /**
1773
- * @since Chrome 42
1774
- * Whether to allow Geolocation. One of
1775
- * allow: Allow sites to track your physical location,
1776
- * block: Don't allow sites to track your physical location,
1777
- * ask: Ask before allowing sites to track your physical location.
1778
- * Default is ask.
1779
- * The primary URL is the URL of the document which requested location data. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL).
1747
+ * Whether to allow cookies and other local data to be set by websites. One of
1748
+ *
1749
+ * `allow`: Accept cookies,
1750
+ *
1751
+ * `block`: Block cookies,
1752
+ *
1753
+ * `session_only`: Accept cookies only for the current session.
1754
+ *
1755
+ * Default is `allow`.
1756
+ *
1757
+ * The primary URL is the URL representing the cookie origin. The secondary URL is the URL of the top-level frame.
1780
1758
  */
1781
- export var location: LocationContentSetting;
1759
+ export const cookies: ContentSetting<`${CookiesContentSetting}`>;
1760
+
1761
+ /** @deprecated No longer has any effect. Fullscreen permission is now automatically granted for all sites. Value is always `allow`. */
1762
+ export const fullscreen: ContentSetting<`${FullscreenContentSetting}`>;
1763
+
1782
1764
  /**
1783
- * @since Chrome 42
1784
- * Whether to allow sites to toggle the fullscreen mode. One of
1785
- * allow: Allow sites to toggle the fullscreen mode,
1786
- * ask: Ask when a site wants to toggle the fullscreen mode.
1787
- * Default is ask.
1788
- * The primary URL is the URL of the document which requested to toggle the fullscreen mode. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL).
1765
+ * Whether to show images. One of
1766
+ *
1767
+ * `allow`: Show images,
1768
+ *
1769
+ * `block`: Don't show images.
1770
+ *
1771
+ * Default is `allow`.
1772
+ *
1773
+ * The primary URL is the URL of the top-level frame. The secondary URL is the URL of the image.
1789
1774
  */
1790
- export var fullscreen: FullscreenContentSetting;
1775
+ export const images: ContentSetting<`${ImagesContentSetting}`>;
1776
+
1791
1777
  /**
1792
- * @since Chrome 42
1793
- * Whether to allow sites to disable the mouse cursor. One of
1794
- * allow: Allow sites to disable the mouse cursor,
1795
- * block: Don't allow sites to disable the mouse cursor,
1796
- * ask: Ask when a site wants to disable the mouse cursor.
1797
- * Default is ask.
1778
+ * Whether to run JavaScript. One of
1779
+ *
1780
+ * `allow`: Run JavaScript,
1781
+ *
1782
+ * `block`: Don't run JavaScript.
1783
+ *
1784
+ * Default is `allow`.
1785
+ *
1798
1786
  * The primary URL is the URL of the top-level frame. The secondary URL is not used.
1799
1787
  */
1800
- export var mouselock: MouselockContentSetting;
1788
+ export const javascript: ContentSetting<`${JavascriptContentSetting}`>;
1789
+
1801
1790
  /**
1802
- * @since Chrome 46
1803
- * Whether to allow sites to access the microphone. One of
1804
- * allow: Allow sites to access the microphone,
1805
- * block: Don't allow sites to access the microphone,
1806
- * ask: Ask when a site wants to access the microphone.
1807
- * Default is ask.
1808
- * The primary URL is the URL of the document which requested microphone access. The secondary URL is not used.
1809
- * NOTE: The 'allow' setting is not valid if both patterns are '<all_urls>'.
1791
+ * Whether to allow Geolocation. One of
1792
+ *
1793
+ * `allow`: Allow sites to track your physical location,
1794
+ *
1795
+ * `block`: Don't allow sites to track your physical location,
1796
+ *
1797
+ * `ask`: Ask before allowing sites to track your physical location.
1798
+ *
1799
+ * Default is `ask`.
1800
+ *
1801
+ * The primary URL is the URL of the document which requested location data. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL).
1810
1802
  */
1811
- export var microphone: MicrophoneContentSetting;
1803
+ export const location: ContentSetting<`${LocationContentSetting}`>;
1804
+
1812
1805
  /**
1806
+ * Whether to allow sites to access the microphone. One of
1807
+ *
1808
+ * `allow`: Allow sites to access the microphone,
1809
+ *
1810
+ * `block`: Don't allow sites to access the microphone,
1811
+ *
1812
+ * `ask`: Ask when a site wants to access the microphone.
1813
+ *
1814
+ * Default is `ask`.
1815
+ *
1816
+ * The primary URL is the URL of the document which requested microphone access. The secondary URL is not used. NOTE: The 'allow' setting is not valid if both patterns are '<all\_urls>'.
1813
1817
  * @since Chrome 46
1814
- * Whether to allow sites to access the camera. One of
1815
- * allow: Allow sites to access the camera,
1816
- * block: Don't allow sites to access the camera,
1817
- * ask: Ask when a site wants to access the camera.
1818
- * Default is ask.
1819
- * The primary URL is the URL of the document which requested camera access. The secondary URL is not used.
1820
- * NOTE: The 'allow' setting is not valid if both patterns are '<all_urls>'.
1821
1818
  */
1822
- export var camera: CameraContentSetting;
1819
+ export const microphone: ContentSetting<`${MicrophoneContentSetting}`>;
1820
+
1821
+ /** @deprecated No longer has any effect. Mouse lock permission is now automatically granted for all sites. Value is always `allow`. */
1822
+ export const mouselock: ContentSetting<`${MouselockContentSetting}`>;
1823
+
1823
1824
  /**
1824
- * @since Chrome 42
1825
- * Whether to allow sites to run plugins unsandboxed. One of
1826
- * allow: Allow sites to run plugins unsandboxed,
1827
- * block: Don't allow sites to run plugins unsandboxed,
1828
- * ask: Ask when a site wants to run a plugin unsandboxed.
1829
- * Default is ask.
1830
- * The primary URL is the URL of the top-level frame. The secondary URL is not used.
1825
+ * Whether to allow sites to show desktop notifications. One of
1826
+ *
1827
+ * `allow`: Allow sites to show desktop notifications,
1828
+ *
1829
+ * `block`: Don't allow sites to show desktop notifications,
1830
+ *
1831
+ * `ask`: Ask when a site wants to show desktop notifications.
1832
+ *
1833
+ * Default is `ask`.
1834
+ *
1835
+ * The primary URL is the URL of the document which wants to show the notification. The secondary URL is not used.
1831
1836
  */
1832
- export var unsandboxedPlugins: PpapiBrokerContentSetting;
1837
+ export const notifications: ContentSetting<`${NotificationsContentSetting}`>;
1838
+
1839
+ /** @deprecated With Flash support removed in Chrome 88, this permission no longer has any effect. Value is always `block`. Calls to `set()` and `clear()` will be ignored. */
1840
+ export const plugins: ContentSetting<`${PluginsContentSetting}`>;
1841
+
1833
1842
  /**
1834
- * @since Chrome 42
1835
- * Whether to allow sites to download multiple files automatically. One of
1836
- * allow: Allow sites to download multiple files automatically,
1837
- * block: Don't allow sites to download multiple files automatically,
1838
- * ask: Ask when a site wants to download files automatically after the first file.
1839
- * Default is ask.
1843
+ * Whether to allow sites to show pop-ups. One of
1844
+ *
1845
+ * `allow`: Allow sites to show pop-ups,
1846
+ *
1847
+ * `block`: Don't allow sites to show pop-ups.
1848
+ *
1849
+ * Default is `block`.
1850
+ *
1840
1851
  * The primary URL is the URL of the top-level frame. The secondary URL is not used.
1841
1852
  */
1842
- export var automaticDownloads: MultipleAutomaticDownloadsContentSetting;
1853
+ export const popups: ContentSetting<`${PopupsContentSetting}`>;
1854
+
1855
+ /** @deprecated Previously, controlled whether to allow sites to run plugins unsandboxed, however, with the Flash broker process removed in Chrome 88, this permission no longer has any effect. Value is always `block`. Calls to `set()` and `clear()` will be ignored. */
1856
+ export const unsandboxedPlugins: ContentSetting<`${PpapiBrokerContentSetting}`>;
1843
1857
  }
1844
1858
 
1845
1859
  ////////////////////
@@ -2298,133 +2312,122 @@ declare namespace chrome {
2298
2312
  * Permissions: "debugger"
2299
2313
  */
2300
2314
  export namespace _debugger {
2301
- /** Debuggee identifier. Either tabId or extensionId must be specified */
2315
+ /** Debuggee identifier. Either tabId, extensionId or targetId must be specified */
2302
2316
  export interface Debuggee {
2303
- /** Optional. The id of the tab which you intend to debug. */
2304
- tabId?: number | undefined;
2305
- /**
2306
- * Optional.
2307
- * @since Chrome 27
2308
- * The id of the extension which you intend to debug. Attaching to an extension background page is only possible when 'silent-debugger-extension-api' flag is enabled on the target browser.
2309
- */
2310
- extensionId?: string | undefined;
2311
- /**
2312
- * Optional.
2313
- * @since Chrome 28
2314
- * The opaque id of the debug target.
2315
- */
2316
- targetId?: string | undefined;
2317
+ /** The id of the tab which you intend to debug. */
2318
+ tabId?: number;
2319
+ /** The id of the extension which you intend to debug. Attaching to an extension background page is only possible when the `--silent-debugger-extension-api` command-line switch is used. */
2320
+ extensionId?: string;
2321
+ /** The opaque id of the debug target. */
2322
+ targetId?: string;
2317
2323
  }
2318
2324
 
2319
2325
  /**
2320
- * @since Chrome 28
2321
- * Debug target information
2326
+ * Debugger session identifier. One of tabId, extensionId or targetId must be specified. Additionally, an optional sessionId can be provided. If sessionId is specified for arguments sent from {@link onEvent}, it means the event is coming from a child protocol session within the root debuggee session. If sessionId is specified when passed to {@link sendCommand}, it targets a child protocol session within the root debuggee session.
2327
+ * @since Chrome 125
2328
+ */
2329
+ export interface DebuggerSession {
2330
+ /** The id of the extension which you intend to debug. Attaching to an extension background page is only possible when the `--silent-debugger-extension-api` command-line switch is used.*/
2331
+ extensionId?: string;
2332
+ /** The opaque id of the Chrome DevTools Protocol session. Identifies a child session within the root session identified by tabId, extensionId or targetId. */
2333
+ sessionId?: string;
2334
+ /** The id of the tab which you intend to debug. */
2335
+ tabId?: number;
2336
+ /** The opaque id of the debug target. */
2337
+ targetId?: string;
2338
+ }
2339
+
2340
+ /**
2341
+ * Connection termination reason.
2342
+ * @since Chrome 44
2322
2343
  */
2344
+ export enum DetachReason {
2345
+ CANCELED_BY_USER = "canceled_by_user",
2346
+ TARGET_CLOSED = "target_closed",
2347
+ }
2348
+
2349
+ /** Debug target information */
2323
2350
  export interface TargetInfo {
2324
2351
  /** Target type. */
2325
- type: string;
2352
+ type: `${TargetInfoType}`;
2326
2353
  /** Target id. */
2327
2354
  id: string;
2328
- /**
2329
- * Optional.
2330
- * @since Chrome 30
2331
- * The tab id, defined if type == 'page'.
2332
- */
2333
- tabId?: number | undefined;
2334
- /**
2335
- * Optional.
2336
- * @since Chrome 30
2337
- * The extension id, defined if type = 'background_page'.
2338
- */
2339
- extensionId?: string | undefined;
2355
+ /** The tab id, defined if type == 'page'. */
2356
+ tabId?: number;
2357
+ /** The extension id, defined if type = 'background_page'. */
2358
+ extensionId?: string;
2340
2359
  /** True if debugger is already attached. */
2341
2360
  attached: boolean;
2342
2361
  /** Target page title. */
2343
2362
  title: string;
2344
2363
  /** Target URL. */
2345
2364
  url: string;
2346
- /** Optional. Target favicon URL. */
2347
- faviconUrl?: string | undefined;
2365
+ /** Target favicon URL. */
2366
+ faviconUrl?: string;
2348
2367
  }
2349
2368
 
2350
- export interface DebuggerDetachedEvent
2351
- extends chrome.events.Event<(source: Debuggee, reason: string) => void>
2352
- {}
2353
-
2354
- export interface DebuggerEventEvent
2355
- extends chrome.events.Event<(source: Debuggee, method: string, params?: Object) => void>
2356
- {}
2357
-
2358
2369
  /**
2359
- * Attaches debugger to the given target.
2360
- * @param target Debugging target to which you want to attach.
2361
- * @param requiredVersion Required debugging protocol version ("0.1"). One can only attach to the debuggee with matching major version and greater or equal minor version. List of the protocol versions can be obtained in the documentation pages.
2362
- * @return The `attach` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
2370
+ * Target type.
2371
+ * @since Chrome 44
2363
2372
  */
2364
- export function attach(target: Debuggee, requiredVersion: string): Promise<void>;
2373
+ export enum TargetInfoType {
2374
+ BACKGROUND_PAGE = "background_page",
2375
+ OTHER = "other",
2376
+ PAGE = "page",
2377
+ WORKER = "worker",
2378
+ }
2379
+
2365
2380
  /**
2366
2381
  * Attaches debugger to the given target.
2367
2382
  * @param target Debugging target to which you want to attach.
2368
2383
  * @param requiredVersion Required debugging protocol version ("0.1"). One can only attach to the debuggee with matching major version and greater or equal minor version. List of the protocol versions can be obtained in the documentation pages.
2369
- * @param callback Called once the attach operation succeeds or fails. If the attach fails, runtime.lastError will be set to the error message.
2384
+ *
2385
+ * Can return its result via Promise since Chrome 96.
2370
2386
  */
2387
+ export function attach(target: Debuggee, requiredVersion: string): Promise<void>;
2371
2388
  export function attach(target: Debuggee, requiredVersion: string, callback: () => void): void;
2389
+
2372
2390
  /**
2373
2391
  * Detaches debugger from the given target.
2374
2392
  * @param target Debugging target from which you want to detach.
2375
- * @return The `detach` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
2393
+ *
2394
+ * Can return its result via Promise since Chrome 96.
2376
2395
  */
2377
2396
  export function detach(target: Debuggee): Promise<void>;
2378
- /**
2379
- * Detaches debugger from the given target.
2380
- * @param target Debugging target from which you want to detach.
2381
- * @param callback Called once the detach operation succeeds or fails. If the detach fails, runtime.lastError will be set to the error message.
2382
- */
2383
2397
  export function detach(target: Debuggee, callback: () => void): void;
2398
+
2384
2399
  /**
2385
2400
  * Sends given command to the debugging target.
2386
2401
  * @param target Debugging target to which you want to send the command.
2387
2402
  * @param method Method name. Should be one of the methods defined by the remote debugging protocol.
2388
- * @param commandParams Since Chrome 22.
2389
- * JSON object with request parameters. This object must conform to the remote debugging params scheme for given method.
2390
- * @return The `sendCommand` method provides its result via callback or returned as a `Promise` (MV3 only).
2403
+ * @param commandParams JSON object with request parameters. This object must conform to the remote debugging params scheme for given method.
2404
+ *
2405
+ * Can return its result via Promise since Chrome 96.
2391
2406
  */
2392
2407
  export function sendCommand(
2393
- target: Debuggee,
2408
+ target: DebuggerSession,
2394
2409
  method: string,
2395
2410
  commandParams?: Object,
2396
- ): Promise<Object>;
2397
- /**
2398
- * Sends given command to the debugging target.
2399
- * @param target Debugging target to which you want to send the command.
2400
- * @param method Method name. Should be one of the methods defined by the remote debugging protocol.
2401
- * @param commandParams Since Chrome 22.
2402
- * JSON object with request parameters. This object must conform to the remote debugging params scheme for given method.
2403
- * @param callback Response body. If an error occurs while posting the message, the callback will be called with no arguments and runtime.lastError will be set to the error message.
2404
- */
2411
+ ): Promise<Object | undefined>;
2405
2412
  export function sendCommand(
2406
- target: Debuggee,
2413
+ target: DebuggerSession,
2407
2414
  method: string,
2408
2415
  commandParams?: Object,
2409
2416
  callback?: (result?: Object) => void,
2410
2417
  ): void;
2418
+
2411
2419
  /**
2412
- * @since Chrome 28
2413
2420
  * Returns the list of available debug targets.
2414
- * @return The `getTargets` method provides its result via callback or returned as a `Promise` (MV3 only).
2421
+ *
2422
+ * Can return its result via Promise since Chrome 96.
2415
2423
  */
2416
2424
  export function getTargets(): Promise<TargetInfo[]>;
2417
- /**
2418
- * @since Chrome 28
2419
- * Returns the list of available debug targets.
2420
- * Parameter result: Array of TargetInfo objects corresponding to the available debug targets.
2421
- */
2422
2425
  export function getTargets(callback: (result: TargetInfo[]) => void): void;
2423
2426
 
2424
2427
  /** Fired when browser terminates debugging session for the tab. This happens when either the tab is being closed or Chrome DevTools is being invoked for the attached tab. */
2425
- export var onDetach: DebuggerDetachedEvent;
2428
+ export const onDetach: chrome.events.Event<(source: Debuggee, reason: `${DetachReason}`) => void>;
2426
2429
  /** Fired whenever debugging target issues instrumentation event. */
2427
- export var onEvent: DebuggerEventEvent;
2430
+ export const onEvent: chrome.events.Event<(source: DebuggerSession, method: string, params?: Object) => void>;
2428
2431
  }
2429
2432
 
2430
2433
  export { _debugger as debugger };
@@ -4540,526 +4543,757 @@ declare namespace chrome {
4540
4543
  * @platform ChromeOS only
4541
4544
  */
4542
4545
  export namespace fileSystemProvider {
4543
- export interface OpenedFileInfo {
4544
- /** A request ID to be be used by consecutive read/write and close requests. */
4545
- openRequestId: number;
4546
- /** The path of the opened file. */
4547
- filePath: string;
4548
- /** Whether the file was opened for reading or writing. */
4549
- mode: string;
4546
+ export interface AbortRequestedOptions {
4547
+ /** The identifier of the file system related to this operation. */
4548
+ fileSystemId: string;
4549
+ /** An ID of the request to be aborted. */
4550
+ operationRequestId: number;
4551
+ /** The unique identifier of this request. */
4552
+ requestId: number;
4550
4553
  }
4551
4554
 
4552
- export interface FileWatchersInfo {
4553
- /** The path of the entry being observed. */
4555
+ /** @since Chrome 45 */
4556
+ export interface Action {
4557
+ /** The identifier of the action. Any string or {@link CommonActionId} for common actions. */
4558
+ id: string;
4559
+ /** The title of the action. It may be ignored for common actions. */
4560
+ title?: string;
4561
+ }
4562
+
4563
+ export interface AddWatcherRequestedOptions {
4564
+ /** The path of the entry to be observed. */
4554
4565
  entryPath: string;
4555
- /** Whether watching should include all child entries recursively. It can be true for directories only. */
4566
+ /** The identifier of the file system related to this operation. */
4567
+ fileSystemId: string;
4568
+ /** Whether observing should include all child entries recursively. It can be true for directories only. */
4556
4569
  recursive: boolean;
4557
- /** Optional. Tag used by the last notification for the watcher. */
4558
- lastTag?: string | undefined;
4570
+ /** The unique identifier of this request. */
4571
+ requestId: number;
4559
4572
  }
4560
4573
 
4561
- export interface CloudIdentifier {
4562
- /** Identifier for the cloud storage provider (e.g. 'drive.google.com'). */
4563
- providerName: string;
4564
- /** The provider's identifier for the given file/directory. */
4565
- id: string;
4574
+ export interface Change {
4575
+ /** The type of the change which happened to the entry. */
4576
+ changeType: `${ChangeType}`;
4577
+ /**
4578
+ * Information relating to the file if backed by a cloud file system.
4579
+ * @since Chrome 125
4580
+ */
4581
+ cloudFileInfo?: CloudFileInfo;
4582
+ /** The path of the changed entry. */
4583
+ entryPath: string;
4566
4584
  }
4567
4585
 
4568
- export interface CloudFileInfo {
4569
- /** A tag that represents the version of the file. */
4570
- versionTag?: string | undefined;
4586
+ /** Type of a change detected on the observed directory. */
4587
+ export enum ChangeType {
4588
+ CHANGED = "CHANGED",
4589
+ DELETED = "DELETED",
4571
4590
  }
4572
4591
 
4573
- export interface EntryMetadata {
4574
- /** True if it is a directory. Must be provided if requested in `options`. */
4575
- isDirectory?: boolean;
4576
- /** Name of this entry (not full path name). Must not contain '/'. For root it must be empty. Must be provided if requested in `options`. */
4577
- name?: string;
4578
- /** File size in bytes. Must be provided if requested in `options`. */
4579
- size?: number;
4592
+ export interface CloseFileRequestedOptions {
4593
+ /** The identifier of the file system related to this operation. */
4594
+ fileSystemId: string;
4595
+ /** A request ID used to open the file. */
4596
+ openRequestId: number;
4597
+ /** The unique identifier of this request. */
4598
+ requestId: number;
4599
+ }
4600
+
4601
+ /** @since Chrome 125 */
4602
+ export interface CloudFileInfo {
4603
+ /** A tag that represents the version of the file. */
4604
+ versionTag?: string;
4605
+ }
4606
+
4607
+ /** @since Chrome 117 */
4608
+ export interface CloudIdentifier {
4609
+ /** The provider's identifier for the given file/directory. */
4610
+ id: string;
4611
+ /** Identifier for the cloud storage provider (e.g. 'drive.google.com'). */
4612
+ providerName: string;
4613
+ }
4614
+
4615
+ /**
4616
+ * List of common actions. `"SHARE"` is for sharing files with others. `"SAVE_FOR_OFFLINE"` for pinning (saving for offline access). `"OFFLINE_NOT_NECESSARY"` for notifying that the file doesn't need to be stored for offline access anymore. Used by {@link onGetActionsRequested} and {@link onExecuteActionRequested}.
4617
+ * @since Chrome 45
4618
+ */
4619
+ export enum CommonActionId {
4620
+ SAVE_FOR_OFFLINE = "SAVE_FOR_OFFLINE",
4621
+ OFFLINE_NOT_NECESSARY = "OFFLINE_NOT_NECESSARY",
4622
+ SHARE = "SHARE",
4623
+ }
4624
+
4625
+ /** @since Chrome 44 */
4626
+ export interface ConfigureRequestedOptions {
4627
+ /** The identifier of the file system to be configured. */
4628
+ fileSystemId: string;
4629
+ /** The unique identifier of this request. */
4630
+ requestId: number;
4631
+ }
4632
+
4633
+ export interface CopyEntryRequestedOptions {
4634
+ /** The identifier of the file system related to this operation. */
4635
+ fileSystemId: string;
4636
+ /** The unique identifier of this request. */
4637
+ requestId: number;
4638
+ /** The source path of the entry to be copied. */
4639
+ sourcePath: string;
4640
+ /** The destination path for the copy operation. */
4641
+ targetPath: string;
4642
+ }
4643
+
4644
+ export interface CreateDirectoryRequestedOptions {
4645
+ /** The path of the directory to be created. */
4646
+ directoryPath: string;
4647
+ /** The identifier of the file system related to this operation. */
4648
+ fileSystemId: string;
4649
+ /** Whether the operation is recursive (for directories only). */
4650
+ recursive: boolean;
4651
+ /** The unique identifier of this request. */
4652
+ requestId: number;
4653
+ }
4654
+
4655
+ export interface CreateFileRequestedOptions {
4656
+ /** The path of the file to be created. */
4657
+ filePath: string;
4658
+ /** The identifier of the file system related to this operation. */
4659
+ fileSystemId: string;
4660
+ /** The unique identifier of this request. */
4661
+ requestId: number;
4662
+ }
4663
+
4664
+ export interface DeleteEntryRequestedOptions {
4665
+ /** The path of the entry to be deleted. */
4666
+ entryPath: string;
4667
+ /** The identifier of the file system related to this operation. */
4668
+ fileSystemId: string;
4669
+ /** Whether the operation is recursive (for directories only). */
4670
+ recursive: boolean;
4671
+ /** The unique identifier of this request. */
4672
+ requestId: number;
4673
+ }
4674
+
4675
+ export interface EntryMetadata {
4676
+ /**
4677
+ * Information that identifies a specific file in the underlying cloud file system. Must be provided if requested in `options` and the file is backed by cloud storage.
4678
+ * @since Chrome 125
4679
+ */
4680
+ cloudFileInfo?: CloudFileInfo;
4681
+ /**
4682
+ * Cloud storage representation of this entry. Must be provided if requested in `options` and the file is backed by cloud storage. For local files not backed by cloud storage, it should be undefined when requested.
4683
+ * @since Chrome 117
4684
+ */
4685
+ cloudIdentifier?: CloudIdentifier;
4686
+ /** True if it is a directory. Must be provided if requested in `options`. */
4687
+ isDirectory?: boolean;
4688
+ /** Mime type for the entry. Always optional, but should be provided if requested in `options`. */
4689
+ mimeType?: string;
4580
4690
  /** The last modified time of this entry. Must be provided if requested in `options`. */
4581
4691
  modificationTime?: Date;
4582
- /** Optional. Mime type for the entry. Always optional, but should provided if requested in `options`. */
4583
- mimeType?: string | undefined;
4584
- /** Optional. Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most 32 KB in size. Optional, but can be provided only when explicitly requested by the onGetMetadataRequested event. */
4585
- thumbnail?: string | undefined;
4586
- /** Optional. Cloud storage representation of this entry. Must be provided if requested in `options` and the file is backed by cloud storage. For local files not backed by cloud storage, it should be undefined when requested. */
4587
- cloudIdentifier?: CloudIdentifier | undefined;
4588
- /** Optional. Information that identifies a specific file in the underlying cloud file system. Must be provided if requested in `options` and the file is backed by cloud storage. */
4589
- cloudFileInfo?: CloudFileInfo | undefined;
4692
+ /** Name of this entry (not full path name). Must not contain '/'. For root it must be empty. Must be provided if requested in `options`. */
4693
+ name?: string;
4694
+ /** File size in bytes. Must be provided if requested in `options`. */
4695
+ size?: number;
4696
+ /** Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most 32 KB in size. Optional, but can be provided only when explicitly requested by the {@link onGetMetadataRequested} event. */
4697
+ thumbnail?: string;
4590
4698
  }
4591
4699
 
4592
- export interface FileSystemInfo {
4593
- /** The identifier of the file system. */
4700
+ /** @since Chrome 45 */
4701
+ export interface ExecuteActionRequestedOptions {
4702
+ /** The identifier of the action to be executed. */
4703
+ actionId: string;
4704
+ /**
4705
+ * The set of paths of the entries to be used for the action.
4706
+ * @since Chrome 47
4707
+ */
4708
+ entryPaths: string[];
4709
+ /** The identifier of the file system related to this operation. */
4594
4710
  fileSystemId: string;
4711
+ /** The unique identifier of this request. */
4712
+ requestId: number;
4713
+ }
4714
+
4715
+ export interface FileSystemInfo {
4595
4716
  /** A human-readable name for the file system. */
4596
4717
  displayName: string;
4597
- /** Whether the file system supports operations which may change contents of the file system (such as creating, deleting or writing to files). */
4598
- writable: boolean;
4599
- /**
4600
- * The maximum number of files that can be opened at once. If 0, then not limited.
4601
- * @since Chrome 42
4602
- */
4718
+ /** The identifier of the file system. */
4719
+ fileSystemId: string;
4720
+ /** List of currently opened files. */
4721
+ openedFiles: OpenedFile[];
4722
+ /** The maximum number of files that can be opened at once. If 0, then not limited. */
4603
4723
  openedFilesLimit: number;
4604
4724
  /**
4605
- * List of currently opened files.
4606
- * @since Chrome 42
4607
- */
4608
- openedFiles: OpenedFileInfo[];
4609
- /**
4610
- * Optional.
4611
- * Whether the file system supports the tag field for observing directories.
4725
+ * Whether the file system supports the `tag` field for observing directories.
4612
4726
  * @since Chrome 45
4613
4727
  */
4614
- supportsNotifyTag?: boolean | undefined;
4728
+ supportsNotifyTag?: boolean;
4615
4729
  /**
4616
4730
  * List of watchers.
4617
4731
  * @since Chrome 45
4618
4732
  */
4619
- watchers: FileWatchersInfo[];
4733
+ watchers: Watcher[];
4734
+ /** Whether the file system supports operations which may change contents of the file system (such as creating, deleting or writing to files). */
4735
+ writable: boolean;
4620
4736
  }
4621
4737
 
4622
4738
  /** @since Chrome 45 */
4623
4739
  export interface GetActionsRequestedOptions {
4740
+ /**
4741
+ * List of paths of entries for the list of actions.
4742
+ * @since Chrome 47
4743
+ */
4744
+ entryPaths: string[];
4624
4745
  /** The identifier of the file system related to this operation. */
4625
4746
  fileSystemId: string;
4626
4747
  /** The unique identifier of this request. */
4627
4748
  requestId: number;
4628
- /** List of paths of entries for the list of actions. */
4629
- entryPaths: string[];
4630
- }
4631
-
4632
- /** @since Chrome 45 */
4633
- export interface Action {
4634
- /** The identifier of the action. Any string or CommonActionId for common actions. */
4635
- id: string;
4636
- /** Optional. The title of the action. It may be ignored for common actions. */
4637
- title?: string | undefined;
4638
4749
  }
4639
4750
 
4640
- /** @since Chrome 45 */
4641
- export interface ExecuteActionRequestedOptions {
4751
+ export interface GetMetadataRequestedOptions {
4752
+ /**
4753
+ * Set to `true` if `cloudFileInfo` value is requested.
4754
+ * @since Chrome 125
4755
+ */
4756
+ cloudFileInfo: boolean;
4757
+ /**
4758
+ * Set to `true` if `cloudIdentifier` value is requested.
4759
+ * @since Chrome 117
4760
+ */
4761
+ cloudIdentifier: boolean;
4762
+ /** The path of the entry to fetch metadata about. */
4763
+ entryPath: string;
4642
4764
  /** The identifier of the file system related to this operation. */
4643
4765
  fileSystemId: string;
4766
+ /**
4767
+ * Set to `true` if `is_directory` value is requested.
4768
+ * @since Chrome 49
4769
+ */
4770
+ isDirectory: boolean;
4771
+ /**
4772
+ * Set to `true` if `mimeType` value is requested.
4773
+ * @since Chrome 49
4774
+ */
4775
+ mimeType: boolean;
4776
+ /**
4777
+ * Set to `true` if `modificationTime` value is requested.
4778
+ * @since Chrome 49
4779
+ */
4780
+ modificationTime: boolean;
4781
+ /**
4782
+ * Set to `true` if `name` value is requested.
4783
+ * @since Chrome 49
4784
+ */
4785
+ name: boolean;
4644
4786
  /** The unique identifier of this request. */
4645
4787
  requestId: number;
4646
- /** The set of paths of the entries to be used for the action. */
4647
- entryPaths: string[];
4648
- /** The identifier of the action to be executed. */
4649
- actionId: string;
4788
+ /**
4789
+ * Set to `true` if `size` value is requested.
4790
+ * @since Chrome 49
4791
+ */
4792
+ size: boolean;
4793
+ /** Set to `true` if `thumbnail` value is requested. */
4794
+ thumbnail: boolean;
4650
4795
  }
4651
4796
 
4652
4797
  export interface MountOptions {
4653
- /** The string identifier of the file system. Must be unique per each extension. */
4654
- fileSystemId: string;
4655
4798
  /** A human-readable name for the file system. */
4656
4799
  displayName: string;
4657
- /** Optional. Whether the file system supports operations which may change contents of the file system (such as creating, deleting or writing to files). */
4658
- writable?: boolean | undefined;
4800
+ /** The string identifier of the file system. Must be unique per each extension. */
4801
+ fileSystemId: string;
4802
+ /** The maximum number of files that can be opened at once. If not specified, or 0, then not limited. */
4803
+ openedFilesLimit?: number;
4659
4804
  /**
4660
- * Optional.
4661
- * The maximum number of files that can be opened at once. If not specified, or 0, then not limited.
4662
- * @since Chrome 41
4805
+ * Whether the framework should resume the file system at the next sign-in session. True by default.
4806
+ * @since Chrome 64
4663
4807
  */
4664
- openedFilesLimit?: number | undefined;
4808
+ persistent?: boolean;
4665
4809
  /**
4666
- * Optional.
4667
- * Whether the file system supports the tag field for observed directories.
4810
+ * Whether the file system supports the `tag` field for observed directories.
4668
4811
  * @since Chrome 45
4669
4812
  */
4670
- supportsNotifyTag?: boolean | undefined;
4813
+ supportsNotifyTag?: boolean;
4814
+ /** Whether the file system supports operations which may change contents of the file system (such as creating, deleting or writing to files). */
4815
+ writable?: boolean;
4671
4816
  }
4672
4817
 
4673
- export interface UnmountOptions {
4674
- /** The identifier of the file system to be unmounted. */
4818
+ export interface MoveEntryRequestedOptions {
4819
+ /** The identifier of the file system related to this operation. */
4675
4820
  fileSystemId: string;
4821
+ /** The unique identifier of this request. */
4822
+ requestId: number;
4823
+ /** The source path of the entry to be moved into a new place. */
4824
+ sourcePath: string;
4825
+ /** The destination path for the copy operation. */
4826
+ targetPath: string;
4676
4827
  }
4677
4828
 
4678
- export interface NotificationChange {
4679
- /** The path of the changed entry. */
4680
- entryPath: string;
4681
- /** The type of the change which happened to the entry. */
4682
- changeType: string;
4683
- /** Information relating to the file if backed by a cloud file system. */
4684
- cloudFileInfo?: CloudFileInfo | undefined;
4685
- }
4686
-
4687
- export interface NotificationOptions {
4829
+ export interface NotifyOptions {
4830
+ /** The type of the change which happened to the observed entry. If it is DELETED, then the observed entry will be automatically removed from the list of observed entries. */
4831
+ changeType: `${ChangeType}`;
4832
+ /** List of changes to entries within the observed directory (including the entry itself) */
4833
+ changes?: Change[];
4688
4834
  /** The identifier of the file system related to this change. */
4689
4835
  fileSystemId: string;
4690
4836
  /** The path of the observed entry. */
4691
4837
  observedPath: string;
4692
4838
  /** Mode of the observed entry. */
4693
4839
  recursive: boolean;
4694
- /** The type of the change which happened to the observed entry. If it is DELETED, then the observed entry will be automatically removed from the list of observed entries. */
4695
- changeType: string;
4696
- /** Optional. List of changes to entries within the observed directory (including the entry itself) */
4697
- changes?: NotificationChange[] | undefined;
4698
- /** Optional. Tag for the notification. Required if the file system was mounted with the supportsNotifyTag option. Note, that this flag is necessary to provide notifications about changes which changed even when the system was shutdown. */
4699
- tag?: string | undefined;
4840
+ /** Tag for the notification. Required if the file system was mounted with the `supportsNotifyTag` option. Note, that this flag is necessary to provide notifications about changes which changed even when the system was shutdown. */
4841
+ tag?: string;
4700
4842
  }
4701
4843
 
4702
- export interface RequestedEventOptions {
4703
- /** The identifier of the file system related to this operation. */
4704
- fileSystemId: string;
4705
- /** The unique identifier of this request. */
4706
- requestId: number;
4844
+ export interface OpenedFile {
4845
+ /** The path of the opened file. */
4846
+ filePath: string;
4847
+ /** Whether the file was opened for reading or writing. */
4848
+ mode: `${OpenFileMode}`;
4849
+ /** A request ID to be be used by consecutive read/write and close requests. */
4850
+ openRequestId: number;
4707
4851
  }
4708
4852
 
4709
- export interface EntryPathRequestedEventOptions extends RequestedEventOptions {
4710
- /** The path of the entry to which this operation is related to. */
4711
- entryPath: string;
4853
+ /** Mode of opening a file. Used by {@link onOpenFileRequested}. */
4854
+ export enum OpenFileMode {
4855
+ READ = "READ",
4856
+ WRITE = "WRITE",
4712
4857
  }
4713
4858
 
4714
- export interface MetadataRequestedEventOptions extends EntryPathRequestedEventOptions {
4715
- /** Set to true if `is_directory` value is requested. */
4716
- isDirectory: boolean;
4717
- /** Set to true if `name` value is requested. */
4718
- name: boolean;
4719
- /** Set to true if `size` value is requested. */
4720
- size: boolean;
4721
- /** Set to true if `modificationTime` value is requested. */
4722
- modificationTime: boolean;
4723
- /** Set to true if `mimeType` value is requested. */
4724
- mimeType: boolean;
4725
- /** Set to true if `thumbnail` is requested. */
4726
- thumbnail: boolean;
4727
- /** Set to true if `cloudIdentifier` is requested. */
4728
- cloudIdentifier: boolean;
4729
- /** Set to true if `cloudFileInfo` is requested. */
4730
- cloudFileInfo: boolean;
4859
+ export interface OpenFileRequestedOptions {
4860
+ /** The path of the file to be opened. */
4861
+ filePath: string;
4862
+ /** The identifier of the file system related to this operation. */
4863
+ fileSystemId: string;
4864
+ /** Whether the file will be used for reading or writing. */
4865
+ mode: `${OpenFileMode}`;
4866
+ /** A request ID which will be used by consecutive read/write and close requests. */
4867
+ requestId: number;
4731
4868
  }
4732
4869
 
4733
- export interface DirectoryPathRequestedEventOptions extends RequestedEventOptions {
4734
- /** The path of the directory which is to be operated on. */
4870
+ /** Error codes used by providing extensions in response to requests as well as in case of errors when calling methods of the API. For success, `"OK"` must be used.*/
4871
+ export enum ProviderError {
4872
+ OK = "OK",
4873
+ FAILED = "FAILED",
4874
+ IN_USE = "IN_USE",
4875
+ EXISTS = "EXISTS",
4876
+ NOT_FOUND = "NOT_FOUND",
4877
+ ACCESS_DENIED = "ACCESS_DENIED",
4878
+ TOO_MANY_OPENED = "TOO_MANY_OPENED",
4879
+ NO_MEMORY = "NO_MEMORY",
4880
+ NO_SPACE = "NO_SPACE",
4881
+ NOT_A_DIRECTORY = "NOT_A_DIRECTORY",
4882
+ INVALID_OPERATION = "INVALID_OPERATION",
4883
+ SECURITY = "SECURITY",
4884
+ ABORT = "ABORT",
4885
+ NOT_A_FILE = "NOT_A_FILE",
4886
+ NOT_EMPTY = "NOT_EMPTY",
4887
+ INVALID_URL = "INVALID_URL",
4888
+ IO = "IO",
4889
+ }
4890
+
4891
+ export interface ReadDirectoryRequestedOptions {
4892
+ /** The path of the directory which contents are requested. */
4735
4893
  directoryPath: string;
4736
- /** Set to true if `is_directory` value is requested. */
4894
+ /** The identifier of the file system related to this operation. */
4895
+ fileSystemId: string;
4896
+ /**
4897
+ * Set to `true` if `is_directory` value is requested.
4898
+ * @since Chrome 49
4899
+ */
4737
4900
  isDirectory: boolean;
4738
- /** Set to true if `name` value is requested. */
4901
+ /**
4902
+ * Set to `true` if `mimeType` value is requested.
4903
+ * @since Chrome 49
4904
+ */
4905
+ mimeType: boolean;
4906
+ /**
4907
+ * Set to `true` if `modificationTime` value is requested.
4908
+ * @since Chrome 49
4909
+ */
4910
+ modificationTime: boolean;
4911
+ /**
4912
+ * Set to `true` if `name` value is requested.
4913
+ * @since Chrome 49
4914
+ */
4739
4915
  name: boolean;
4740
- /** Set to true if `size` value is requested. */
4916
+ /** The unique identifier of this request. */
4917
+ requestId: number;
4918
+ /**
4919
+ * Set to `true` if `size` value is requested.
4920
+ * @since Chrome 49
4921
+ */
4741
4922
  size: boolean;
4742
- /** Set to true if `modificationTime` value is requested. */
4743
- modificationTime: boolean;
4744
- /** Set to true if `mimeType` value is requested. */
4745
- mimeType: boolean;
4746
- /** Set to true if `thumbnail` is requested. */
4923
+ /**
4924
+ * Set to `true` if `thumbnail` value is requested.
4925
+ * @since Chrome 49
4926
+ */
4747
4927
  thumbnail: boolean;
4748
4928
  }
4749
4929
 
4750
- export interface FilePathRequestedEventOptions extends RequestedEventOptions {
4751
- /** The path of the entry for the operation */
4752
- filePath: string;
4753
- }
4754
-
4755
- export interface OpenFileRequestedEventOptions extends FilePathRequestedEventOptions {
4756
- /** Whether the file will be used for reading or writing. */
4757
- mode: string;
4758
- }
4759
-
4760
- export interface OpenedFileRequestedEventOptions extends RequestedEventOptions {
4761
- /** A request ID used to open the file. */
4762
- openRequestId: number;
4763
- }
4764
-
4765
- export interface OpenedFileOffsetRequestedEventOptions extends OpenedFileRequestedEventOptions {
4766
- /** Position in the file (in bytes) to start reading from. */
4767
- offset: number;
4930
+ export interface ReadFileRequestedOptions {
4931
+ /** The identifier of the file system related to this operation. */
4932
+ fileSystemId: string;
4768
4933
  /** Number of bytes to be returned. */
4769
4934
  length: number;
4935
+ /** Position in the file (in bytes) to start reading from. */
4936
+ offset: number;
4937
+ /** A request ID used to open the file. */
4938
+ openRequestId: number;
4939
+ /** The unique identifier of this request. */
4940
+ requestId: number;
4770
4941
  }
4771
4942
 
4772
- export interface CreateDirectoryRequestedEventOptions extends RequestedEventOptions {
4773
- /** The path of the directory to be created. */
4774
- directoryPath: string;
4775
-
4776
- /** Whether the operation is recursive (for directories only). */
4777
- recursive: boolean;
4778
- }
4779
-
4780
- export interface EntryPathRecursiveRequestedEventOptions extends EntryPathRequestedEventOptions {
4781
- /** Whether the operation is recursive (for directories only). */
4943
+ export interface RemoveWatcherRequestedOptions {
4944
+ /** The path of the watched entry. */
4945
+ entryPath: string;
4946
+ /** The identifier of the file system related to this operation. */
4947
+ fileSystemId: string;
4948
+ /** Mode of the watcher. */
4782
4949
  recursive: boolean;
4950
+ /** The unique identifier of this request. */
4951
+ requestId: number;
4783
4952
  }
4784
4953
 
4785
- export interface SourceTargetPathRequestedEventOptions extends RequestedEventOptions {
4786
- /** The source path for the operation. */
4787
- sourcePath: string;
4788
- /** The destination path for the operation. */
4789
- targetPath: string;
4790
- }
4791
-
4792
- export interface FilePathLengthRequestedEventOptions extends FilePathRequestedEventOptions {
4954
+ export interface TruncateRequestedOptions {
4955
+ /** The path of the file to be truncated. */
4956
+ filePath: string;
4957
+ /** The identifier of the file system related to this operation. */
4958
+ fileSystemId: string;
4793
4959
  /** Number of bytes to be retained after the operation completes. */
4794
4960
  length: number;
4961
+ /** The unique identifier of this request. */
4962
+ requestId: number;
4795
4963
  }
4796
4964
 
4797
- export interface OpenedFileIoRequestedEventOptions extends OpenedFileRequestedEventOptions {
4798
- /** Position in the file (in bytes) to start operating from. */
4799
- offset: number;
4800
- /** Buffer of bytes to be operated on the file. */
4801
- data: ArrayBuffer;
4965
+ export interface UnmountOptions {
4966
+ /** The identifier of the file system to be unmounted. */
4967
+ fileSystemId: string;
4802
4968
  }
4803
4969
 
4804
- export interface OperationRequestedEventOptions extends RequestedEventOptions {
4805
- /** An ID of the request to which this operation is related. */
4806
- operationRequestId: number;
4970
+ export interface UnmountRequestedOptions {
4971
+ /** The identifier of the file system to be unmounted. */
4972
+ fileSystemId: string;
4973
+ /** The unique identifier of this request. */
4974
+ requestId: number;
4807
4975
  }
4808
4976
 
4809
- export interface RequestedEvent extends
4810
- chrome.events.Event<
4811
- (
4812
- options: RequestedEventOptions,
4813
- successCallback: Function,
4814
- errorCallback: (error: string) => void,
4815
- ) => void
4816
- >
4817
- {}
4818
-
4819
- export interface MetadataRequestedEvent extends
4820
- chrome.events.Event<
4821
- (
4822
- options: MetadataRequestedEventOptions,
4823
- successCallback: (metadata: EntryMetadata) => void,
4824
- errorCallback: (error: string) => void,
4825
- ) => void
4826
- >
4827
- {}
4828
-
4829
- export interface DirectoryPathRequestedEvent extends
4830
- chrome.events.Event<
4831
- (
4832
- options: DirectoryPathRequestedEventOptions,
4833
- successCallback: (entries: EntryMetadata[], hasMore: boolean) => void,
4834
- errorCallback: (error: string) => void,
4835
- ) => void
4836
- >
4837
- {}
4838
-
4839
- export interface OpenFileRequestedEvent extends
4840
- chrome.events.Event<
4841
- (
4842
- options: OpenFileRequestedEventOptions,
4843
- successCallback: (metadata?: EntryMetadata) => void,
4844
- errorCallback: (error: string) => void,
4845
- ) => void
4846
- >
4847
- {}
4848
-
4849
- export interface OpenedFileRequestedEvent extends
4850
- chrome.events.Event<
4851
- (
4852
- options: OpenedFileRequestedEventOptions,
4853
- successCallback: Function,
4854
- errorCallback: (error: string) => void,
4855
- ) => void
4856
- >
4857
- {}
4858
-
4859
- export interface OpenedFileOffsetRequestedEvent extends
4860
- chrome.events.Event<
4861
- (
4862
- options: OpenedFileOffsetRequestedEventOptions,
4863
- successCallback: (data: ArrayBuffer, hasMore: boolean) => void,
4864
- errorCallback: (error: string) => void,
4865
- ) => void
4866
- >
4867
- {}
4868
-
4869
- export interface CreateDirectoryRequestedEvent extends
4870
- chrome.events.Event<
4871
- (
4872
- options: CreateDirectoryRequestedEventOptions,
4873
- successCallback: Function,
4874
- errorCallback: (error: string) => void,
4875
- ) => void
4876
- >
4877
- {}
4878
-
4879
- export interface EntryPathRecursiveRequestedEvent extends
4880
- chrome.events.Event<
4881
- (
4882
- options: EntryPathRecursiveRequestedEventOptions,
4883
- successCallback: Function,
4884
- errorCallback: (error: string) => void,
4885
- ) => void
4886
- >
4887
- {}
4888
-
4889
- export interface FilePathRequestedEvent extends
4890
- chrome.events.Event<
4891
- (
4892
- options: FilePathRequestedEventOptions,
4893
- successCallback: Function,
4894
- errorCallback: (error: string) => void,
4895
- ) => void
4896
- >
4897
- {}
4898
-
4899
- export interface SourceTargetPathRequestedEvent extends
4900
- chrome.events.Event<
4901
- (
4902
- options: SourceTargetPathRequestedEventOptions,
4903
- successCallback: Function,
4904
- errorCallback: (error: string) => void,
4905
- ) => void
4906
- >
4907
- {}
4908
-
4909
- export interface FilePathLengthRequestedEvent extends
4910
- chrome.events.Event<
4911
- (
4912
- options: FilePathLengthRequestedEventOptions,
4913
- successCallback: Function,
4914
- errorCallback: (error: string) => void,
4915
- ) => void
4916
- >
4917
- {}
4918
-
4919
- export interface OpenedFileIoRequestedEvent extends
4920
- chrome.events.Event<
4921
- (
4922
- options: OpenedFileIoRequestedEventOptions,
4923
- successCallback: Function,
4924
- errorCallback: (error: string) => void,
4925
- ) => void
4926
- >
4927
- {}
4928
-
4929
- export interface OperationRequestedEvent extends
4930
- chrome.events.Event<
4931
- (
4932
- options: OperationRequestedEventOptions,
4933
- successCallback: Function,
4934
- errorCallback: (error: string) => void,
4935
- ) => void
4936
- >
4937
- {}
4938
-
4939
- export interface OptionlessRequestedEvent
4940
- extends chrome.events.Event<(successCallback: Function, errorCallback: (error: string) => void) => void>
4941
- {}
4942
-
4943
- export interface GetActionsRequested extends
4944
- chrome.events.Event<
4945
- (
4946
- options: GetActionsRequestedOptions,
4947
- successCallback: (actions: Action[]) => void,
4948
- errorCallback: (error: string) => void,
4949
- ) => void
4950
- >
4951
- {}
4977
+ export interface Watcher {
4978
+ /** The path of the entry being observed. */
4979
+ entryPath: string;
4980
+ /** Tag used by the last notification for the watcher. */
4981
+ lastTag?: string;
4982
+ /** Whether watching should include all child entries recursively. It can be true for directories only. */
4983
+ recursive: boolean;
4984
+ }
4952
4985
 
4953
- export interface ExecuteActionRequested extends
4954
- chrome.events.Event<
4955
- (
4956
- options: ExecuteActionRequestedOptions,
4957
- successCallback: () => void,
4958
- errorCallback: (error: string) => void,
4959
- ) => void
4960
- >
4961
- {}
4986
+ export interface WriteFileRequestedOptions {
4987
+ /** Buffer of bytes to be written to the file. */
4988
+ data: ArrayBuffer;
4989
+ /** The identifier of the file system related to this operation. */
4990
+ fileSystemId: string;
4991
+ /** Position in the file (in bytes) to start writing the bytes from. */
4992
+ offset: number;
4993
+ /** A request ID used to open the file. */
4994
+ openRequestId: number;
4995
+ /** The unique identifier of this request. */
4996
+ requestId: number;
4997
+ }
4962
4998
 
4963
4999
  /**
4964
- * Mounts a file system with the given fileSystemId and displayName. displayName will be shown in the left panel of Files.app. displayName can contain any characters including '/', but cannot be an empty string. displayName must be descriptive but doesn't have to be unique. The fileSystemId must not be an empty string.
4965
- * Depending on the type of the file system being mounted, the source option must be set appropriately.
4966
- * In case of an error, runtime.lastError will be set with a corresponding error code.
4967
- * @param callback A generic result callback to indicate success or failure.
4968
- */
4969
- export function mount(options: MountOptions, callback?: () => void): void;
4970
- /**
4971
- * Unmounts a file system with the given fileSystemId. It must be called after onUnmountRequested is invoked. Also, the providing extension can decide to perform unmounting if not requested (eg. in case of lost connection, or a file error).
4972
- * In case of an error, runtime.lastError will be set with a corresponding error code.
4973
- * @param callback A generic result callback to indicate success or failure.
5000
+ * Returns information about a file system with the passed `fileSystemId`.
5001
+ *
5002
+ * Can return its result via Promise since Chrome 96.
4974
5003
  */
4975
- export function unmount(options: UnmountOptions, callback?: () => void): void;
5004
+ export function get(fileSystemId: string): Promise<FileSystemInfo>;
5005
+ export function get(fileSystemId: string, callback: (fileSystem: FileSystemInfo) => void): void;
5006
+
4976
5007
  /**
4977
5008
  * Returns all file systems mounted by the extension.
4978
- * @param callback Callback to receive the result of getAll function.
5009
+ *
5010
+ * Can return its result via Promise since Chrome 96.
4979
5011
  */
5012
+ export function getAll(): Promise<FileSystemInfo[]>;
4980
5013
  export function getAll(callback: (fileSystems: FileSystemInfo[]) => void): void;
5014
+
4981
5015
  /**
4982
- * Returns information about a file system with the passed fileSystemId.
4983
- * @since Chrome 42
4984
- * @param callback Callback to receive the result of get function.
5016
+ * Mounts a file system with the given `fileSystemId` and `displayName`. `displayName` will be shown in the left panel of the Files app. `displayName` can contain any characters including '/', but cannot be an empty string. `displayName` must be descriptive but doesn't have to be unique. The `fileSystemId` must not be an empty string.
5017
+ *
5018
+ * Depending on the type of the file system being mounted, the `source` option must be set appropriately.
5019
+ *
5020
+ * In case of an error, {@link runtime.lastError} will be set with a corresponding error code.
5021
+ *
5022
+ * Can return its result via Promise since Chrome 96.
4985
5023
  */
4986
- export function get(fileSystemId: string, callback: (fileSystem: FileSystemInfo) => void): void;
5024
+ export function mount(options: MountOptions): Promise<void>;
5025
+ export function mount(options: MountOptions, callback: () => void): void;
5026
+
4987
5027
  /**
4988
- * Notifies about changes in the watched directory at observedPath in recursive mode. If the file system is mounted with supportsNofityTag, then tag must be provided, and all changes since the last notification always reported, even if the system was shutdown. The last tag can be obtained with getAll.
4989
- * To use, the file_system_provider.notify manifest option must be set to true.
4990
- * Value of tag can be any string which is unique per call, so it's possible to identify the last registered notification. Eg. if the providing extension starts after a reboot, and the last registered notification's tag is equal to "123", then it should call notify for all changes which happened since the change tagged as "123". It cannot be an empty string.
5028
+ * Notifies about changes in the watched directory at `observedPath` in `recursive` mode. If the file system is mounted with `supportsNotifyTag`, then `tag` must be provided, and all changes since the last notification always reported, even if the system was shutdown. The last tag can be obtained with {@link getAll}.
5029
+ *
5030
+ * To use, the `file_system_provider.notify` manifest option must be set to true.
5031
+ *
5032
+ * Value of `tag` can be any string which is unique per call, so it's possible to identify the last registered notification. Eg. if the providing extension starts after a reboot, and the last registered notification's tag is equal to "123", then it should call {@link notify} for all changes which happened since the change tagged as "123". It cannot be an empty string.
5033
+ *
4991
5034
  * Not all providers are able to provide a tag, but if the file system has a changelog, then the tag can be eg. a change number, or a revision number.
5035
+ *
4992
5036
  * Note that if a parent directory is removed, then all descendant entries are also removed, and if they are watched, then the API must be notified about the fact. Also, if a directory is renamed, then all descendant entries are in fact removed, as there is no entry under their original paths anymore.
4993
- * In case of an error, runtime.lastError will be set will a corresponding error code.
4994
- * @param callback A generic result callback to indicate success or failure.
4995
- */
4996
- export function notify(options: NotificationOptions, callback: () => void): void;
4997
-
4998
- /** Raised when unmounting for the file system with the fileSystemId identifier is requested. In the response, the unmount API method must be called together with successCallback. If unmounting is not possible (eg. due to a pending operation), then errorCallback must be called. */
4999
- export var onUnmountRequested: RequestedEvent;
5000
- /** Raised when metadata of a file or a directory at entryPath is requested. The metadata must be returned with the successCallback call. In case of an error, errorCallback must be called. */
5001
- export var onGetMetadataRequested: MetadataRequestedEvent;
5002
- /** Raised when contents of a directory at directoryPath are requested. The results must be returned in chunks by calling the successCallback several times. In case of an error, errorCallback must be called. */
5003
- export var onReadDirectoryRequested: DirectoryPathRequestedEvent;
5004
- /** Raised when opening a file at filePath is requested. If the file does not exist, then the operation must fail. Maximum number of files opened at once can be specified with MountOptions. */
5005
- export var onOpenFileRequested: OpenFileRequestedEvent;
5006
- /** Raised when opening a file previously opened with openRequestId is requested to be closed. */
5007
- export var onCloseFileRequested: OpenedFileRequestedEvent;
5008
- /** Raised when reading contents of a file opened previously with openRequestId is requested. The results must be returned in chunks by calling successCallback several times. In case of an error, errorCallback must be called. */
5009
- export var onReadFileRequested: OpenedFileOffsetRequestedEvent;
5010
- /** Raised when creating a directory is requested. The operation must fail with the EXISTS error if the target directory already exists. If recursive is true, then all of the missing directories on the directory path must be created. */
5011
- export var onCreateDirectoryRequested: CreateDirectoryRequestedEvent;
5012
- /** Raised when deleting an entry is requested. If recursive is true, and the entry is a directory, then all of the entries inside must be recursively deleted as well. */
5013
- export var onDeleteEntryRequested: EntryPathRecursiveRequestedEvent;
5014
- /** Raised when creating a file is requested. If the file already exists, then errorCallback must be called with the "EXISTS" error code. */
5015
- export var onCreateFileRequested: FilePathRequestedEvent;
5016
- /** Raised when copying an entry (recursively if a directory) is requested. If an error occurs, then errorCallback must be called. */
5017
- export var onCopyEntryRequested: SourceTargetPathRequestedEvent;
5018
- /** Raised when moving an entry (recursively if a directory) is requested. If an error occurs, then errorCallback must be called. */
5019
- export var onMoveEntryRequested: SourceTargetPathRequestedEvent;
5020
- /** Raised when truncating a file to a desired length is requested. If an error occurs, then errorCallback must be called. */
5021
- export var onTruncateRequested: FilePathLengthRequestedEvent;
5022
- /** Raised when writing contents to a file opened previously with openRequestId is requested. */
5023
- export var onWriteFileRequested: OpenedFileIoRequestedEvent;
5024
- /** Raised when aborting an operation with operationRequestId is requested. The operation executed with operationRequestId must be immediately stopped and successCallback of this abort request executed. If aborting fails, then errorCallback must be called. Note, that callbacks of the aborted operation must not be called, as they will be ignored. Despite calling errorCallback, the request may be forcibly aborted. */
5025
- export var onAbortRequested: OperationRequestedEvent;
5026
- /**
5027
- * Raised when showing a configuration dialog for fileSystemId is requested. If it's handled, the file_system_provider.configurable manfiest option must be set to true.
5028
- * @since Chrome 44
5037
+ *
5038
+ * In case of an error, {@link runtime.lastError} will be set will a corresponding error code.
5039
+ *
5040
+ * Can return its result via Promise since Chrome 96.
5041
+ * @since Chrome 45
5029
5042
  */
5030
- export var onConfigureRequested: RequestedEvent;
5043
+ export function notify(options: NotifyOptions): Promise<void>;
5044
+ export function notify(options: NotifyOptions, callback: () => void): void;
5045
+
5031
5046
  /**
5032
- * Raised when showing a dialog for mounting a new file system is requested. If the extension/app is a file handler, then this event shouldn't be handled. Instead app.runtime.onLaunched should be handled in order to mount new file systems when a file is opened. For multiple mounts, the file_system_provider.multiple_mounts manifest option must be set to true.
5033
- * @since Chrome 44
5047
+ * Unmounts a file system with the given `fileSystemId`. It must be called after {@link onUnmountRequested} is invoked. Also, the providing extension can decide to perform unmounting if not requested (eg. in case of lost connection, or a file error).
5048
+ *
5049
+ * In case of an error, {@link runtime.lastError} will be set with a corresponding error code.
5050
+ *
5051
+ * Can return its result via Promise since Chrome 96.
5034
5052
  */
5035
- export var onMountRequested: OptionlessRequestedEvent;
5053
+ export function unmount(options: UnmountOptions): Promise<void>;
5054
+ export function unmount(options: UnmountOptions, callback: () => void): void;
5055
+
5056
+ /** Raised when aborting an operation with `operationRequestId` is requested. The operation executed with `operationRequestId` must be immediately stopped and `successCallback` of this abort request executed. If aborting fails, then `errorCallback` must be called. Note, that callbacks of the aborted operation must not be called, as they will be ignored. Despite calling `errorCallback`, the request may be forcibly aborted. */
5057
+ export const onAbortRequested: events.Event<
5058
+ (
5059
+ options: AbortRequestedOptions,
5060
+ successCallback: () => void,
5061
+ errorCallback: (error: `${ProviderError}`) => void,
5062
+ ) => void
5063
+ >;
5064
+
5036
5065
  /**
5037
- * Raised when setting a new directory watcher is requested. If an error occurs, then errorCallback must be called.
5066
+ * Raised when setting a new directory watcher is requested. If an error occurs, then `errorCallback` must be called.
5038
5067
  * @since Chrome 45
5039
5068
  */
5040
- export var onAddWatcherRequested: EntryPathRecursiveRequestedEvent;
5069
+ export const onAddWatcherRequested: events.Event<
5070
+ (
5071
+ options: AddWatcherRequestedOptions,
5072
+ successCallback: () => void,
5073
+ errorCallback: (error: `${ProviderError}`) => void,
5074
+ ) => void
5075
+ >;
5076
+
5077
+ /** Raised when opening a file previously opened with `openRequestId` is requested to be closed.*/
5078
+ export const onCloseFileRequested: events.Event<
5079
+ (
5080
+ options: CloseFileRequestedOptions,
5081
+ successCallback: () => void,
5082
+ errorCallback: (error: `${ProviderError}`) => void,
5083
+ ) => void
5084
+ >;
5085
+
5041
5086
  /**
5042
- * Raised when the watcher should be removed. If an error occurs, then errorCallback must be called.
5043
- * @since Chrome 45
5087
+ * Raised when showing a configuration dialog for `fileSystemId` is requested. If it's handled, the `file_system_provider.configurable` manifest option must be set to true.
5088
+ * @since Chrome 44
5044
5089
  */
5045
- export var onRemoveWatcherRequested: EntryPathRecursiveRequestedEvent;
5090
+ export const onConfigureRequested: events.Event<
5091
+ (
5092
+ options: ConfigureRequestedOptions,
5093
+ successCallback: () => void,
5094
+ errorCallback: (error: `${ProviderError}`) => void,
5095
+ ) => void
5096
+ >;
5097
+
5098
+ /** Raised when copying an entry (recursively if a directory) is requested. If an error occurs, then `errorCallback` must be called. */
5099
+ export const onCopyEntryRequested: events.Event<
5100
+ (
5101
+ options: CopyEntryRequestedOptions,
5102
+ successCallback: () => void,
5103
+ errorCallback: (error: `${ProviderError}`) => void,
5104
+ ) => void
5105
+ >;
5106
+
5107
+ /** Raised when creating a directory is requested. The operation must fail with the EXISTS error if the target directory already exists. If `recursive` is true, then all of the missing directories on the directory path must be created. */
5108
+ export const onCreateDirectoryRequested: events.Event<
5109
+ (
5110
+ options: CreateDirectoryRequestedOptions,
5111
+ successCallback: () => void,
5112
+ errorCallback: (
5113
+ error: `${ProviderError}`,
5114
+ ) => void,
5115
+ ) => void
5116
+ >;
5117
+
5118
+ /** Raised when creating a file is requested. If the file already exists, then `errorCallback` must be called with the `"EXISTS"` error code. */
5119
+ export const onCreateFileRequested: events.Event<
5120
+ (
5121
+ options: CreateFileRequestedOptions,
5122
+ successCallback: () => void,
5123
+ errorCallback: (
5124
+ error: `${ProviderError}`,
5125
+ ) => void,
5126
+ ) => void
5127
+ >;
5128
+
5129
+ /** Raised when deleting an entry is requested. If `recursive` is true, and the entry is a directory, then all of the entries inside must be recursively deleted as well. */
5130
+ export const onDeleteEntryRequested: events.Event<
5131
+ (
5132
+ options: DeleteEntryRequestedOptions,
5133
+ successCallback: () => void,
5134
+ errorCallback: (
5135
+ error: `${ProviderError}`,
5136
+ ) => void,
5137
+ ) => void
5138
+ >;
5139
+
5140
+ /**
5141
+ * Raised when executing an action for a set of files or directories is\\ requested. After the action is completed, `successCallback` must be called. On error, `errorCallback` must be called.
5142
+ * @since Chrome 48
5143
+ */
5144
+ export const onExecuteActionRequested: events.Event<
5145
+ (
5146
+ options: ExecuteActionRequestedOptions,
5147
+ successCallback: () => void,
5148
+ errorCallback: (
5149
+ error: `${ProviderError}`,
5150
+ ) => void,
5151
+ ) => void
5152
+ >;
5153
+
5154
+ /**
5155
+ * Raised when a list of actions for a set of files or directories at `entryPaths` is requested. All of the returned actions must be applicable to each entry. If there are no such actions, an empty array should be returned. The actions must be returned with the `successCallback` call. In case of an error, `errorCallback` must be called.
5156
+ * @since Chrome 48
5157
+ */
5158
+ export const onGetActionsRequested: events.Event<
5159
+ (
5160
+ options: GetActionsRequestedOptions,
5161
+ successCallback: (
5162
+ actions: Action[],
5163
+ ) => void,
5164
+ errorCallback: (
5165
+ error: `${ProviderError}`,
5166
+ ) => void,
5167
+ ) => void
5168
+ >;
5169
+
5170
+ /** Raised when metadata of a file or a directory at `entryPath` is requested. The metadata must be returned with the `successCallback` call. In case of an error, `errorCallback` must be called. */
5171
+ export const onGetMetadataRequested: events.Event<
5172
+ (
5173
+ options: GetMetadataRequestedOptions,
5174
+ successCallback: (
5175
+ metadata: EntryMetadata,
5176
+ ) => void,
5177
+ errorCallback: (
5178
+ error: `${ProviderError}`,
5179
+ ) => void,
5180
+ ) => void
5181
+ >;
5046
5182
 
5047
5183
  /**
5048
- * Raised when a list of actions for a set of files or directories at
5049
- * `entryPaths` is requested. All of the returned actions must
5050
- * be applicable to each entry. If there are no such actions, an empty array
5051
- * should be returned. The actions must be returned with the
5052
- * `successCallback` call. In case of an error,
5053
- * `errorCallback` must be called.
5184
+ * Raised when showing a dialog for mounting a new file system is requested. If the extension/app is a file handler, then this event shouldn't be handled. Instead `app.runtime.onLaunched` should be handled in order to mount new file systems when a file is opened. For multiple mounts, the `file_system_provider.multiple_mounts` manifest option must be set to true.
5185
+ * @since Chrome 44
5054
5186
  */
5055
- export var onGetActionsRequested: GetActionsRequested;
5187
+ export const onMountRequested: events.Event<
5188
+ (
5189
+ successCallback: () => void,
5190
+ errorCallback: (
5191
+ error: `${ProviderError}`,
5192
+ ) => void,
5193
+ ) => void
5194
+ >;
5195
+
5196
+ /** Raised when moving an entry (recursively if a directory) is requested. If an error occurs, then `errorCallback` must be called. */
5197
+ export const onMoveEntryRequested: events.Event<
5198
+ (
5199
+ options: MoveEntryRequestedOptions,
5200
+ successCallback: () => void,
5201
+ errorCallback: (
5202
+ error: `${ProviderError}`,
5203
+ ) => void,
5204
+ ) => void
5205
+ >;
5206
+
5207
+ /** Raised when opening a file at `filePath` is requested. If the file does not exist, then the operation must fail. Maximum number of files opened at once can be specified with `MountOptions`. */
5208
+ export const onOpenFileRequested: events.Event<
5209
+ (
5210
+ options: OpenFileRequestedOptions,
5211
+ successCallback: (
5212
+ /**
5213
+ * @since Chrome 125
5214
+ */
5215
+ metadata?: EntryMetadata,
5216
+ ) => void,
5217
+ errorCallback: (
5218
+ error: `${ProviderError}`,
5219
+ ) => void,
5220
+ ) => void
5221
+ >;
5222
+
5223
+ /** Raised when contents of a directory at `directoryPath` are requested. The results must be returned in chunks by calling the `successCallback` several times. In case of an error, `errorCallback` must be called. */
5224
+ export const onReadDirectoryRequested: events.Event<
5225
+ (
5226
+ options: ReadDirectoryRequestedOptions,
5227
+ successCallback: (
5228
+ entries: EntryMetadata[],
5229
+ hasMore: boolean,
5230
+ ) => void,
5231
+ errorCallback: (
5232
+ error: `${ProviderError}`,
5233
+ ) => void,
5234
+ ) => void
5235
+ >;
5236
+
5237
+ /** Raised when reading contents of a file opened previously with `openRequestId` is requested. The results must be returned in chunks by calling `successCallback` several times. In case of an error, `errorCallback` must be called. */
5238
+ export const onReadFileRequested: events.Event<
5239
+ (
5240
+ options: ReadFileRequestedOptions,
5241
+ successCallback: (
5242
+ data: ArrayBuffer,
5243
+ hasMore: boolean,
5244
+ ) => void,
5245
+ errorCallback: (
5246
+ error: `${ProviderError}`,
5247
+ ) => void,
5248
+ ) => void
5249
+ >;
5056
5250
 
5057
5251
  /**
5058
- * Raised when executing an action for a set of files or directories is
5059
- * requested. After the action is completed, `successCallback`
5060
- * must be called. On error, `errorCallback` must be called.
5252
+ * Raised when the watcher should be removed. If an error occurs, then `errorCallback` must be called.
5253
+ * @since Chrome 45
5061
5254
  */
5062
- export var onExecuteActionRequested: ExecuteActionRequested;
5255
+ export const onRemoveWatcherRequested: events.Event<
5256
+ (
5257
+ options: RemoveWatcherRequestedOptions,
5258
+ successCallback: () => void,
5259
+ errorCallback: (
5260
+ error: `${ProviderError}`,
5261
+ ) => void,
5262
+ ) => void
5263
+ >;
5264
+
5265
+ /** Raised when truncating a file to a desired length is requested. If an error occurs, then `errorCallback` must be called. */
5266
+ export const onTruncateRequested: events.Event<
5267
+ (
5268
+ options: TruncateRequestedOptions,
5269
+ successCallback: () => void,
5270
+ errorCallback: (
5271
+ error: `${ProviderError}`,
5272
+ ) => void,
5273
+ ) => void
5274
+ >;
5275
+
5276
+ /** Raised when unmounting for the file system with the `fileSystemId` identifier is requested. In the response, the {@link unmount} API method must be called together with `successCallback`. If unmounting is not possible (eg. due to a pending operation), then `errorCallback` must be called. */
5277
+ export const onUnmountRequested: events.Event<
5278
+ (
5279
+ options: UnmountRequestedOptions,
5280
+ successCallback: () => void,
5281
+ errorCallback: (
5282
+ error: `${ProviderError}`,
5283
+ ) => void,
5284
+ ) => void
5285
+ >;
5286
+
5287
+ /** Raised when writing contents to a file opened previously with `openRequestId` is requested. */
5288
+ export const onWriteFileRequested: events.Event<
5289
+ (
5290
+ options: WriteFileRequestedOptions,
5291
+ successCallback: () => void,
5292
+ errorCallback: (
5293
+ error: `${ProviderError}`,
5294
+ ) => void,
5295
+ ) => void
5296
+ >;
5063
5297
  }
5064
5298
 
5065
5299
  ////////////////////