@types/chrome 0.0.327 → 0.0.329
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.
- chrome/README.md +1 -1
- chrome/index.d.ts +808 -956
- chrome/package.json +2 -2
chrome/index.d.ts
CHANGED
@@ -2553,52 +2553,9 @@ declare namespace chrome {
|
|
2553
2553
|
* Permissions: "declarativeContent"
|
2554
2554
|
*/
|
2555
2555
|
export namespace declarativeContent {
|
2556
|
-
export interface PageStateUrlDetails {
|
2557
|
-
/** Optional. Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name. */
|
2558
|
-
hostContains?: string | undefined;
|
2559
|
-
/** Optional. Matches if the host name of the URL is equal to a specified string. */
|
2560
|
-
hostEquals?: string | undefined;
|
2561
|
-
/** Optional. Matches if the host name of the URL starts with a specified string. */
|
2562
|
-
hostPrefix?: string | undefined;
|
2563
|
-
/** Optional. Matches if the host name of the URL ends with a specified string. */
|
2564
|
-
hostSuffix?: string | undefined;
|
2565
|
-
/** Optional. Matches if the path segment of the URL contains a specified string. */
|
2566
|
-
pathContains?: string | undefined;
|
2567
|
-
/** Optional. Matches if the path segment of the URL is equal to a specified string. */
|
2568
|
-
pathEquals?: string | undefined;
|
2569
|
-
/** Optional. Matches if the path segment of the URL starts with a specified string. */
|
2570
|
-
pathPrefix?: string | undefined;
|
2571
|
-
/** Optional. Matches if the path segment of the URL ends with a specified string. */
|
2572
|
-
pathSuffix?: string | undefined;
|
2573
|
-
/** Optional. Matches if the query segment of the URL contains a specified string. */
|
2574
|
-
queryContains?: string | undefined;
|
2575
|
-
/** Optional. Matches if the query segment of the URL is equal to a specified string. */
|
2576
|
-
queryEquals?: string | undefined;
|
2577
|
-
/** Optional. Matches if the query segment of the URL starts with a specified string. */
|
2578
|
-
queryPrefix?: string | undefined;
|
2579
|
-
/** Optional. Matches if the query segment of the URL ends with a specified string. */
|
2580
|
-
querySuffix?: string | undefined;
|
2581
|
-
/** Optional. Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
2582
|
-
urlContains?: string | undefined;
|
2583
|
-
/** Optional. Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
2584
|
-
urlEquals?: string | undefined;
|
2585
|
-
/** Optional. Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */
|
2586
|
-
urlMatches?: string | undefined;
|
2587
|
-
/** Optional. Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */
|
2588
|
-
originAndPathMatches?: string | undefined;
|
2589
|
-
/** Optional. Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
2590
|
-
urlPrefix?: string | undefined;
|
2591
|
-
/** Optional. Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
2592
|
-
urlSuffix?: string | undefined;
|
2593
|
-
/** Optional. Matches if the scheme of the URL is equal to any of the schemes specified in the array. */
|
2594
|
-
schemes?: string[] | undefined;
|
2595
|
-
/** Optional. Matches if the port of the URL is contained in any of the specified port lists. For example [80, 443, [1000, 1200]] matches all requests on port 80, 443 and in the range 1000-1200. */
|
2596
|
-
ports?: Array<number | number[]> | undefined;
|
2597
|
-
}
|
2598
|
-
|
2599
2556
|
export class PageStateMatcherProperties {
|
2600
2557
|
/** Optional. Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */
|
2601
|
-
pageUrl?:
|
2558
|
+
pageUrl?: events.UrlFilter | undefined;
|
2602
2559
|
/** Optional. Matches if all of the CSS selectors in the array match displayed elements in a frame with the same origin as the page's main frame. All selectors in this array must be compound selectors to speed up matching. Note that listing hundreds of CSS selectors or CSS selectors that match hundreds of times per page can still slow down web sites. */
|
2603
2560
|
css?: string[] | undefined;
|
2604
2561
|
/**
|
@@ -3719,58 +3676,70 @@ declare namespace chrome {
|
|
3719
3676
|
value: string;
|
3720
3677
|
}
|
3721
3678
|
|
3722
|
-
export
|
3679
|
+
export enum FilenameConflictAction {
|
3680
|
+
/** To avoid duplication, the filename is changed to include a counter before the filename extension. */
|
3681
|
+
UNIQUIFY = "uniquify",
|
3682
|
+
/** The existing file will be overwritten with the new file. */
|
3683
|
+
OVERWRITE = "overwrite",
|
3684
|
+
/** The user will be prompted with a file chooser dialog. */
|
3685
|
+
PROMPT = "prompt",
|
3686
|
+
}
|
3687
|
+
|
3688
|
+
export enum HttpMethod {
|
3689
|
+
GET = "GET",
|
3690
|
+
POST = "POST",
|
3691
|
+
}
|
3723
3692
|
|
3724
3693
|
export interface DownloadOptions {
|
3725
|
-
/**
|
3694
|
+
/** Post body. */
|
3726
3695
|
body?: string | undefined;
|
3727
|
-
/**
|
3696
|
+
/** Use a file-chooser to allow the user to select a filename regardless of whether `filename` is set or already exists. */
|
3728
3697
|
saveAs?: boolean | undefined;
|
3729
3698
|
/** The URL to download. */
|
3730
3699
|
url: string;
|
3731
|
-
/**
|
3700
|
+
/** A file path relative to the Downloads directory to contain the downloaded file, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will cause an error. {@link onDeterminingFilename} allows suggesting a filename after the file's MIME type and a tentative filename have been determined. */
|
3732
3701
|
filename?: string | undefined;
|
3733
|
-
/**
|
3702
|
+
/** Extra HTTP headers to send with the request if the URL uses the HTTP[s] protocol. Each header is represented as a dictionary containing the keys `name` and either `value` or `binaryValue`, restricted to those allowed by XMLHttpRequest. */
|
3734
3703
|
headers?: HeaderNameValuePair[] | undefined;
|
3735
|
-
/**
|
3736
|
-
method?:
|
3737
|
-
/**
|
3738
|
-
conflictAction?: FilenameConflictAction | undefined;
|
3704
|
+
/** The HTTP method to use if the URL uses the HTTP[S] protocol. */
|
3705
|
+
method?: `${HttpMethod}` | undefined;
|
3706
|
+
/** The action to take if `filename` already exists. */
|
3707
|
+
conflictAction?: `${FilenameConflictAction}` | undefined;
|
3739
3708
|
}
|
3740
3709
|
|
3741
3710
|
export interface DownloadDelta {
|
3742
|
-
/** The id of the DownloadItem that changed. */
|
3711
|
+
/** The id of the {@link DownloadItem} that changed. */
|
3743
3712
|
id: number;
|
3744
|
-
/**
|
3713
|
+
/** The change in `danger`, if any. */
|
3745
3714
|
danger?: StringDelta | undefined;
|
3746
|
-
/**
|
3715
|
+
/** The change in `url`, if any. */
|
3747
3716
|
url?: StringDelta | undefined;
|
3748
3717
|
/**
|
3749
|
-
*
|
3718
|
+
* The change in `finalUrl`, if any.
|
3750
3719
|
* @since Chrome 54
|
3751
3720
|
*/
|
3752
3721
|
finalUrl?: StringDelta | undefined;
|
3753
|
-
/**
|
3722
|
+
/** The change in `totalBytes`, if any. */
|
3754
3723
|
totalBytes?: DoubleDelta | undefined;
|
3755
|
-
/**
|
3724
|
+
/** The change in `filename`, if any. */
|
3756
3725
|
filename?: StringDelta | undefined;
|
3757
|
-
/**
|
3726
|
+
/** The change in `paused`, if any. */
|
3758
3727
|
paused?: BooleanDelta | undefined;
|
3759
|
-
/**
|
3728
|
+
/** The change in `state`, if any. */
|
3760
3729
|
state?: StringDelta | undefined;
|
3761
|
-
/**
|
3730
|
+
/** The change in `mime`, if any. */
|
3762
3731
|
mime?: StringDelta | undefined;
|
3763
|
-
/**
|
3732
|
+
/** The change in `fileSize`, if any. */
|
3764
3733
|
fileSize?: DoubleDelta | undefined;
|
3765
|
-
/**
|
3734
|
+
/** The change in `startTime`, if any. */
|
3766
3735
|
startTime?: StringDelta | undefined;
|
3767
|
-
/**
|
3736
|
+
/** The change in `error`, if any. */
|
3768
3737
|
error?: StringDelta | undefined;
|
3769
|
-
/**
|
3738
|
+
/** The change in `endTime`, if any. */
|
3770
3739
|
endTime?: StringDelta | undefined;
|
3771
|
-
/**
|
3740
|
+
/** The change in `canResume`, if any. */
|
3772
3741
|
canResume?: BooleanDelta | undefined;
|
3773
|
-
/**
|
3742
|
+
/** The change in `exists`, if any. */
|
3774
3743
|
exists?: BooleanDelta | undefined;
|
3775
3744
|
}
|
3776
3745
|
|
@@ -3779,7 +3748,6 @@ declare namespace chrome {
|
|
3779
3748
|
previous?: boolean | undefined;
|
3780
3749
|
}
|
3781
3750
|
|
3782
|
-
/** @since Chrome 34 */
|
3783
3751
|
export interface DoubleDelta {
|
3784
3752
|
current?: number | undefined;
|
3785
3753
|
previous?: number | undefined;
|
@@ -3790,46 +3758,85 @@ declare namespace chrome {
|
|
3790
3758
|
previous?: string | undefined;
|
3791
3759
|
}
|
3792
3760
|
|
3793
|
-
export
|
3794
|
-
|
3795
|
-
|
3796
|
-
|
3797
|
-
|
3798
|
-
|
3799
|
-
|
3800
|
-
|
3801
|
-
|
3802
|
-
|
3803
|
-
|
3804
|
-
|
3805
|
-
|
3806
|
-
|
3807
|
-
|
3808
|
-
|
3809
|
-
|
3810
|
-
|
3811
|
-
|
3812
|
-
|
3813
|
-
|
3814
|
-
|
3815
|
-
|
3816
|
-
|
3817
|
-
|
3818
|
-
|
3819
|
-
|
3820
|
-
|
3821
|
-
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
3825
|
-
|
3826
|
-
|
3761
|
+
export enum InterruptReason {
|
3762
|
+
FILE_FAILED = "FILE_FAILED",
|
3763
|
+
FILE_ACCESS_DENIED = "FILE_ACCESS_DENIED",
|
3764
|
+
FILE_NO_SPACE = "FILE_NO_SPACE",
|
3765
|
+
FILE_NAME_TOO_LONG = "FILE_NAME_TOO_LONG",
|
3766
|
+
FILE_TOO_LARGE = "FILE_TOO_LARGE",
|
3767
|
+
FILE_VIRUS_INFECTED = "FILE_VIRUS_INFECTED",
|
3768
|
+
FILE_TRANSIENT_ERROR = "FILE_TRANSIENT_ERROR",
|
3769
|
+
FILE_BLOCKED = "FILE_BLOCKED",
|
3770
|
+
FILE_SECURITY_CHECK_FAILED = "FILE_SECURITY_CHECK_FAILED",
|
3771
|
+
FILE_TOO_SHORT = "FILE_TOO_SHORT",
|
3772
|
+
FILE_HASH_MISMATCH = "FILE_HASH_MISMATCH",
|
3773
|
+
FILE_SAME_AS_SOURCE = "FILE_SAME_AS_SOURCE",
|
3774
|
+
NETWORK_FAILED = "NETWORK_FAILED",
|
3775
|
+
NETWORK_TIMEOUT = "NETWORK_TIMEOUT",
|
3776
|
+
NETWORK_DISCONNECTED = "NETWORK_DISCONNECTED",
|
3777
|
+
NETWORK_SERVER_DOWN = "NETWORK_SERVER_DOWN",
|
3778
|
+
NETWORK_INVALID_REQUEST = "NETWORK_INVALID_REQUEST",
|
3779
|
+
SERVER_FAILED = "SERVER_FAILED",
|
3780
|
+
SERVER_NO_RANGE = "SERVER_NO_RANGE",
|
3781
|
+
SERVER_BAD_CONTENT = "SERVER_BAD_CONTENT",
|
3782
|
+
SERVER_UNAUTHORIZED = "SERVER_UNAUTHORIZED",
|
3783
|
+
SERVER_CERT_PROBLEM = "SERVER_CERT_PROBLEM",
|
3784
|
+
SERVER_FORBIDDEN = "SERVER_FORBIDDEN",
|
3785
|
+
SERVER_UNREACHABLE = "SERVER_UNREACHABLE",
|
3786
|
+
SERVER_CONTENT_LENGTH_MISMATCH = "SERVER_CONTENT_LENGTH_MISMATCH",
|
3787
|
+
SERVER_CROSS_ORIGIN_REDIRECT = "SERVER_CROSS_ORIGIN_REDIRECT",
|
3788
|
+
USER_CANCELED = "USER_CANCELED",
|
3789
|
+
USER_SHUTDOWN = "USER_SHUTDOWN",
|
3790
|
+
CRASH = "CRASH",
|
3791
|
+
}
|
3792
|
+
|
3793
|
+
export enum State {
|
3794
|
+
/** The download is currently receiving data from the server. */
|
3795
|
+
IN_PROGRESS = "in_progress",
|
3796
|
+
/** An error broke the connection with the file host. */
|
3797
|
+
INTERRUPTED = "interrupted",
|
3798
|
+
/** The download completed successfully. */
|
3799
|
+
COMPLETE = "complete",
|
3800
|
+
}
|
3801
|
+
|
3802
|
+
export enum DangerType {
|
3803
|
+
/** The download's filename is suspicious. */
|
3804
|
+
FILE = "file",
|
3805
|
+
/** The download's URL is known to be malicious. */
|
3806
|
+
URL = "url",
|
3807
|
+
/** The downloaded file is known to be malicious. */
|
3808
|
+
CONTENT = "content",
|
3809
|
+
/** The download's URL is not commonly downloaded and could be dangerous. */
|
3810
|
+
UNCOMMON = "uncommon",
|
3811
|
+
/** The download came from a host known to distribute malicious binaries and is likely dangerous. */
|
3812
|
+
HOST = "host",
|
3813
|
+
/** The download is potentially unwanted or unsafe. E.g. it could make changes to browser or computer settings. */
|
3814
|
+
UNWANTED = "unwanted",
|
3815
|
+
/** The download presents no known danger to the user's computer. */
|
3816
|
+
SAFE = "safe",
|
3817
|
+
/** The user has accepted the dangerous download. */
|
3818
|
+
ACCEPTED = "accepted",
|
3819
|
+
ALLOWLISTED_BY_POLICY = "allowlistedByPolicy",
|
3820
|
+
ASYNC_SCANNING = "asyncScanning",
|
3821
|
+
ASYNC_LOCAL_PASSWORD_SCANNING = "asyncLocalPasswordScanning",
|
3822
|
+
PASSWORD_PROTECTED = "passwordProtected",
|
3823
|
+
BLOCKED_TOO_LARGE = "blockedTooLarge",
|
3824
|
+
SENSITIVE_CONTENT_WARNING = "sensitiveContentWarning",
|
3825
|
+
SENSITIVE_CONTENT_BLOCK = "sensitiveContentBlock",
|
3826
|
+
DEEP_SCANNED_FAILED = "deepScannedFailed",
|
3827
|
+
DEEP_SCANNED_SAFE = "deepScannedSafe",
|
3828
|
+
DEEP_SCANNED_OPENED_DANGEROUS = "deepScannedOpenedDangerous",
|
3829
|
+
PROMPT_FOR_SCANNING = "promptForScanning",
|
3830
|
+
PROMPT_FOR_LOCAL_PASSWORD_SCANNING = "promptForLocalPasswordScanning",
|
3831
|
+
ACCOUNT_COMPROMISE = "accountCompromise",
|
3832
|
+
BLOCKED_SCAN_FAILED = "blockedScanFailed",
|
3833
|
+
}
|
3827
3834
|
|
3828
3835
|
export interface DownloadItem {
|
3829
3836
|
/** Number of bytes received so far from the host, without considering file compression. */
|
3830
3837
|
bytesReceived: number;
|
3831
3838
|
/** Indication of whether this download is thought to be safe or known to be suspicious. */
|
3832
|
-
danger: DangerType
|
3839
|
+
danger: `${DangerType}`;
|
3833
3840
|
/** The absolute URL that this download initiated from, before any redirects. */
|
3834
3841
|
url: string;
|
3835
3842
|
/**
|
@@ -3844,16 +3851,16 @@ declare namespace chrome {
|
|
3844
3851
|
/** True if the download has stopped reading data from the host, but kept the connection open. */
|
3845
3852
|
paused: boolean;
|
3846
3853
|
/** Indicates whether the download is progressing, interrupted, or complete. */
|
3847
|
-
state:
|
3854
|
+
state: `${State}`;
|
3848
3855
|
/** The file's MIME type. */
|
3849
3856
|
mime: string;
|
3850
3857
|
/** Number of bytes in the whole file post-decompression, or -1 if unknown. */
|
3851
3858
|
fileSize: number;
|
3852
|
-
/** The time when the download began in ISO 8601 format. May be passed directly to the Date constructor: chrome.downloads.search({}, function(items){items.forEach(function(item){console.log(new Date(item.startTime))})}) */
|
3859
|
+
/** The time when the download began in ISO 8601 format. May be passed directly to the Date constructor: `chrome.downloads.search({}, function(items){items.forEach(function(item){console.log(new Date(item.startTime))})})` */
|
3853
3860
|
startTime: string;
|
3854
|
-
/**
|
3855
|
-
error?:
|
3856
|
-
/**
|
3861
|
+
/** Why the download was interrupted. Several kinds of HTTP errors may be grouped under one of the errors beginning with `SERVER_`. Errors relating to the network begin with `NETWORK_`, errors relating to the process of writing the file to the file system begin with `FILE_`, and interruptions initiated by the user begin with `USER_`. */
|
3862
|
+
error?: `${InterruptReason}` | undefined;
|
3863
|
+
/** The time when the download ended in ISO 8601 format. May be passed directly to the Date constructor: `chrome.downloads.search({}, function(items){items.forEach(function(item){if (item.endTime) console.log(new Date(item.endTime))})})` */
|
3857
3864
|
endTime?: string | undefined;
|
3858
3865
|
/** An identifier that is persistent across browser sessions. */
|
3859
3866
|
id: number;
|
@@ -3861,248 +3868,232 @@ declare namespace chrome {
|
|
3861
3868
|
incognito: boolean;
|
3862
3869
|
/** Absolute URL. */
|
3863
3870
|
referrer: string;
|
3864
|
-
/**
|
3871
|
+
/** Estimated time when the download will complete in ISO 8601 format. May be passed directly to the Date constructor: `chrome.downloads.search({}, function(items){items.forEach(function(item){if (item.estimatedEndTime) console.log(new Date(item.estimatedEndTime))})})` */
|
3865
3872
|
estimatedEndTime?: string | undefined;
|
3866
3873
|
/** True if the download is in progress and paused, or else if it is interrupted and can be resumed starting from where it was interrupted. */
|
3867
3874
|
canResume: boolean;
|
3868
|
-
/** Whether the downloaded file still exists. This information may be out of date because Chrome does not automatically watch for file removal. Call search() in order to trigger the check for file existence. When the existence check completes, if the file has been deleted, then an onChanged event will fire. Note that search() does not wait for the existence check to finish before returning, so results from search() may not accurately reflect the file system. Also, search() may be called as often as necessary, but will not check for file existence any more frequently than once every 10 seconds. */
|
3875
|
+
/** Whether the downloaded file still exists. This information may be out of date because Chrome does not automatically watch for file removal. Call {@link search}() in order to trigger the check for file existence. When the existence check completes, if the file has been deleted, then an {@link onChanged} event will fire. Note that {@link search}() does not wait for the existence check to finish before returning, so results from {@link search}() may not accurately reflect the file system. Also, {@link search}() may be called as often as necessary, but will not check for file existence any more frequently than once every 10 seconds. */
|
3869
3876
|
exists: boolean;
|
3870
|
-
/**
|
3877
|
+
/** The identifier for the extension that initiated this download if this download was initiated by an extension. Does not change once it is set. */
|
3871
3878
|
byExtensionId?: string | undefined;
|
3872
|
-
/**
|
3879
|
+
/** The localized name of the extension that initiated this download if this download was initiated by an extension. May change if the extension changes its name or if the user changes their locale. */
|
3873
3880
|
byExtensionName?: string | undefined;
|
3874
3881
|
}
|
3875
3882
|
|
3876
3883
|
export interface GetFileIconOptions {
|
3877
|
-
/**
|
3878
|
-
*/
|
3884
|
+
/** The size of the returned icon. The icon will be square with dimensions size * size pixels. The default and largest size for the icon is 32x32 pixels. The only supported sizes are 16 and 32. It is an error to specify any other size. */
|
3879
3885
|
size?: 16 | 32 | undefined;
|
3880
3886
|
}
|
3881
3887
|
|
3882
3888
|
export interface DownloadQuery {
|
3883
|
-
/**
|
3889
|
+
/** Set elements of this array to {@link DownloadItem} properties in order to sort search results. For example, setting `orderBy=['startTime']` sorts the {@link DownloadItem} by their start time in ascending order. To specify descending order, prefix with a hyphen: '-startTime'. */
|
3884
3890
|
orderBy?: string[] | undefined;
|
3885
|
-
/**
|
3891
|
+
/** Limits results to {@link DownloadItem} whose `url` matches the given regular expression. */
|
3886
3892
|
urlRegex?: string | undefined;
|
3887
|
-
/**
|
3893
|
+
/** Limits results to {@link DownloadItem} that ended before the time in ISO 8601 format. */
|
3888
3894
|
endedBefore?: string | undefined;
|
3889
|
-
/**
|
3895
|
+
/** Limits results to {@link DownloadItem} whose `totalBytes` is greater than the given integer. */
|
3890
3896
|
totalBytesGreater?: number | undefined;
|
3891
|
-
/**
|
3892
|
-
danger?:
|
3893
|
-
/**
|
3897
|
+
/** Indication of whether this download is thought to be safe or known to be suspicious. */
|
3898
|
+
danger?: `${DangerType}` | undefined;
|
3899
|
+
/** Number of bytes in the whole file, without considering file compression, or -1 if unknown. */
|
3894
3900
|
totalBytes?: number | undefined;
|
3895
|
-
/**
|
3901
|
+
/** True if the download has stopped reading data from the host, but kept the connection open. */
|
3896
3902
|
paused?: boolean | undefined;
|
3897
|
-
/**
|
3903
|
+
/** Limits results to {@link DownloadItem} whose `filename` matches the given regular expression. */
|
3898
3904
|
filenameRegex?: string | undefined;
|
3899
|
-
/**
|
3905
|
+
/**
|
3906
|
+
* The absolute URL that this download is being made from, after all redirects.
|
3907
|
+
* @since Chrome 54
|
3908
|
+
*/
|
3909
|
+
finalUrl?: string;
|
3910
|
+
/**
|
3911
|
+
* Limits results to {@link DownloadItem} whose `finalUrl` matches the given regular expression.
|
3912
|
+
* @since Chrome 54
|
3913
|
+
*/
|
3914
|
+
finalUrlRegex?: string;
|
3915
|
+
/** This array of search terms limits results to {@link DownloadItem} whose `filename` or `url` or `finalUrl` contain all of the search terms that do not begin with a dash '-' and none of the search terms that do begin with a dash. */
|
3900
3916
|
query?: string[] | undefined;
|
3901
|
-
/**
|
3917
|
+
/** Limits results to {@link DownloadItem} whose `totalBytes` is less than the given integer. */
|
3902
3918
|
totalBytesLess?: number | undefined;
|
3903
|
-
/**
|
3919
|
+
/** The `id` of the {@link DownloadItem} to query. */
|
3904
3920
|
id?: number | undefined;
|
3905
|
-
/**
|
3921
|
+
/** Number of bytes received so far from the host, without considering file compression. */
|
3906
3922
|
bytesReceived?: number | undefined;
|
3907
|
-
/**
|
3923
|
+
/** Limits results to {@link DownloadItem} that ended after the time in ISO 8601 format. */
|
3908
3924
|
endedAfter?: string | undefined;
|
3909
|
-
/**
|
3925
|
+
/** Absolute local path. */
|
3910
3926
|
filename?: string | undefined;
|
3911
|
-
/**
|
3912
|
-
state?:
|
3913
|
-
/**
|
3927
|
+
/** Indicates whether the download is progressing, interrupted, or complete. */
|
3928
|
+
state?: `${State}` | undefined;
|
3929
|
+
/** Limits results to {@link DownloadItem} that started after the time in ISO 8601 format. */
|
3914
3930
|
startedAfter?: string | undefined;
|
3915
|
-
/**
|
3931
|
+
/** The file's MIME type. */
|
3916
3932
|
mime?: string | undefined;
|
3917
|
-
/**
|
3933
|
+
/** Number of bytes in the whole file post-decompression, or -1 if unknown. */
|
3918
3934
|
fileSize?: number | undefined;
|
3919
|
-
/**
|
3935
|
+
/** The time when the download began in ISO 8601 format. */
|
3920
3936
|
startTime?: string | undefined;
|
3921
|
-
/**
|
3937
|
+
/** The absolute URL that this download initiated from, before any redirects. */
|
3922
3938
|
url?: string | undefined;
|
3923
|
-
/**
|
3939
|
+
/** Limits results to {@link DownloadItem} that started before the time in ISO 8601 format. */
|
3924
3940
|
startedBefore?: string | undefined;
|
3925
|
-
/**
|
3941
|
+
/** The maximum number of matching {@link DownloadItem} returned. Defaults to 1000. Set to 0 in order to return all matching {@link DownloadItem}. See {@link search} for how to page through results. */
|
3926
3942
|
limit?: number | undefined;
|
3927
|
-
/**
|
3928
|
-
error?:
|
3929
|
-
/**
|
3943
|
+
/** Why a download was interrupted. */
|
3944
|
+
error?: `${InterruptReason}` | undefined;
|
3945
|
+
/** The time when the download ended in ISO 8601 format. */
|
3930
3946
|
endTime?: string | undefined;
|
3931
|
-
/**
|
3947
|
+
/** Whether the downloaded file exists; */
|
3932
3948
|
exists?: boolean | undefined;
|
3933
3949
|
}
|
3934
3950
|
|
3935
|
-
export interface
|
3936
|
-
/** The DownloadItem's new target DownloadItem.filename, as a path relative to the user's default Downloads directory, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will be ignored. */
|
3951
|
+
export interface FilenameSuggestion {
|
3952
|
+
/** The {@link DownloadItem}'s new target {@link DownloadItem.filename}, as a path relative to the user's default Downloads directory, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will be ignored. `filename` is ignored if there are any {@link onDeterminingFilename} listeners registered by any extensions. */
|
3937
3953
|
filename: string;
|
3938
|
-
/**
|
3939
|
-
conflictAction?:
|
3954
|
+
/** The action to take if `filename` already exists. */
|
3955
|
+
conflictAction?: `${FilenameConflictAction}` | undefined;
|
3940
3956
|
}
|
3941
3957
|
|
3958
|
+
/** @since Chrome 105 */
|
3942
3959
|
export interface UiOptions {
|
3943
3960
|
/** Enable or disable the download UI. */
|
3944
3961
|
enabled: boolean;
|
3945
3962
|
}
|
3946
3963
|
|
3947
|
-
export interface DownloadChangedEvent extends chrome.events.Event<(downloadDelta: DownloadDelta) => void> {}
|
3948
|
-
|
3949
|
-
export interface DownloadCreatedEvent extends chrome.events.Event<(downloadItem: DownloadItem) => void> {}
|
3950
|
-
|
3951
|
-
export interface DownloadErasedEvent extends chrome.events.Event<(downloadId: number) => void> {}
|
3952
|
-
|
3953
|
-
export interface DownloadDeterminingFilenameEvent extends
|
3954
|
-
chrome.events.Event<
|
3955
|
-
(downloadItem: DownloadItem, suggest: (suggestion?: DownloadFilenameSuggestion) => void) => void
|
3956
|
-
>
|
3957
|
-
{}
|
3958
|
-
|
3959
3964
|
/**
|
3960
|
-
* Find DownloadItem. Set query to the empty object to get all DownloadItem. To get a specific DownloadItem, set only the id field. To page through a large number of items, set orderBy: ['-startTime']
|
3961
|
-
*
|
3965
|
+
* Find {@link DownloadItem}. Set `query` to the empty object to get all {@link DownloadItem}. To get a specific {@link DownloadItem}, set only the `id` field. To page through a large number of items, set `orderBy: ['-startTime']`, set `limit` to the number of items per page, and set `startedAfter` to the `startTime` of the last item from the last page.
|
3966
|
+
*
|
3967
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
3962
3968
|
*/
|
3963
3969
|
export function search(query: DownloadQuery): Promise<DownloadItem[]>;
|
3964
|
-
/**
|
3965
|
-
* Find DownloadItem. Set query to the empty object to get all DownloadItem. To get a specific DownloadItem, set only the id field. To page through a large number of items, set orderBy: ['-startTime'], set limit to the number of items per page, and set startedAfter to the startTime of the last item from the last page.
|
3966
|
-
*/
|
3967
3970
|
export function search(query: DownloadQuery, callback: (results: DownloadItem[]) => void): void;
|
3971
|
+
|
3968
3972
|
/**
|
3969
|
-
* Pause the download. If the request was successful the download is in a paused state. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active.
|
3973
|
+
* Pause the download. If the request was successful the download is in a paused state. Otherwise {@link runtime.lastError} contains an error message. The request will fail if the download is not active.
|
3970
3974
|
* @param downloadId The id of the download to pause.
|
3971
|
-
*
|
3975
|
+
*
|
3976
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
3972
3977
|
*/
|
3973
3978
|
export function pause(downloadId: number): Promise<void>;
|
3974
|
-
/**
|
3975
|
-
* Pause the download. If the request was successful the download is in a paused state. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active.
|
3976
|
-
* @param downloadId The id of the download to pause.
|
3977
|
-
* @param callback Called when the pause request is completed.
|
3978
|
-
*/
|
3979
3979
|
export function pause(downloadId: number, callback: () => void): void;
|
3980
|
+
|
3980
3981
|
/**
|
3981
|
-
* Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message.
|
3982
|
-
* @param downloadId The identifier for the download.
|
3983
|
-
* @return The `getFileIcon` method provides its result via callback or returned as a `Promise` (MV3 only).
|
3984
|
-
*/
|
3985
|
-
export function getFileIcon(downloadId: number, options?: GetFileIconOptions): Promise<string>;
|
3986
|
-
/**
|
3987
|
-
* Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message.
|
3988
|
-
* @param downloadId The identifier for the download.
|
3989
|
-
* @param callback A URL to an image that represents the download.
|
3990
|
-
*/
|
3991
|
-
export function getFileIcon(downloadId: number, callback: (iconURL: string) => void): void;
|
3992
|
-
/**
|
3993
|
-
* Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message.
|
3982
|
+
* Retrieve an icon for the specified download. For new downloads, file icons are available after the {@link onCreated} event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, {@link runtime.lastError} will contain an error message.
|
3994
3983
|
* @param downloadId The identifier for the download.
|
3995
|
-
*
|
3984
|
+
*
|
3985
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
3996
3986
|
*/
|
3987
|
+
export function getFileIcon(downloadId: number, options?: GetFileIconOptions): Promise<string | undefined>;
|
3988
|
+
export function getFileIcon(downloadId: number, callback: (iconURL?: string) => void): void;
|
3997
3989
|
export function getFileIcon(
|
3998
3990
|
downloadId: number,
|
3999
3991
|
options: GetFileIconOptions,
|
4000
|
-
callback: (iconURL
|
3992
|
+
callback: (iconURL?: string) => void,
|
4001
3993
|
): void;
|
3994
|
+
|
4002
3995
|
/**
|
4003
|
-
* Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active.
|
3996
|
+
* Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise {@link runtime.lastError} contains an error message. The request will fail if the download is not active.
|
4004
3997
|
* @param downloadId The id of the download to resume.
|
4005
|
-
*
|
3998
|
+
*
|
3999
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
4006
4000
|
*/
|
4007
4001
|
export function resume(downloadId: number): Promise<void>;
|
4008
|
-
/**
|
4009
|
-
* Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active.
|
4010
|
-
* @param downloadId The id of the download to resume.
|
4011
|
-
* @param callback Called when the resume request is completed.
|
4012
|
-
*/
|
4013
4002
|
export function resume(downloadId: number, callback: () => void): void;
|
4003
|
+
|
4014
4004
|
/**
|
4015
|
-
* Cancel a download. When callback is run, the download is cancelled, completed, interrupted or doesn't exist anymore.
|
4005
|
+
* Cancel a download. When `callback` is run, the download is cancelled, completed, interrupted or doesn't exist anymore.
|
4016
4006
|
* @param downloadId The id of the download to cancel.
|
4017
|
-
*
|
4007
|
+
*
|
4008
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
4018
4009
|
*/
|
4019
4010
|
export function cancel(downloadId: number): Promise<void>;
|
4020
|
-
/**
|
4021
|
-
* Cancel a download. When callback is run, the download is cancelled, completed, interrupted or doesn't exist anymore.
|
4022
|
-
* @param downloadId The id of the download to cancel.
|
4023
|
-
* @param callback Called when the cancel request is completed.
|
4024
|
-
*/
|
4025
4011
|
export function cancel(downloadId: number, callback: () => void): void;
|
4012
|
+
|
4026
4013
|
/**
|
4027
|
-
* Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the specified filename
|
4014
|
+
* Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both `filename` and `saveAs` are specified, then the Save As dialog will be displayed, pre-populated with the specified `filename`. If the download started successfully, `callback` will be called with the new {@link DownloadItem}'s `downloadId`. If there was an error starting the download, then `callback` will be called with `downloadId=undefined` and {@link runtime.lastError} will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. Extensions must not parse it.
|
4028
4015
|
* @param options What to download and how.
|
4029
|
-
*
|
4016
|
+
*
|
4017
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
4030
4018
|
*/
|
4031
4019
|
export function download(options: DownloadOptions): Promise<number>;
|
4032
|
-
/**
|
4033
|
-
* Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the specified filename. If the download started successfully, callback will be called with the new DownloadItem's downloadId. If there was an error starting the download, then callback will be called with downloadId=undefined and runtime.lastError will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. Extensions must not parse it.
|
4034
|
-
* @param options What to download and how.
|
4035
|
-
* @param callback Called with the id of the new DownloadItem.
|
4036
|
-
*/
|
4037
4020
|
export function download(options: DownloadOptions, callback: (downloadId: number) => void): void;
|
4021
|
+
|
4038
4022
|
/**
|
4039
|
-
*
|
4023
|
+
* Opens the downloaded file now if the {@link DownloadItem} is complete; otherwise returns an error through {@link runtime.lastError}. This method requires the `"downloads.open"` permission in addition to the `"downloads"` permission. An {@link onChanged} event fires when the item is opened for the first time. This method can only be called in response to a user gesture.
|
4040
4024
|
* @param downloadId The identifier for the downloaded file.
|
4025
|
+
*
|
4026
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 123.
|
4041
4027
|
*/
|
4042
|
-
export function open(downloadId: number): void
|
4028
|
+
export function open(downloadId: number): Promise<void>;
|
4029
|
+
export function open(
|
4030
|
+
downloadId: number,
|
4031
|
+
/** @since Chrome 123 */
|
4032
|
+
callback: () => void,
|
4033
|
+
): void;
|
4034
|
+
|
4043
4035
|
/**
|
4044
4036
|
* Show the downloaded file in its folder in a file manager.
|
4045
4037
|
* @param downloadId The identifier for the downloaded file.
|
4046
4038
|
*/
|
4047
4039
|
export function show(downloadId: number): void;
|
4040
|
+
|
4048
4041
|
/** Show the default Downloads folder in a file manager. */
|
4049
4042
|
export function showDefaultFolder(): void;
|
4043
|
+
|
4050
4044
|
/**
|
4051
|
-
* Erase matching DownloadItem from history without deleting the downloaded file. An onErased event will fire for each DownloadItem that matches query
|
4052
|
-
*
|
4045
|
+
* Erase matching {@link DownloadItem} from history without deleting the downloaded file. An {@link onErased} event will fire for each {@link DownloadItem} that matches `query`, then `callback` will be called.
|
4046
|
+
*
|
4047
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
4053
4048
|
*/
|
4054
4049
|
export function erase(query: DownloadQuery): Promise<number[]>;
|
4055
|
-
/**
|
4056
|
-
* Erase matching DownloadItem from history without deleting the downloaded file. An onErased event will fire for each DownloadItem that matches query, then callback will be called.
|
4057
|
-
*/
|
4058
4050
|
export function erase(query: DownloadQuery, callback: (erasedIds: number[]) => void): void;
|
4051
|
+
|
4059
4052
|
/**
|
4060
|
-
* Remove the downloaded file if it exists and the DownloadItem is complete; otherwise return an error through runtime.lastError.
|
4061
|
-
*
|
4053
|
+
* Remove the downloaded file if it exists and the {@link DownloadItem} is complete; otherwise return an error through {@link runtime.lastError}.
|
4054
|
+
*
|
4055
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
4062
4056
|
*/
|
4063
4057
|
export function removeFile(downloadId: number): Promise<void>;
|
4058
|
+
export function removeFile(downloadId: number, callback: () => void): void;
|
4059
|
+
|
4064
4060
|
/**
|
4065
|
-
*
|
4066
|
-
|
4067
|
-
|
4068
|
-
|
4069
|
-
* Prompt the user to accept a dangerous download. Can only be called from a visible context (tab, window, or page/browser action popup). Does not automatically accept dangerous downloads. If the download is accepted, then an onChanged event will fire, otherwise nothing will happen. When all the data is fetched into a temporary file and either the download is not dangerous or the danger has been accepted, then the temporary file is renamed to the target filename, the |state| changes to 'complete', and onChanged fires.
|
4070
|
-
* @param downloadId The identifier for the DownloadItem.
|
4071
|
-
* @return The `acceptDanger` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
4061
|
+
* Prompt the user to accept a dangerous download. Can only be called from a visible context (tab, window, or page/browser action popup). Does not automatically accept dangerous downloads. If the download is accepted, then an {@link onChanged} event will fire, otherwise nothing will happen. When all the data is fetched into a temporary file and either the download is not dangerous or the danger has been accepted, then the temporary file is renamed to the target filename, the `state` changes to 'complete', and {@link onChanged} fires.
|
4062
|
+
* @param downloadId The identifier for the {@link DownloadItem}.
|
4063
|
+
*
|
4064
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
4072
4065
|
*/
|
4073
4066
|
export function acceptDanger(downloadId: number): Promise<void>;
|
4067
|
+
export function acceptDanger(downloadId: number, callback: () => void): void;
|
4068
|
+
|
4074
4069
|
/**
|
4075
|
-
*
|
4076
|
-
* @
|
4077
|
-
* @param callback Called when the danger prompt dialog closes.
|
4070
|
+
* Enable or disable the gray shelf at the bottom of every window associated with the current browser profile. The shelf will be disabled as long as at least one extension has disabled it. Enabling the shelf while at least one other extension has disabled it will return an error through {@link runtime.lastError}. Requires the `"downloads.shelf"` permission in addition to the `"downloads"` permission.
|
4071
|
+
* @deprecated since Chrome 117. Use {@link setUiOptions} instead.
|
4078
4072
|
*/
|
4079
|
-
export function acceptDanger(downloadId: number, callback: () => void): void;
|
4080
|
-
/** Initiate dragging the downloaded file to another application. Call in a javascript ondragstart handler. */
|
4081
|
-
export function drag(downloadId: number): void;
|
4082
|
-
/** Enable or disable the gray shelf at the bottom of every window associated with the current browser profile. The shelf will be disabled as long as at least one extension has disabled it. Enabling the shelf while at least one other extension has disabled it will return an error through runtime.lastError. Requires the "downloads.shelf" permission in addition to the "downloads" permission. */
|
4083
4073
|
export function setShelfEnabled(enabled: boolean): void;
|
4074
|
+
|
4084
4075
|
/**
|
4085
|
-
* Change the download UI of every window associated with the current browser profile. As long as at least one extension has set UiOptions.enabled to false, the download UI will be hidden. Setting UiOptions.enabled to true while at least one other extension has disabled it will return an error through runtime.lastError. Requires the "downloads.ui" permission in addition to the "downloads" permission.
|
4086
|
-
* @param options Encapsulate a change to the download UI.
|
4076
|
+
* Change the download UI of every window associated with the current browser profile. As long as at least one extension has set {@link UiOptions.enabled} to false, the download UI will be hidden. Setting {@link UiOptions.enabled} to true while at least one other extension has disabled it will return an error through {@link runtime.lastError}. Requires the `"downloads.ui"` permission in addition to the `"downloads"` permission.
|
4087
4077
|
* @since Chrome 105
|
4078
|
+
*
|
4079
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 105.
|
4088
4080
|
*/
|
4089
4081
|
export function setUiOptions(options: UiOptions): Promise<void>;
|
4090
|
-
/**
|
4091
|
-
* Change the download UI of every window associated with the current browser profile. As long as at least one extension has set UiOptions.enabled to false, the download UI will be hidden. Setting UiOptions.enabled to true while at least one other extension has disabled it will return an error through runtime.lastError. Requires the "downloads.ui" permission in addition to the "downloads" permission.
|
4092
|
-
* @param options Encapsulate a change to the download UI.
|
4093
|
-
* @param callback Called when the setUiOptions request is completed.
|
4094
|
-
* @since Chrome 105
|
4095
|
-
*/
|
4096
4082
|
export function setUiOptions(options: UiOptions, callback: () => void): void;
|
4097
4083
|
|
4098
|
-
/** When any of a DownloadItem's properties except bytesReceived and estimatedEndTime changes, this event fires with the downloadId and an object containing the properties that changed. */
|
4099
|
-
export
|
4100
|
-
|
4101
|
-
|
4102
|
-
|
4103
|
-
|
4104
|
-
/**
|
4105
|
-
export
|
4084
|
+
/** When any of a {@link DownloadItem}'s properties except `bytesReceived` and `estimatedEndTime` changes, this event fires with the `downloadId` and an object containing the properties that changed. */
|
4085
|
+
export const onChanged: events.Event<(downloadDelta: DownloadDelta) => void>;
|
4086
|
+
|
4087
|
+
/** This event fires with the {@link DownloadItem} object when a download begins. */
|
4088
|
+
export const onCreated: events.Event<(downloadItem: DownloadItem) => void>;
|
4089
|
+
|
4090
|
+
/** Fires with the `downloadId` when a download is erased from history. */
|
4091
|
+
export const onErased: events.Event<(downloadId: number) => void>;
|
4092
|
+
|
4093
|
+
/** During the filename determination process, extensions will be given the opportunity to override the target {@link DownloadItem.filename}. Each extension may not register more than one listener for this event. Each listener must call `suggest` exactly once, either synchronously or asynchronously. If the listener calls `suggest` asynchronously, then it must return `true`. If the listener neither calls `suggest` synchronously nor returns `true`, then `suggest` will be called automatically. The {@link DownloadItem} will not complete until all listeners have called `suggest`. Listeners may call `suggest` without any arguments in order to allow the download to use `downloadItem.filename` for its filename, or pass a `suggestion` object to `suggest` in order to override the target filename. If more than one extension overrides the filename, then the last extension installed whose listener passes a `suggestion` object to `suggest` wins. In order to avoid confusion regarding which extension will win, users should not install extensions that may conflict. If the download is initiated by {@link download} and the target filename is known before the MIME type and tentative filename have been determined, pass `filename` to {@link download} instead. */
|
4094
|
+
export const onDeterminingFilename: events.Event<
|
4095
|
+
(downloadItem: DownloadItem, suggest: (suggestion?: FilenameSuggestion) => void) => void
|
4096
|
+
>;
|
4106
4097
|
}
|
4107
4098
|
|
4108
4099
|
////////////////////
|
@@ -4406,53 +4397,50 @@ declare namespace chrome {
|
|
4406
4397
|
export namespace events {
|
4407
4398
|
/** Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */
|
4408
4399
|
export interface UrlFilter {
|
4409
|
-
/** Optional. Matches if the scheme of the URL is equal to any of the schemes specified in the array. */
|
4410
|
-
schemes?: string[] | undefined;
|
4411
4400
|
/**
|
4412
|
-
*
|
4413
|
-
* @since Chrome
|
4414
|
-
* Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax.
|
4401
|
+
* Matches if the host part of the URL is an IP address and is contained in any of the CIDR blocks specified in the array.
|
4402
|
+
* @since Chrome 123
|
4415
4403
|
*/
|
4404
|
+
cidrBlocks?: string[] | undefined;
|
4405
|
+
/** Matches if the scheme of the URL is equal to any of the schemes specified in the array. */
|
4406
|
+
schemes?: string[] | undefined;
|
4407
|
+
/** Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */
|
4416
4408
|
urlMatches?: string | undefined;
|
4417
|
-
/**
|
4409
|
+
/** Matches if the path segment of the URL contains a specified string. */
|
4418
4410
|
pathContains?: string | undefined;
|
4419
|
-
/**
|
4411
|
+
/** Matches if the host name of the URL ends with a specified string. */
|
4420
4412
|
hostSuffix?: string | undefined;
|
4421
|
-
/**
|
4413
|
+
/** Matches if the host name of the URL starts with a specified string. */
|
4422
4414
|
hostPrefix?: string | undefined;
|
4423
|
-
/**
|
4415
|
+
/** Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name. */
|
4424
4416
|
hostContains?: string | undefined;
|
4425
|
-
/**
|
4417
|
+
/** Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
4426
4418
|
urlContains?: string | undefined;
|
4427
|
-
/**
|
4419
|
+
/** Matches if the query segment of the URL ends with a specified string. */
|
4428
4420
|
querySuffix?: string | undefined;
|
4429
|
-
/**
|
4421
|
+
/** Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
4430
4422
|
urlPrefix?: string | undefined;
|
4431
|
-
/**
|
4423
|
+
/** Matches if the host name of the URL is equal to a specified string. */
|
4432
4424
|
hostEquals?: string | undefined;
|
4433
|
-
/**
|
4425
|
+
/** Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
4434
4426
|
urlEquals?: string | undefined;
|
4435
|
-
/**
|
4427
|
+
/** Matches if the query segment of the URL contains a specified string. */
|
4436
4428
|
queryContains?: string | undefined;
|
4437
|
-
/**
|
4429
|
+
/** Matches if the path segment of the URL starts with a specified string. */
|
4438
4430
|
pathPrefix?: string | undefined;
|
4439
|
-
/**
|
4431
|
+
/** Matches if the path segment of the URL is equal to a specified string. */
|
4440
4432
|
pathEquals?: string | undefined;
|
4441
|
-
/**
|
4433
|
+
/** Matches if the path segment of the URL ends with a specified string. */
|
4442
4434
|
pathSuffix?: string | undefined;
|
4443
|
-
/**
|
4435
|
+
/** Matches if the query segment of the URL is equal to a specified string. */
|
4444
4436
|
queryEquals?: string | undefined;
|
4445
|
-
/**
|
4437
|
+
/** Matches if the query segment of the URL starts with a specified string. */
|
4446
4438
|
queryPrefix?: string | undefined;
|
4447
|
-
/**
|
4439
|
+
/** Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if they match the default port number. */
|
4448
4440
|
urlSuffix?: string | undefined;
|
4449
|
-
/**
|
4441
|
+
/** Matches if the port of the URL is contained in any of the specified port lists. For example `[80, 443, [1000, 1200]]` matches all requests on port 80, 443 and in the range 1000-1200. */
|
4450
4442
|
ports?: Array<number | number[]> | undefined;
|
4451
|
-
/**
|
4452
|
-
* Optional.
|
4453
|
-
* @since Chrome 28
|
4454
|
-
* Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax.
|
4455
|
-
*/
|
4443
|
+
/** Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */
|
4456
4444
|
originAndPathMatches?: string | undefined;
|
4457
4445
|
}
|
4458
4446
|
|
@@ -4462,43 +4450,33 @@ declare namespace chrome {
|
|
4462
4450
|
* @param callback Called when an event occurs. The parameters of this function depend on the type of event.
|
4463
4451
|
*/
|
4464
4452
|
addListener(callback: T): void;
|
4453
|
+
|
4465
4454
|
/**
|
4466
4455
|
* Returns currently registered rules.
|
4467
|
-
* @param
|
4456
|
+
* @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are returned.
|
4468
4457
|
*/
|
4469
4458
|
getRules(
|
4470
|
-
|
4471
|
-
|
4472
|
-
rules: Rule[],
|
4473
|
-
) => void,
|
4459
|
+
/** @param rules Rules that were registered, the optional parameters are filled with values */
|
4460
|
+
callback: (rules: Rule[]) => void,
|
4474
4461
|
): void;
|
4475
|
-
/**
|
4476
|
-
* Returns currently registered rules.
|
4477
|
-
* @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are returned.
|
4478
|
-
* @param callback Called with registered rules.
|
4479
|
-
*/
|
4480
4462
|
getRules(
|
4481
4463
|
ruleIdentifiers: string[],
|
4482
|
-
|
4483
|
-
|
4484
|
-
rules: Rule[],
|
4485
|
-
) => void,
|
4464
|
+
/** @param rules Rules that were registered, the optional parameters are filled with values */
|
4465
|
+
callback: (rules: Rule[]) => void,
|
4486
4466
|
): void;
|
4467
|
+
|
4487
4468
|
/**
|
4488
4469
|
* @param callback Listener whose registration status shall be tested.
|
4470
|
+
* @returns True if _callback_ is registered to the event.
|
4489
4471
|
*/
|
4490
4472
|
hasListener(callback: T): boolean;
|
4473
|
+
|
4491
4474
|
/**
|
4492
4475
|
* Unregisters currently registered rules.
|
4493
4476
|
* @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are unregistered.
|
4494
|
-
* @param callback Called when rules were unregistered.
|
4495
4477
|
*/
|
4496
|
-
removeRules(ruleIdentifiers?: string[], callback?: () => void): void;
|
4497
|
-
|
4498
|
-
* Unregisters currently registered rules.
|
4499
|
-
* @param callback Called when rules were unregistered.
|
4500
|
-
*/
|
4501
|
-
removeRules(callback?: () => void): void;
|
4478
|
+
removeRules(ruleIdentifiers?: string[] | undefined, callback?: () => void): void;
|
4479
|
+
|
4502
4480
|
/**
|
4503
4481
|
* Registers rules to handle events.
|
4504
4482
|
* @param rules Rules to be registered. These do not replace previously registered rules.
|
@@ -4506,34 +4484,31 @@ declare namespace chrome {
|
|
4506
4484
|
*/
|
4507
4485
|
addRules(
|
4508
4486
|
rules: Rule[],
|
4509
|
-
|
4510
|
-
|
4511
|
-
rules: Rule[],
|
4512
|
-
) => void,
|
4487
|
+
/** @param rules Rules that were registered, the optional parameters are filled with values */
|
4488
|
+
callback?: (rules: Rule[]) => void,
|
4513
4489
|
): void;
|
4490
|
+
|
4514
4491
|
/**
|
4515
4492
|
* Deregisters an event listener callback from an event.
|
4516
4493
|
* @param callback Listener that shall be unregistered.
|
4517
4494
|
*/
|
4518
4495
|
removeListener(callback: T): void;
|
4496
|
+
|
4497
|
+
/** @returns True if any event listeners are registered to the event. */
|
4519
4498
|
hasListeners(): boolean;
|
4520
4499
|
}
|
4521
4500
|
|
4522
4501
|
/** Description of a declarative rule for handling events. */
|
4523
4502
|
export interface Rule {
|
4524
|
-
/** Optional
|
4503
|
+
/** Optional priority of this rule. Defaults to 100. */
|
4525
4504
|
priority?: number | undefined;
|
4526
4505
|
/** List of conditions that can trigger the actions. */
|
4527
4506
|
conditions: any[];
|
4528
|
-
/** Optional
|
4507
|
+
/** Optional identifier that allows referencing this rule. */
|
4529
4508
|
id?: string | undefined;
|
4530
|
-
/** List of actions that are triggered if one of the
|
4509
|
+
/** List of actions that are triggered if one of the conditions is fulfilled. */
|
4531
4510
|
actions: any[];
|
4532
|
-
/**
|
4533
|
-
* Optional.
|
4534
|
-
* @since Chrome 28
|
4535
|
-
* Tags can be used to annotate rules and perform operations on sets of rules.
|
4536
|
-
*/
|
4511
|
+
/** Tags can be used to annotate rules and perform operations on sets of rules. */
|
4537
4512
|
tags?: string[] | undefined;
|
4538
4513
|
}
|
4539
4514
|
}
|
@@ -5791,72 +5766,67 @@ declare namespace chrome {
|
|
5791
5766
|
destinationId: string;
|
5792
5767
|
/** The ID of the message. It must be unique for each message in scope of the applications. See the Cloud Messaging documentation for advice for picking and handling an ID. */
|
5793
5768
|
messageId: string;
|
5794
|
-
/**
|
5769
|
+
/** Time-to-live of the message in seconds. If it is not possible to send the message within that time, an onSendError event will be raised. A time-to-live of 0 indicates that the message should be sent immediately or fail if it's not possible. The default value of time-to-live is 86,400 seconds (1 day) and the maximum value is 2,419,200 seconds (28 days). */
|
5795
5770
|
timeToLive?: number | undefined;
|
5796
|
-
/** Message data to send to the server. Case-insensitive goog
|
5771
|
+
/** Message data to send to the server. Case-insensitive `goog.` and `google`, as well as case-sensitive `collapse_key` are disallowed as key prefixes. Sum of all key/value pairs should not exceed {@link gcm.MAX_MESSAGE_SIZE}. */
|
5797
5772
|
data: { [key: string]: unknown };
|
5798
5773
|
}
|
5799
5774
|
|
5800
|
-
export interface IncomingMessage {
|
5801
|
-
/** The message data. */
|
5802
|
-
data: { [key: string]: unknown };
|
5803
|
-
/**
|
5804
|
-
* Optional.
|
5805
|
-
* The sender who issued the message.
|
5806
|
-
* @since Chrome 41
|
5807
|
-
*/
|
5808
|
-
from?: string | undefined;
|
5809
|
-
/**
|
5810
|
-
* Optional.
|
5811
|
-
* The collapse key of a message. See Collapsible Messages section of Cloud Messaging documentation for details.
|
5812
|
-
*/
|
5813
|
-
collapseKey?: string | undefined;
|
5814
|
-
}
|
5815
|
-
|
5816
|
-
export interface GcmError {
|
5817
|
-
/** The error message describing the problem. */
|
5818
|
-
errorMessage: string;
|
5819
|
-
/** Optional. The ID of the message with this error, if error is related to a specific message. */
|
5820
|
-
messageId?: string | undefined;
|
5821
|
-
/** Additional details related to the error, when available. */
|
5822
|
-
detail: object;
|
5823
|
-
}
|
5824
|
-
|
5825
|
-
export interface MessageReceptionEvent extends chrome.events.Event<(message: IncomingMessage) => void> {}
|
5826
|
-
|
5827
|
-
export interface MessageDeletionEvent extends chrome.events.Event<() => void> {}
|
5828
|
-
|
5829
|
-
export interface GcmErrorEvent extends chrome.events.Event<(error: GcmError) => void> {}
|
5830
|
-
|
5831
5775
|
/** The maximum size (in bytes) of all key/value pairs in a message. */
|
5832
|
-
export
|
5776
|
+
export const MAX_MESSAGE_SIZE: 4096;
|
5833
5777
|
|
5834
5778
|
/**
|
5835
|
-
* Registers the application with
|
5779
|
+
* Registers the application with FCM. The registration ID will be returned by the `callback`. If `register` is called again with the same list of `senderIds`, the same registration ID will be returned.
|
5780
|
+
*
|
5781
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 116.
|
5836
5782
|
* @param senderIds A list of server IDs that are allowed to send messages to the application. It should contain at least one and no more than 100 sender IDs.
|
5837
|
-
* @param callback Function called when registration completes. It should check runtime.lastError for error when registrationId is empty.
|
5838
|
-
* Parameter registrationId: A registration ID assigned to the application by the GCM.
|
5839
5783
|
*/
|
5784
|
+
export function register(senderIds: string[]): Promise<string>;
|
5840
5785
|
export function register(senderIds: string[], callback: (registrationId: string) => void): void;
|
5786
|
+
|
5841
5787
|
/**
|
5842
|
-
*
|
5843
|
-
*
|
5788
|
+
* Unregister the application from FCM.
|
5789
|
+
*
|
5790
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 116.
|
5844
5791
|
*/
|
5792
|
+
export function unregister(): Promise<void>;
|
5845
5793
|
export function unregister(callback: () => void): void;
|
5794
|
+
|
5846
5795
|
/**
|
5847
5796
|
* Sends a message according to its contents.
|
5848
|
-
*
|
5849
|
-
*
|
5850
|
-
*
|
5797
|
+
*
|
5798
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 116.
|
5799
|
+
* @param message A message to send to the other party via FCM.
|
5851
5800
|
*/
|
5801
|
+
export function send(message: OutgoingMessage): Promise<string>;
|
5852
5802
|
export function send(message: OutgoingMessage, callback: (messageId: string) => void): void;
|
5853
5803
|
|
5854
|
-
/** Fired when a message is received through
|
5855
|
-
export
|
5856
|
-
|
5857
|
-
|
5858
|
-
|
5859
|
-
|
5804
|
+
/** Fired when a message is received through FCM. */
|
5805
|
+
export const onMessage: events.Event<
|
5806
|
+
(message: {
|
5807
|
+
/** The collapse key of a message. See the Non-collapsible and collapsible messages for details. */
|
5808
|
+
collapseKey?: string;
|
5809
|
+
/** The message data. */
|
5810
|
+
data: { [key: string]: unknown };
|
5811
|
+
/** The sender who issued the message. */
|
5812
|
+
from?: string;
|
5813
|
+
}) => void
|
5814
|
+
>;
|
5815
|
+
|
5816
|
+
/** Fired when a FCM server had to delete messages sent by an app server to the application. See Lifetime of a message for details on handling this event. */
|
5817
|
+
export const onMessagesDeleted: events.Event<() => void>;
|
5818
|
+
|
5819
|
+
/** Fired when it was not possible to send a message to the FCM server. */
|
5820
|
+
export const onSendError: events.Event<
|
5821
|
+
(error: {
|
5822
|
+
/** Additional details related to the error, when available. */
|
5823
|
+
details: { [key: string]: unknown };
|
5824
|
+
/** The error message describing the problem. */
|
5825
|
+
errorMessage: string;
|
5826
|
+
/** The ID of the message with this error, if error is related to a specific message. */
|
5827
|
+
messageId?: string;
|
5828
|
+
}) => void
|
5829
|
+
>;
|
5860
5830
|
}
|
5861
5831
|
|
5862
5832
|
////////////////////
|
@@ -7813,73 +7783,80 @@ declare namespace chrome {
|
|
7813
7783
|
export interface Match {
|
7814
7784
|
/** The DER encoding of a X.509 certificate. */
|
7815
7785
|
certificate: ArrayBuffer;
|
7816
|
-
/** The
|
7786
|
+
/** The KeyAlgorithm of the certified key. This contains algorithm parameters that are inherent to the key of the certificate (e.g. the key length). Other parameters like the hash function used by the sign function are not included. */
|
7817
7787
|
keyAlgorithm: KeyAlgorithm;
|
7818
7788
|
}
|
7819
7789
|
|
7820
|
-
export interface
|
7821
|
-
/** This field is a list of the types of certificates requested, sorted in order of the server's preference. Only certificates of a type contained in this list will be retrieved. If certificateTypes is the empty list, however, certificates of any type will be returned. */
|
7822
|
-
certificateTypes:
|
7790
|
+
export interface ClientCertificateRequest {
|
7791
|
+
/** This field is a list of the types of certificates requested, sorted in order of the server's preference. Only certificates of a type contained in this list will be retrieved. If `certificateTypes` is the empty list, however, certificates of any type will be returned. */
|
7792
|
+
certificateTypes: `${ClientCertificateType}`[];
|
7823
7793
|
/** List of distinguished names of certificate authorities allowed by the server. Each entry must be a DER-encoded X.509 DistinguishedName. */
|
7824
7794
|
certificateAuthorities: ArrayBuffer[];
|
7825
7795
|
}
|
7826
7796
|
|
7827
|
-
export
|
7797
|
+
export enum ClientCertificateType {
|
7798
|
+
ECDSA_SIGN = "ecdsaSign",
|
7799
|
+
RAS_SIGN = "rasSign",
|
7800
|
+
}
|
7801
|
+
|
7802
|
+
export interface SelectDetails {
|
7828
7803
|
/** Only certificates that match this request will be returned. */
|
7829
|
-
request:
|
7830
|
-
/**
|
7831
|
-
* Optional.
|
7832
|
-
* If given, the selectClientCertificates operates on this list. Otherwise, obtains the list of all certificates from the platform's certificate stores that are available to this extensions. Entries that the extension doesn't have permission for or which doesn't match the request, are removed.
|
7833
|
-
*/
|
7804
|
+
request: ClientCertificateRequest;
|
7805
|
+
/** If given, the `selectClientCertificates` operates on this list. Otherwise, obtains the list of all certificates from the platform's certificate stores that are available to this extensions. Entries that the extension doesn't have permission for or which doesn't match the request, are removed. */
|
7834
7806
|
clientCerts?: ArrayBuffer[] | undefined;
|
7835
7807
|
/** If true, the filtered list is presented to the user to manually select a certificate and thereby granting the extension access to the certificate(s) and key(s). Only the selected certificate(s) will be returned. If is false, the list is reduced to all certificates that the extension has been granted access to (automatically or manually). */
|
7836
7808
|
interactive: boolean;
|
7837
7809
|
}
|
7838
7810
|
|
7839
|
-
export interface
|
7811
|
+
export interface VerificationDetails {
|
7840
7812
|
/** Each chain entry must be the DER encoding of a X.509 certificate, the first entry must be the server certificate and each entry must certify the entry preceding it. */
|
7841
7813
|
serverCertificateChain: ArrayBuffer[];
|
7842
|
-
/** The hostname of the server to verify the certificate for, e.g. the server that presented the serverCertificateChain
|
7814
|
+
/** The hostname of the server to verify the certificate for, e.g. the server that presented the `serverCertificateChain`. */
|
7843
7815
|
hostname: string;
|
7844
7816
|
}
|
7845
7817
|
|
7846
|
-
export interface
|
7818
|
+
export interface VerificationResult {
|
7847
7819
|
/** The result of the trust verification: true if trust for the given verification details could be established and false if trust is rejected for any reason. */
|
7848
7820
|
trusted: boolean;
|
7849
7821
|
/**
|
7850
7822
|
* If the trust verification failed, this array contains the errors reported by the underlying network layer. Otherwise, this array is empty.
|
7823
|
+
*
|
7851
7824
|
* Note: This list is meant for debugging only and may not contain all relevant errors. The errors returned may change in future revisions of this API, and are not guaranteed to be forwards or backwards compatible.
|
7852
7825
|
*/
|
7853
7826
|
debug_errors: string[];
|
7854
7827
|
}
|
7855
7828
|
|
7856
7829
|
/**
|
7857
|
-
* This
|
7858
|
-
*
|
7830
|
+
* This method filters from a list of client certificates the ones that are known to the platform, match `request` and for which the extension has permission to access the certificate and its private key. If `interactive` is true, the user is presented a dialog where they can select from matching certificates and grant the extension access to the certificate. The selected/filtered client certificates will be passed to `callback`.
|
7831
|
+
*
|
7832
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 121.
|
7859
7833
|
*/
|
7834
|
+
export function selectClientCertificates(details: SelectDetails): Promise<Match[]>;
|
7860
7835
|
export function selectClientCertificates(
|
7861
|
-
details:
|
7836
|
+
details: SelectDetails,
|
7862
7837
|
callback: (matches: Match[]) => void,
|
7863
7838
|
): void;
|
7839
|
+
|
7864
7840
|
/**
|
7865
|
-
* Passes the key pair of certificate for usage with platformKeys.subtleCrypto to callback
|
7866
|
-
* @param certificate The certificate of a Match returned by selectClientCertificates.
|
7867
|
-
* @param parameters Determines signature/hash algorithm parameters additionally to the parameters fixed by the key itself. The same parameters are
|
7868
|
-
*
|
7869
|
-
*
|
7841
|
+
* Passes the key pair of `certificate` for usage with {@link platformKeys.subtleCrypto} to `callback`.
|
7842
|
+
* @param certificate The certificate of a {@link Match} returned by {@link selectClientCertificates}.
|
7843
|
+
* @param parameters Determines signature/hash algorithm parameters additionally to the parameters fixed by the key itself. The same parameters are accepted as by WebCrypto's importKey function, e.g. `RsaHashedImportParams` for a RSASSA-PKCS1-v1_5 key and `EcKeyImportParams` for EC key. Additionally for RSASSA-PKCS1-v1_5 keys, hashing algorithm name parameter can be specified with one of the following values: "none", "SHA-1", "SHA-256", "SHA-384", or "SHA-512", e.g. `{"hash": { "name": "none" } }`. The sign function will then apply PKCS#1 v1.5 padding but not hash the given data.
|
7844
|
+
*
|
7845
|
+
* Currently, this method only supports the "RSASSA-PKCS1-v1\_5" and "ECDSA" algorithms.
|
7870
7846
|
*/
|
7871
7847
|
export function getKeyPair(
|
7872
7848
|
certificate: ArrayBuffer,
|
7873
7849
|
parameters: { [key: string]: unknown },
|
7874
7850
|
callback: (publicKey: CryptoKey, privateKey: CryptoKey | null) => void,
|
7875
7851
|
): void;
|
7852
|
+
|
7876
7853
|
/**
|
7877
|
-
* Passes the key pair
|
7854
|
+
* Passes the key pair identified by `publicKeySpkiDer` for usage with {@link platformKeys.subtleCrypto} to `callback`.
|
7855
|
+
*
|
7878
7856
|
* @param publicKeySpkiDer A DER-encoded X.509 SubjectPublicKeyInfo, obtained e.g. by calling WebCrypto's exportKey function with format="spki".
|
7879
|
-
* @param parameters Provides signature and hash algorithm parameters, in addition to those fixed by the key itself. The same parameters are accepted as by WebCrypto's importKey function, e.g. RsaHashedImportParams for a RSASSA-PKCS1-
|
7880
|
-
*
|
7881
|
-
*
|
7882
|
-
* Optional parameter privateKey: Might be null if this extension does not have access to it.
|
7857
|
+
* @param parameters Provides signature and hash algorithm parameters, in addition to those fixed by the key itself. The same parameters are accepted as by WebCrypto's [importKey](https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey) function, e.g. `RsaHashedImportParams` for a RSASSA-PKCS1-v1\_5 key. For RSASSA-PKCS1-v1\_5 keys, we need to also pass a "hash" parameter `{ "hash": { "name": string } }`. The "hash" parameter represents the name of the hashing algorithm to be used in the digest operation before a sign. It is possible to pass "none" as the hash name, in which case the sign function will apply PKCS#1 v1.5 padding and but not hash the given data.
|
7858
|
+
*
|
7859
|
+
* Currently, this method supports the "ECDSA" algorithm with named-curve P-256 and "RSASSA-PKCS1-v1\_5" algorithm with one of the hashing algorithms "none", "SHA-1", "SHA-256", "SHA-384", and "SHA-512".
|
7883
7860
|
* @since Chrome 85
|
7884
7861
|
*/
|
7885
7862
|
export function getKeyPairBySpki(
|
@@ -7887,14 +7864,19 @@ declare namespace chrome {
|
|
7887
7864
|
parameters: { [key: string]: unknown },
|
7888
7865
|
callback: (publicKey: CryptoKey, privateKey: CryptoKey | null) => void,
|
7889
7866
|
): void;
|
7890
|
-
|
7891
|
-
|
7867
|
+
|
7868
|
+
/** An implementation of WebCrypto's SubtleCrypto that allows crypto operations on keys of client certificates that are available to this extension. */
|
7869
|
+
export function subtleCrypto(): SubtleCrypto | undefined;
|
7870
|
+
|
7892
7871
|
/**
|
7893
|
-
* Checks whether details.serverCertificateChain can be trusted for details.hostname according to the trust settings of the platform. Note: The actual behavior of the trust verification is not fully specified and might change in the future. The API implementation verifies certificate expiration, validates the certification path and checks trust by a known CA. The implementation is supposed to respect the EKU serverAuth and to support subject alternative names.
|
7872
|
+
* Checks whether `details.serverCertificateChain` can be trusted for `details.hostname` according to the trust settings of the platform. Note: The actual behavior of the trust verification is not fully specified and might change in the future. The API implementation verifies certificate expiration, validates the certification path and checks trust by a known CA. The implementation is supposed to respect the EKU serverAuth and to support subject alternative names.
|
7873
|
+
*
|
7874
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 121.
|
7894
7875
|
*/
|
7876
|
+
export function verifyTLSServerCertificate(details: VerificationDetails): Promise<VerificationResult>;
|
7895
7877
|
export function verifyTLSServerCertificate(
|
7896
|
-
details:
|
7897
|
-
callback: (result:
|
7878
|
+
details: VerificationDetails,
|
7879
|
+
callback: (result: VerificationResult) => void,
|
7898
7880
|
): void;
|
7899
7881
|
}
|
7900
7882
|
|
@@ -8957,37 +8939,114 @@ declare namespace chrome {
|
|
8957
8939
|
* Use the `chrome.runtime` API to retrieve the service worker, return details about the manifest, and listen for and respond to events in the extension lifecycle. You can also use this API to convert the relative path of URLs to fully-qualified URLs.
|
8958
8940
|
*/
|
8959
8941
|
export namespace runtime {
|
8960
|
-
/** This
|
8961
|
-
export
|
8942
|
+
/** Populated with an error message if calling an API function fails; otherwise undefined. This is only defined within the scope of that function's callback. If an error is produced, but `runtime.lastError` is not accessed within the callback, a message is logged to the console listing the API function that produced the error. API functions that return promises do not set this property. */
|
8943
|
+
export const lastError: {
|
8944
|
+
/** Details about the error which occurred. */
|
8945
|
+
message?: string;
|
8946
|
+
} | undefined;
|
8947
|
+
|
8962
8948
|
/** The ID of the extension/app. */
|
8963
|
-
export
|
8964
|
-
|
8965
|
-
/**
|
8966
|
-
|
8967
|
-
|
8968
|
-
|
8969
|
-
|
8970
|
-
|
8971
|
-
|
8949
|
+
export const id: string;
|
8950
|
+
|
8951
|
+
/**
|
8952
|
+
* The operating system Chrome is running on.
|
8953
|
+
* @since Chrome 44
|
8954
|
+
*/
|
8955
|
+
export enum PlatformOs {
|
8956
|
+
/** Specifies the MacOS operating system. */
|
8957
|
+
MAC = "mac",
|
8958
|
+
/** Specifies the Windows operating system. */
|
8959
|
+
WIN = "win",
|
8960
|
+
/** Specifies the Android operating system. */
|
8961
|
+
ANDROID = "android",
|
8962
|
+
/** Specifies the Chrome operating system. */
|
8963
|
+
CROS = "cros",
|
8964
|
+
/** Specifies the Linux operating system. */
|
8965
|
+
LINUX = "linux",
|
8966
|
+
/** Specifies the OpenBSD operating system. */
|
8967
|
+
OPENBSD = "openbsd",
|
8968
|
+
/** Specifies the Fuchsia operating system. */
|
8969
|
+
FUCHSIA = "fuchsia",
|
8970
|
+
}
|
8971
|
+
|
8972
|
+
/**
|
8973
|
+
* The machine's processor architecture.
|
8974
|
+
* @since Chrome 44
|
8975
|
+
*/
|
8976
|
+
export enum PlatformArch {
|
8977
|
+
/** Specifies the processer architecture as arm. */
|
8978
|
+
ARM = "arm",
|
8979
|
+
/** Specifies the processer architecture as arm64. */
|
8980
|
+
ARM64 = "arm64",
|
8981
|
+
/** Specifies the processer architecture as x86-32. */
|
8982
|
+
X86_32 = "x86-32",
|
8983
|
+
/** Specifies the processer architecture as x86-64. */
|
8984
|
+
X86_64 = "x86-64",
|
8985
|
+
/** Specifies the processer architecture as mips. */
|
8986
|
+
MIPS = "mips",
|
8987
|
+
/** Specifies the processer architecture as mips64. */
|
8988
|
+
MIPS64 = "mips64",
|
8989
|
+
}
|
8990
|
+
|
8991
|
+
/**
|
8992
|
+
* The native client architecture. This may be different from arch on some platforms.
|
8993
|
+
* @since Chrome 44
|
8994
|
+
*/
|
8995
|
+
export enum PlatformNaclArch {
|
8996
|
+
/** Specifies the native client architecture as arm. */
|
8997
|
+
ARM = "arm",
|
8998
|
+
/** Specifies the native client architecture as x86-32. */
|
8999
|
+
X86_32 = "x86-32",
|
9000
|
+
/** Specifies the native client architecture as x86-64. */
|
9001
|
+
X86_64 = "x86-64",
|
9002
|
+
/** Specifies the native client architecture as mips. */
|
9003
|
+
MIPS = "mips",
|
9004
|
+
/** Specifies the native client architecture as mips64. */
|
9005
|
+
MIPS64 = "mips64",
|
9006
|
+
}
|
9007
|
+
|
9008
|
+
/** @since Chrome 114 */
|
8972
9009
|
export enum ContextType {
|
9010
|
+
/** Specifies the context type as a tab */
|
8973
9011
|
TAB = "TAB",
|
9012
|
+
/** Specifies the context type as an extension popup window */
|
8974
9013
|
POPUP = "POPUP",
|
9014
|
+
/** Specifies the context type as a service worker. */
|
8975
9015
|
BACKGROUND = "BACKGROUND",
|
9016
|
+
/** Specifies the context type as an offscreen document. */
|
8976
9017
|
OFFSCREEN_DOCUMENT = "OFFSCREEN_DOCUMENT",
|
9018
|
+
/** Specifies the context type as a side panel. */
|
8977
9019
|
SIDE_PANEL = "SIDE_PANEL",
|
9020
|
+
/** Specifies the context type as developer tools. */
|
8978
9021
|
DEVELOPER_TOOLS = "DEVELOPER_TOOLS",
|
8979
9022
|
}
|
8980
|
-
|
9023
|
+
|
9024
|
+
/**
|
9025
|
+
* The reason that this event is being dispatched.
|
9026
|
+
* @since Chrome 44
|
9027
|
+
*/
|
8981
9028
|
export enum OnInstalledReason {
|
9029
|
+
/** Specifies the event reason as an installation. */
|
8982
9030
|
INSTALL = "install",
|
9031
|
+
/** Specifies the event reason as an extension update. */
|
8983
9032
|
UPDATE = "update",
|
9033
|
+
/** Specifies the event reason as a Chrome update. */
|
8984
9034
|
CHROME_UPDATE = "chrome_update",
|
9035
|
+
/** Specifies the event reason as an update to a shared module. */
|
8985
9036
|
SHARED_MODULE_UPDATE = "shared_module_update",
|
8986
9037
|
}
|
8987
9038
|
|
8988
|
-
|
8989
|
-
|
8990
|
-
|
9039
|
+
/**
|
9040
|
+
* The reason that the event is being dispatched. 'app_update' is used when the restart is needed because the application is updated to a newer version. 'os_update' is used when the restart is needed because the browser/OS is updated to a newer version. 'periodic' is used when the system runs for more than the permitted uptime set in the enterprise policy.
|
9041
|
+
* @since Chrome 44
|
9042
|
+
*/
|
9043
|
+
export enum OnRestartRequiredReason {
|
9044
|
+
/** Specifies the event reason as an update to the app. */
|
9045
|
+
APP_UPDATE = "app_update",
|
9046
|
+
/** Specifies the event reason as an update to the operating system. */
|
9047
|
+
OS_UPDATE = "os_update",
|
9048
|
+
/** Specifies the event reason as a periodic restart of the app. */
|
9049
|
+
PERIODIC = "periodic",
|
8991
9050
|
}
|
8992
9051
|
|
8993
9052
|
/**
|
@@ -8996,7 +9055,7 @@ declare namespace chrome {
|
|
8996
9055
|
*/
|
8997
9056
|
export interface ContextFilter {
|
8998
9057
|
contextIds?: string[] | undefined;
|
8999
|
-
contextTypes?: ContextType[] | undefined;
|
9058
|
+
contextTypes?: `${ContextType}`[] | undefined;
|
9000
9059
|
documentIds?: string[] | undefined;
|
9001
9060
|
documentOrigins?: string[] | undefined;
|
9002
9061
|
documentUrls?: string[] | undefined;
|
@@ -9007,26 +9066,19 @@ declare namespace chrome {
|
|
9007
9066
|
}
|
9008
9067
|
|
9009
9068
|
export interface ConnectInfo {
|
9069
|
+
/** Will be passed into onConnect for processes that are listening for the connection event. */
|
9010
9070
|
name?: string | undefined;
|
9071
|
+
/** Whether the TLS channel ID will be passed into onConnectExternal for processes that are listening for the connection event. */
|
9011
9072
|
includeTlsChannelId?: boolean | undefined;
|
9012
9073
|
}
|
9013
9074
|
|
9014
9075
|
export interface InstalledDetails {
|
9015
|
-
/**
|
9016
|
-
* The reason that this event is being dispatched.
|
9017
|
-
*/
|
9076
|
+
/** The reason that this event is being dispatched. */
|
9018
9077
|
reason: `${OnInstalledReason}`;
|
9019
|
-
/**
|
9020
|
-
|
9021
|
-
|
9022
|
-
|
9023
|
-
previousVersion?: string | undefined;
|
9024
|
-
/**
|
9025
|
-
* Optional.
|
9026
|
-
* Indicates the ID of the imported shared module extension which updated. This is present only if 'reason' is 'shared_module_update'.
|
9027
|
-
* @since Chrome 29
|
9028
|
-
*/
|
9029
|
-
id?: string | undefined;
|
9078
|
+
/** Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'. */
|
9079
|
+
previousVersion?: string;
|
9080
|
+
/** Indicates the ID of the imported shared module extension which updated. This is present only if 'reason' is 'shared_module_update'. */
|
9081
|
+
id?: string;
|
9030
9082
|
}
|
9031
9083
|
|
9032
9084
|
/**
|
@@ -9037,29 +9089,20 @@ declare namespace chrome {
|
|
9037
9089
|
/** A unique identifier for this context */
|
9038
9090
|
contextId: string;
|
9039
9091
|
/** The type of context this corresponds to. */
|
9040
|
-
contextType: ContextType
|
9041
|
-
/**
|
9042
|
-
|
9043
|
-
|
9044
|
-
|
9045
|
-
|
9046
|
-
|
9047
|
-
|
9048
|
-
* The origin of the document associated with this context, or undefined if the context is not hosted in a document.
|
9049
|
-
*/
|
9050
|
-
documentOrigin?: string | undefined;
|
9051
|
-
/**
|
9052
|
-
* Optional.
|
9053
|
-
* The URL of the document associated with this context, or undefined if the context is not hosted in a document.
|
9054
|
-
*/
|
9055
|
-
documentUrl?: string | undefined;
|
9056
|
-
/** The ID of the frame for this context, or -1 if this context is not hosted in a frame. */
|
9092
|
+
contextType: `${ContextType}`;
|
9093
|
+
/** A UUID for the document associated with this context, or undefined if this context is hosted not in a document.*/
|
9094
|
+
documentId?: string;
|
9095
|
+
/** The origin of the document associated with this context, or undefined if the context is not hosted in a document. */
|
9096
|
+
documentOrigin?: string;
|
9097
|
+
/** The URL of the document associated with this context, or undefined if the context is not hosted in a document. */
|
9098
|
+
documentUrl?: string;
|
9099
|
+
/** The ID of the frame for this context, or `-1` if this context is not hosted in a frame. */
|
9057
9100
|
frameId: number;
|
9058
9101
|
/** Whether the context is associated with an incognito profile. */
|
9059
9102
|
incognito: boolean;
|
9060
|
-
/** The ID of the tab for this context, or
|
9103
|
+
/** The ID of the tab for this context, or `-1` if this context is not hosted in a tab. */
|
9061
9104
|
tabId: number;
|
9062
|
-
/** The ID of the window for this context, or
|
9105
|
+
/** The ID of the window for this context, or `-1` if this context is not hosted in a window. */
|
9063
9106
|
windowId: number;
|
9064
9107
|
}
|
9065
9108
|
|
@@ -9068,132 +9111,91 @@ declare namespace chrome {
|
|
9068
9111
|
includeTlsChannelId?: boolean | undefined;
|
9069
9112
|
}
|
9070
9113
|
|
9071
|
-
/**
|
9072
|
-
* An object containing information about the script context that sent a message or request.
|
9073
|
-
* @since Chrome 26
|
9074
|
-
*/
|
9114
|
+
/** An object containing information about the script context that sent a message or request */
|
9075
9115
|
export interface MessageSender {
|
9076
|
-
/** The ID of the extension
|
9077
|
-
id?: string
|
9078
|
-
/** The tabs.Tab which opened the connection, if any. This property will only be present when the connection was opened from a tab (including content scripts), and only if the receiver is an extension, not an app. */
|
9079
|
-
tab?: chrome.tabs.Tab
|
9080
|
-
/**
|
9116
|
+
/** The ID of the extension that opened the connection, if any. */
|
9117
|
+
id?: string;
|
9118
|
+
/** The {@link tabs.Tab} which opened the connection, if any. This property will **only** be present when the connection was opened from a tab (including content scripts), and **only** if the receiver is an extension, not an app. */
|
9119
|
+
tab?: chrome.tabs.Tab;
|
9120
|
+
/**
|
9121
|
+
* The name of the native application that opened the connection, if any.
|
9081
9122
|
* @since Chrome 74
|
9082
9123
|
*/
|
9083
|
-
nativeApplication?: string
|
9124
|
+
nativeApplication?: string;
|
9125
|
+
/** The frame that opened the connection. 0 for top-level frames, positive for child frames. This will only be set when tab is set. */
|
9126
|
+
frameId?: number;
|
9127
|
+
/** The URL of the page or frame that opened the connection. If the sender is in an iframe, it will be iframe's URL not the URL of the page which hosts it. */
|
9128
|
+
url?: string;
|
9129
|
+
/** The TLS channel ID of the page or frame that opened the connection, if requested by the extension, and if available */
|
9130
|
+
tlsChannelId?: string;
|
9084
9131
|
/**
|
9085
|
-
* The frame that opened the connection.
|
9086
|
-
* @since Chrome
|
9132
|
+
* The origin of the page or frame that opened the connection. It can vary from the url property (e.g., about:blank) or can be opaque (e.g., sandboxed iframes). This is useful for identifying if the origin can be trusted if we can't immediately tell from the URL.
|
9133
|
+
* @since Chrome 80
|
9087
9134
|
*/
|
9088
|
-
|
9089
|
-
/**
|
9090
|
-
* The URL of the page or frame that opened the connection. If the sender is in an iframe, it will be iframe's URL not the URL of the page which hosts it.
|
9091
|
-
* @since Chrome 28
|
9092
|
-
*/
|
9093
|
-
url?: string | undefined;
|
9094
|
-
/**
|
9095
|
-
* The TLS channel ID of the page or frame that opened the connection, if requested by the extension or app, and if available.
|
9096
|
-
* @since Chrome 32
|
9097
|
-
*/
|
9098
|
-
tlsChannelId?: string | undefined;
|
9099
|
-
/**
|
9100
|
-
* The origin of the page or frame that opened the connection. It can vary from the url property (e.g., about:blank) or can be opaque (e.g., sandboxed iframes). This is useful for identifying if the origin can be trusted if we can't immediately tell from the URL.
|
9101
|
-
* @since Chrome 80
|
9102
|
-
*/
|
9103
|
-
origin?: string | undefined;
|
9135
|
+
origin?: string;
|
9104
9136
|
/**
|
9105
9137
|
* The lifecycle the document that opened the connection is in at the time the port was created. Note that the lifecycle state of the document may have changed since port creation.
|
9106
9138
|
* @since Chrome 106
|
9107
9139
|
*/
|
9108
|
-
documentLifecycle?: extensionTypes.DocumentLifecycle
|
9140
|
+
documentLifecycle?: extensionTypes.DocumentLifecycle;
|
9109
9141
|
/**
|
9110
9142
|
* A UUID of the document that opened the connection.
|
9111
9143
|
* @since Chrome 106
|
9112
9144
|
*/
|
9113
|
-
documentId?: string
|
9145
|
+
documentId?: string;
|
9114
9146
|
}
|
9115
9147
|
|
9116
|
-
/**
|
9117
|
-
* An object containing information about the current platform.
|
9118
|
-
* @since Chrome 36
|
9119
|
-
*/
|
9148
|
+
/** An object containing information about the current platform. */
|
9120
9149
|
export interface PlatformInfo {
|
9121
|
-
/**
|
9122
|
-
|
9123
|
-
|
9124
|
-
|
9125
|
-
/**
|
9126
|
-
|
9127
|
-
*/
|
9128
|
-
arch: PlatformArch;
|
9129
|
-
/**
|
9130
|
-
* The native client architecture. This may be different from arch on some platforms.
|
9131
|
-
*/
|
9132
|
-
nacl_arch: PlatformNaclArch;
|
9150
|
+
/** The operating system Chrome is running on. */
|
9151
|
+
os: `${PlatformOs}`;
|
9152
|
+
/** The machine's processor architecture. */
|
9153
|
+
arch: `${PlatformArch}`;
|
9154
|
+
/** The native client architecture. This may be different from arch on some platforms. */
|
9155
|
+
nacl_arch: `${PlatformNaclArch}`;
|
9133
9156
|
}
|
9134
9157
|
|
9135
|
-
/**
|
9136
|
-
* An object which allows two way communication with other pages.
|
9137
|
-
* @since Chrome 26
|
9138
|
-
*/
|
9158
|
+
/** An object which allows two way communication with other pages. */
|
9139
9159
|
export interface Port {
|
9160
|
+
/** Send a message to the other end of the port. If the port is disconnected, an error is thrown. */
|
9140
9161
|
postMessage: (message: any) => void;
|
9162
|
+
/** Immediately disconnect the port. Calling `disconnect()` on an already-disconnected port has no effect. When a port is disconnected, no new events will be dispatched to this port. */
|
9141
9163
|
disconnect: () => void;
|
9142
|
-
/**
|
9143
|
-
|
9144
|
-
|
9145
|
-
|
9146
|
-
|
9147
|
-
|
9148
|
-
|
9149
|
-
/** An object which allows the addition and removal of listeners for a Chrome event. */
|
9150
|
-
onMessage: PortMessageEvent;
|
9164
|
+
/** This property will **only** be present on ports passed to {@link runtime.onConnect onConnect} / {@link runtime.onConnectExternal onConnectExternal} / {@link runtime.onConnectExternal onConnectNative} listeners. */
|
9165
|
+
sender?: MessageSender;
|
9166
|
+
/** Fired when the port is disconnected from the other end(s). {@link runtime.lastError} may be set if the port was disconnected by an error. If the port is closed via {@link Port.disconnect disconnect}, then this event is _only_ fired on the other end. This event is fired at most once (see also Port lifetime). */
|
9167
|
+
onDisconnect: events.Event<(port: Port) => void>;
|
9168
|
+
/** This event is fired when {@link Port.postMessage postMessage} is called by the other end of the port. */
|
9169
|
+
onMessage: events.Event<(message: any, port: Port) => void>;
|
9170
|
+
/** The name of the port, as specified in the call to {@link runtime.connect}. */
|
9151
9171
|
name: string;
|
9152
9172
|
}
|
9153
9173
|
|
9154
|
-
export interface UpdateAvailableDetails {
|
9155
|
-
/** The version number of the available update. */
|
9156
|
-
version: string;
|
9157
|
-
}
|
9158
|
-
|
9159
9174
|
export interface UpdateCheckDetails {
|
9160
9175
|
/** The version of the available update. */
|
9161
9176
|
version: string;
|
9162
9177
|
}
|
9163
9178
|
|
9164
|
-
/**
|
9165
|
-
|
9179
|
+
/**
|
9180
|
+
* Result of the update check.
|
9181
|
+
* @since Chrome 44
|
9182
|
+
*/
|
9183
|
+
export enum RequestUpdateCheckStatus {
|
9184
|
+
/** Specifies that the status check has been throttled. This can occur after repeated checks within a short amount of time. */
|
9185
|
+
THROTTLED = "throttled",
|
9186
|
+
/** Specifies that there are no available updates to install. */
|
9187
|
+
NO_UPDATE = "no_update",
|
9188
|
+
/** Specifies that there is an available update to install. */
|
9189
|
+
UPDATE_AVAILABLE = "update_available",
|
9190
|
+
}
|
9166
9191
|
|
9167
|
-
/** Result of the update check. */
|
9168
9192
|
export interface RequestUpdateCheckResult {
|
9169
|
-
/**
|
9170
|
-
status: RequestUpdateCheckStatus
|
9171
|
-
/**
|
9172
|
-
version
|
9193
|
+
/** Result of the update check. */
|
9194
|
+
status: `${RequestUpdateCheckStatus}`;
|
9195
|
+
/** If an update is available, this contains the version of the available update. */
|
9196
|
+
version?: string;
|
9173
9197
|
}
|
9174
9198
|
|
9175
|
-
export interface PortDisconnectEvent extends chrome.events.Event<(port: Port) => void> {}
|
9176
|
-
|
9177
|
-
export interface PortMessageEvent extends chrome.events.Event<(message: any, port: Port) => void> {}
|
9178
|
-
|
9179
|
-
export interface ExtensionMessageEvent extends
|
9180
|
-
chrome.events.Event<
|
9181
|
-
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
9182
|
-
>
|
9183
|
-
{}
|
9184
|
-
|
9185
|
-
export interface ExtensionConnectEvent extends chrome.events.Event<(port: Port) => void> {}
|
9186
|
-
|
9187
|
-
export interface RuntimeInstalledEvent extends chrome.events.Event<(details: InstalledDetails) => void> {}
|
9188
|
-
|
9189
|
-
export interface RuntimeEvent extends chrome.events.Event<() => void> {}
|
9190
|
-
|
9191
|
-
export interface RuntimeRestartRequiredEvent extends chrome.events.Event<(reason: string) => void> {}
|
9192
|
-
|
9193
|
-
export interface RuntimeUpdateAvailableEvent
|
9194
|
-
extends chrome.events.Event<(details: UpdateAvailableDetails) => void>
|
9195
|
-
{}
|
9196
|
-
|
9197
9199
|
export interface ManifestIcons {
|
9198
9200
|
[size: number]: string;
|
9199
9201
|
}
|
@@ -9569,282 +9571,225 @@ declare namespace chrome {
|
|
9569
9571
|
export type Manifest = ManifestV2 | ManifestV3;
|
9570
9572
|
|
9571
9573
|
/**
|
9572
|
-
* Attempts to connect
|
9573
|
-
*
|
9574
|
+
* Attempts to connect listeners within an extension (such as the background page), or other extensions/apps. This is useful for content scripts connecting to their extension processes, inter-app/extension communication, and web messaging. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via {@link tabs.connect}.
|
9575
|
+
*
|
9576
|
+
* @param extensionId The ID of the extension to connect to. If omitted, a connection will be attempted with your own extension. Required if sending messages from a web page for web messaging.
|
9577
|
+
* @returns Port through which messages can be sent and received. The port's {@link Port onDisconnect} event is fired if the extension does not exist.
|
9574
9578
|
*/
|
9575
9579
|
export function connect(connectInfo?: ConnectInfo): Port;
|
9580
|
+
export function connect(extensionId: string | undefined, connectInfo?: ConnectInfo): Port;
|
9581
|
+
|
9576
9582
|
/**
|
9577
|
-
*
|
9578
|
-
* @since Chrome 26
|
9579
|
-
* @param extensionId Optional.
|
9580
|
-
* The ID of the extension or app to connect to. If omitted, a connection will be attempted with your own extension. Required if sending messages from a web page for web messaging.
|
9581
|
-
*/
|
9582
|
-
export function connect(extensionId: string, connectInfo?: ConnectInfo): Port;
|
9583
|
-
/**
|
9584
|
-
* Connects to a native application in the host machine.
|
9585
|
-
* @since Chrome 28
|
9583
|
+
* Connects to a native application in the host machine. This method requires the `"nativeMessaging"` permission. See Native Messaging for more information.
|
9586
9584
|
* @param application The name of the registered application to connect to.
|
9587
9585
|
*/
|
9588
9586
|
export function connectNative(application: string): Port;
|
9589
9587
|
/**
|
9590
9588
|
* Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.
|
9591
|
-
*
|
9589
|
+
*
|
9590
|
+
* Foreground only
|
9591
|
+
*
|
9592
|
+
* Can return its result via Promise since Chrome 99.
|
9593
|
+
* @deprecated since Chrome 133. Background pages do not exist in MV3 extensions.
|
9592
9594
|
*/
|
9593
|
-
export function getBackgroundPage(): Promise<Window>;
|
9594
|
-
/** Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set. */
|
9595
|
+
export function getBackgroundPage(): Promise<Window | undefined>;
|
9595
9596
|
export function getBackgroundPage(callback: (backgroundPage?: Window) => void): void;
|
9597
|
+
|
9596
9598
|
/**
|
9597
9599
|
* Fetches information about active contexts associated with this extension
|
9598
|
-
* @since Chrome 116 MV3.
|
9599
|
-
* @return Provides the matching context, if any via callback or returned as a `Promise` (MV3 only).
|
9600
9600
|
* @param filter A filter to find matching contexts. A context matches if it matches all specified fields in the filter. Any unspecified field in the filter matches all contexts.
|
9601
|
-
*/
|
9602
|
-
export function getContexts(filter: ContextFilter): Promise<ExtensionContext[]>;
|
9603
|
-
/**
|
9604
|
-
* Fetches information about active contexts associated with this extension
|
9605
9601
|
* @since Chrome 116 MV3.
|
9606
|
-
* @return Provides the matching context, if any via callback or returned as a `Promise` (MV3 only).
|
9607
|
-
* @param filter A filter to find matching contexts. A context matches if it matches all specified fields in the filter. Any unspecified field in the filter matches all contexts.
|
9608
|
-
* @param callback Called with results
|
9609
9602
|
*/
|
9603
|
+
export function getContexts(filter: ContextFilter): Promise<ExtensionContext[]>;
|
9610
9604
|
export function getContexts(filter: ContextFilter, callback: (contexts: ExtensionContext[]) => void): void;
|
9605
|
+
|
9611
9606
|
/**
|
9612
9607
|
* Returns details about the app or extension from the manifest. The object returned is a serialization of the full manifest file.
|
9613
9608
|
* @return The manifest details.
|
9614
9609
|
*/
|
9615
9610
|
export function getManifest(): Manifest;
|
9611
|
+
|
9616
9612
|
/**
|
9617
9613
|
* Returns a DirectoryEntry for the package directory.
|
9618
|
-
*
|
9614
|
+
*
|
9615
|
+
* Foreground only
|
9616
|
+
*
|
9617
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 122.
|
9619
9618
|
*/
|
9619
|
+
export function getPackageDirectoryEntry(): Promise<DirectoryEntry>;
|
9620
9620
|
export function getPackageDirectoryEntry(callback: (directoryEntry: DirectoryEntry) => void): void;
|
9621
|
+
|
9621
9622
|
/**
|
9622
9623
|
* Returns information about the current platform.
|
9623
|
-
*
|
9624
|
-
*
|
9625
|
-
*/
|
9626
|
-
export function getPlatformInfo(callback: (platformInfo: PlatformInfo) => void): void;
|
9627
|
-
/**
|
9628
|
-
* Returns information about the current platform.
|
9629
|
-
* @since Chrome 29
|
9630
|
-
* @return The `getPlatformInfo` method provides its result via callback or returned as a `Promise` (MV3 only).
|
9624
|
+
*
|
9625
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
9631
9626
|
*/
|
9632
9627
|
export function getPlatformInfo(): Promise<PlatformInfo>;
|
9628
|
+
export function getPlatformInfo(callback: (platformInfo: PlatformInfo) => void): void;
|
9629
|
+
|
9633
9630
|
/**
|
9634
9631
|
* Converts a relative path within an app/extension install directory to a fully-qualified URL.
|
9635
9632
|
* @param path A path to a resource within an app/extension expressed relative to its install directory.
|
9633
|
+
* @returns The fully-qualified URL to the resource.
|
9636
9634
|
*/
|
9637
9635
|
export function getURL(path: string): string;
|
9638
|
-
|
9639
|
-
|
9640
|
-
* @since Chrome 25
|
9641
|
-
*/
|
9636
|
+
|
9637
|
+
/** Reloads the app or extension. This method is not supported in kiosk mode. For kiosk mode, use {@link chrome.runtime.restart()} method. */
|
9642
9638
|
export function reload(): void;
|
9639
|
+
|
9643
9640
|
/**
|
9644
|
-
* Requests an update check for this app/extension.
|
9645
|
-
*
|
9646
|
-
*
|
9641
|
+
* Requests an immediate update check be done for this app/extension.
|
9642
|
+
*
|
9643
|
+
* **Important**: Most extensions/apps should **not** use this method, since Chrome already does automatic checks every few hours, and you can listen for the {@link runtime.onUpdateAvailable} event without needing to call requestUpdateCheck.
|
9644
|
+
*
|
9645
|
+
* This method is only appropriate to call in very limited circumstances, such as if your extension talks to a backend service, and the backend service has determined that the client extension version is very far out of date and you'd like to prompt a user to update. Most other uses of requestUpdateCheck, such as calling it unconditionally based on a repeating timer, probably only serve to waste client, network, and server resources.
|
9646
|
+
*
|
9647
|
+
* Note: When called with a callback, instead of returning an object this function will return the two properties as separate arguments passed to the callback.
|
9648
|
+
*
|
9649
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 109.
|
9647
9650
|
*/
|
9648
9651
|
export function requestUpdateCheck(): Promise<RequestUpdateCheckResult>;
|
9649
|
-
/**
|
9650
|
-
* Requests an update check for this app/extension.
|
9651
|
-
* @since Chrome 25
|
9652
|
-
* @param callback
|
9653
|
-
* Parameter status: Result of the update check. One of: "throttled", "no_update", or "update_available"
|
9654
|
-
* Optional parameter details: If an update is available, this contains more information about the available update.
|
9655
|
-
*/
|
9656
9652
|
export function requestUpdateCheck(
|
9657
|
-
callback: (status: RequestUpdateCheckStatus
|
9653
|
+
callback: (status: `${RequestUpdateCheckStatus}`, details?: { version: string }) => void,
|
9658
9654
|
): void;
|
9659
|
-
|
9660
|
-
|
9661
|
-
* @since Chrome 32
|
9662
|
-
*/
|
9655
|
+
|
9656
|
+
/** Restart the ChromeOS device when the app runs in kiosk mode. Otherwise, it's no-op. */
|
9663
9657
|
export function restart(): void;
|
9658
|
+
|
9664
9659
|
/**
|
9665
|
-
* Restart the ChromeOS device when the app runs in kiosk mode after the
|
9666
|
-
*
|
9667
|
-
*
|
9668
|
-
* cancelled. It's a no-op in non-kiosk mode. It's only allowed to be
|
9669
|
-
* called repeatedly by the first extension to invoke this API.
|
9660
|
+
* Restart the ChromeOS device when the app runs in kiosk mode after the given seconds. If called again before the time ends, the reboot will be delayed. If called with a value of `-1`, the reboot will be cancelled. It's a no-op in non-kiosk mode. It's only allowed to be called repeatedly by the first extension to invoke this API.
|
9661
|
+
*
|
9662
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
9670
9663
|
* @since Chrome 53
|
9671
|
-
* @param seconds
|
9672
|
-
* @param callback
|
9673
|
-
*/
|
9674
|
-
export function restartAfterDelay(seconds: number, callback?: () => void): void;
|
9675
|
-
/**
|
9676
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
9677
|
-
* @since Chrome 26
|
9678
|
-
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
9679
9664
|
*/
|
9680
|
-
export function
|
9665
|
+
export function restartAfterDelay(seconds: number): Promise<void>;
|
9666
|
+
export function restartAfterDelay(seconds: number, callback: () => void): void;
|
9667
|
+
|
9681
9668
|
/**
|
9682
|
-
* Sends a single message to event listeners within your extension
|
9683
|
-
*
|
9684
|
-
*
|
9669
|
+
* Sends a single message to event listeners within your extension or a different extension/app. Similar to {@link runtime.connect} but only sends a single message, with an optional response. If sending to your extension, the {@link runtime.onMessage} event will be fired in every frame of your extension (except for the sender's frame), or {@link runtime.onMessageExternal}, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use {@link tabs.sendMessage}.
|
9670
|
+
*
|
9671
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
9672
|
+
* @param extensionId The ID of the extension to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
9673
|
+
* @param message The message to send. This message should be a JSON-ifiable object.
|
9685
9674
|
*/
|
9675
|
+
export function sendMessage<M = any, R = any>(message: M, options?: MessageOptions): Promise<R>;
|
9676
|
+
export function sendMessage<M = any, R = any>(message: M, callback: (response: R) => void): void;
|
9686
9677
|
export function sendMessage<M = any, R = any>(
|
9687
9678
|
message: M,
|
9688
|
-
options: MessageOptions,
|
9689
|
-
|
9679
|
+
options: MessageOptions | undefined,
|
9680
|
+
callback: (response: R) => void,
|
9690
9681
|
): void;
|
9691
|
-
/**
|
9692
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
9693
|
-
* @since Chrome 26
|
9694
|
-
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
9695
|
-
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
9696
|
-
*/
|
9697
9682
|
export function sendMessage<M = any, R = any>(
|
9698
9683
|
extensionId: string | undefined | null,
|
9699
9684
|
message: M,
|
9700
|
-
|
9701
|
-
):
|
9702
|
-
|
9703
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
9704
|
-
* @since Chrome 32
|
9705
|
-
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
9706
|
-
* Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
9707
|
-
*/
|
9708
|
-
export function sendMessage<Message = any, Response = any>(
|
9685
|
+
options?: MessageOptions,
|
9686
|
+
): Promise<R>;
|
9687
|
+
export function sendMessage<M = any, R = any>(
|
9709
9688
|
extensionId: string | undefined | null,
|
9710
|
-
message:
|
9711
|
-
|
9712
|
-
responseCallback: (response: Response) => void,
|
9689
|
+
message: M,
|
9690
|
+
callback: (response: R) => void,
|
9713
9691
|
): void;
|
9714
|
-
/**
|
9715
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
9716
|
-
* @since Chrome 26
|
9717
|
-
*/
|
9718
|
-
export function sendMessage<M = any, R = any>(message: M): Promise<R>;
|
9719
|
-
/**
|
9720
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
9721
|
-
* @since Chrome 32
|
9722
|
-
*/
|
9723
9692
|
export function sendMessage<M = any, R = any>(
|
9724
|
-
message: M,
|
9725
|
-
options: MessageOptions,
|
9726
|
-
): Promise<R>;
|
9727
|
-
/**
|
9728
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
9729
|
-
* @since Chrome 26
|
9730
|
-
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
9731
|
-
*/
|
9732
|
-
export function sendMessage<M = any, R = any>(extensionId: string | undefined | null, message: M): Promise<R>;
|
9733
|
-
/**
|
9734
|
-
* Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage.
|
9735
|
-
* @since Chrome 32
|
9736
|
-
* @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging.
|
9737
|
-
*/
|
9738
|
-
export function sendMessage<Message = any, Response = any>(
|
9739
9693
|
extensionId: string | undefined | null,
|
9740
|
-
message:
|
9741
|
-
options: MessageOptions,
|
9742
|
-
|
9743
|
-
/**
|
9744
|
-
* Send a single message to a native application.
|
9745
|
-
* @since Chrome 28
|
9746
|
-
* @param application The of the native messaging host.
|
9747
|
-
* @param message The message that will be passed to the native messaging host.
|
9748
|
-
* Parameter response: The response message sent by the native messaging host. If an error occurs while connecting to the native messaging host, the callback will be called with no arguments and runtime.lastError will be set to the error message.
|
9749
|
-
*/
|
9750
|
-
export function sendNativeMessage(
|
9751
|
-
application: string,
|
9752
|
-
message: object,
|
9753
|
-
responseCallback: (response: any) => void,
|
9694
|
+
message: M,
|
9695
|
+
options: MessageOptions | undefined,
|
9696
|
+
callback: (response: R) => void,
|
9754
9697
|
): void;
|
9698
|
+
|
9755
9699
|
/**
|
9756
|
-
* Send a single message to a native application.
|
9757
|
-
*
|
9758
|
-
*
|
9700
|
+
* Send a single message to a native application. This method requires the `"nativeMessaging"` permission
|
9701
|
+
*
|
9702
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
9703
|
+
* @param application The name of the native messaging host.
|
9759
9704
|
* @param message The message that will be passed to the native messaging host.
|
9760
9705
|
*/
|
9706
|
+
export function sendNativeMessage(application: string, message: object): Promise<any>;
|
9761
9707
|
export function sendNativeMessage(
|
9762
9708
|
application: string,
|
9763
9709
|
message: object,
|
9764
|
-
|
9710
|
+
callback: (response: any) => void,
|
9711
|
+
): void;
|
9712
|
+
|
9765
9713
|
/**
|
9766
|
-
* Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum
|
9767
|
-
*
|
9768
|
-
*
|
9769
|
-
* URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. Set an empty string to not open a new tab upon uninstallation.
|
9770
|
-
* @param callback Called when the uninstall URL is set. If the given URL is invalid, runtime.lastError will be set.
|
9714
|
+
* Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 1023 characters.
|
9715
|
+
*
|
9716
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99.
|
9717
|
+
* @param url URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. Set an empty string to not open a new tab upon uninstallation.
|
9771
9718
|
*/
|
9772
|
-
export function setUninstallURL(url: string
|
9719
|
+
export function setUninstallURL(url: string): Promise<void>;
|
9720
|
+
export function setUninstallURL(url: string, callback: () => void): void;
|
9721
|
+
|
9773
9722
|
/**
|
9774
9723
|
* Open your Extension's options page, if possible.
|
9724
|
+
*
|
9775
9725
|
* The precise behavior may depend on your manifest's options_ui or options_page key, or what Chrome happens to support at the time. For example, the page may be opened in a new tab, within chrome://extensions, within an App, or it may just focus an open options page. It will never cause the caller page to reload.
|
9776
|
-
*
|
9777
|
-
* @
|
9726
|
+
*
|
9727
|
+
* If your Extension does not declare an options page, or Chrome failed to create one for some other reason, the callback will set {@link runtime.lastError lastError} .
|
9728
|
+
*
|
9729
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 99
|
9778
9730
|
*/
|
9779
9731
|
export function openOptionsPage(): Promise<void>;
|
9780
|
-
|
9781
|
-
|
9782
|
-
|
9783
|
-
|
9784
|
-
|
9785
|
-
|
9786
|
-
export
|
9732
|
+
export function openOptionsPage(callback: () => void): void;
|
9733
|
+
|
9734
|
+
/** Fired when a connection is made from either an extension process or a content script (by {@link runtime.connect}). */
|
9735
|
+
export const onConnect: events.Event<(port: Port) => void>;
|
9736
|
+
|
9737
|
+
/** Fired when a connection is made from another extension (by {@link runtime.connect}), or from an externally connectable web site. */
|
9738
|
+
export const onConnectExternal: events.Event<(port: Port) => void>;
|
9787
9739
|
|
9788
9740
|
/**
|
9789
|
-
* Fired when a connection is made from
|
9790
|
-
* @since Chrome
|
9741
|
+
* Fired when a connection is made from a native application. This event requires the `"nativeMessaging"` permission. It is only supported on Chrome OS.
|
9742
|
+
* @since Chrome 76
|
9791
9743
|
*/
|
9792
|
-
export
|
9793
|
-
|
9794
|
-
* Fired when a connection is made from another extension.
|
9795
|
-
* @since Chrome 26
|
9796
|
-
*/
|
9797
|
-
export var onConnectExternal: ExtensionConnectEvent;
|
9744
|
+
export const onConnectNative: events.Event<(port: Port) => void>;
|
9745
|
+
|
9798
9746
|
/** Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. */
|
9799
|
-
export
|
9800
|
-
|
9801
|
-
|
9802
|
-
|
9803
|
-
|
9804
|
-
export var onStartup: RuntimeEvent;
|
9747
|
+
export const onSuspend: events.Event<() => void>;
|
9748
|
+
|
9749
|
+
/** Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started, even if this extension is operating in 'split' incognito mode. */
|
9750
|
+
export const onStartup: events.Event<() => void>;
|
9751
|
+
|
9805
9752
|
/** Fired when the extension is first installed, when the extension is updated to a new version, and when Chrome is updated to a new version. */
|
9806
|
-
export
|
9753
|
+
export const onInstalled: events.Event<(details: InstalledDetails) => void>;
|
9754
|
+
|
9807
9755
|
/** Sent after onSuspend to indicate that the app won't be unloaded after all. */
|
9808
|
-
export
|
9809
|
-
|
9810
|
-
|
9811
|
-
|
9812
|
-
|
9813
|
-
|
9814
|
-
|
9815
|
-
|
9816
|
-
|
9817
|
-
|
9818
|
-
|
9819
|
-
|
9820
|
-
|
9821
|
-
|
9822
|
-
|
9823
|
-
|
9824
|
-
|
9825
|
-
|
9826
|
-
* @since Chrome 25
|
9827
|
-
*/
|
9828
|
-
export var onUpdateAvailable: RuntimeUpdateAvailableEvent;
|
9756
|
+
export const onSuspendCanceled: events.Event<() => void>;
|
9757
|
+
|
9758
|
+
/** Fired when a message is sent from either an extension process (by {@link runtime.sendMessage}) or a content script (by {@link tabs.sendMessage}). */
|
9759
|
+
export const onMessage: events.Event<
|
9760
|
+
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
9761
|
+
>;
|
9762
|
+
|
9763
|
+
/** Fired when a message is sent from another extension (by {@link runtime.sendMessage}). Cannot be used in a content script. */
|
9764
|
+
export const onMessageExternal: events.Event<
|
9765
|
+
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
9766
|
+
>;
|
9767
|
+
|
9768
|
+
/** Fired when an app or the device that it runs on needs to be restarted. The app should close all its windows at its earliest convenient time to let the restart to happen. If the app does nothing, a restart will be enforced after a 24-hour grace period has passed. Currently, this event is only fired for Chrome OS kiosk apps. */
|
9769
|
+
export const onRestartRequired: events.Event<(reason: `${OnRestartRequiredReason}`) => void>;
|
9770
|
+
|
9771
|
+
/** Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call chrome.runtime.reload(). If your extension is using a persistent background page, the background page of course never gets unloaded, so unless you call chrome.runtime.reload() manually in response to this event the update will not get installed until the next time Chrome itself restarts. If no handlers are listening for this event, and your extension has a persistent background page, it behaves as if chrome.runtime.reload() is called in response to this event. */
|
9772
|
+
export const onUpdateAvailable: events.Event<(details: { version: string }) => void>;
|
9773
|
+
|
9829
9774
|
/**
|
9830
|
-
* @deprecated since Chrome 33. Please use chrome.runtime.onRestartRequired.
|
9831
9775
|
* Fired when a Chrome update is available, but isn't installed immediately because a browser restart is required.
|
9776
|
+
* @deprecated Please use {@link runtime.onRestartRequired}.
|
9832
9777
|
*/
|
9833
|
-
export
|
9778
|
+
export const onBrowserUpdateAvailable: events.Event<() => void>;
|
9834
9779
|
|
9835
9780
|
/**
|
9836
|
-
*
|
9837
|
-
* @
|
9838
|
-
* Listens for connections made from user scripts associated with this extension.
|
9781
|
+
* Fired when a connection is made from a user script from this extension.
|
9782
|
+
* @since chrome 115 MV3
|
9839
9783
|
*/
|
9840
|
-
export
|
9784
|
+
export const onUserScriptConnect: events.Event<(port: Port) => void>;
|
9841
9785
|
|
9842
9786
|
/**
|
9843
|
-
*
|
9844
|
-
* @
|
9845
|
-
* Listens for messages sent from user scripts associated with this extension.
|
9787
|
+
* Fired when a message is sent from a user script associated with the same extension.
|
9788
|
+
* @since chrome 115, MV3
|
9846
9789
|
*/
|
9847
|
-
export
|
9790
|
+
export const onUserScriptMessage: events.Event<
|
9791
|
+
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
9792
|
+
>;
|
9848
9793
|
}
|
9849
9794
|
|
9850
9795
|
////////////////////
|
@@ -12455,6 +12400,11 @@ declare namespace chrome {
|
|
12455
12400
|
color: `${Color}`;
|
12456
12401
|
/** The ID of the group. Group IDs are unique within a browser session. */
|
12457
12402
|
id: number;
|
12403
|
+
/**
|
12404
|
+
* Whether the group is shared.
|
12405
|
+
* @since Chrome 137
|
12406
|
+
*/
|
12407
|
+
shared: boolean;
|
12458
12408
|
/** The title of the group. */
|
12459
12409
|
title?: string;
|
12460
12410
|
/** The ID of the window that contains the group. */
|
@@ -12470,13 +12420,18 @@ declare namespace chrome {
|
|
12470
12420
|
|
12471
12421
|
export interface QueryInfo {
|
12472
12422
|
/** Whether the groups are collapsed. */
|
12473
|
-
collapsed?: boolean;
|
12423
|
+
collapsed?: boolean | undefined;
|
12474
12424
|
/** The color of the groups. */
|
12475
|
-
color?: `${Color}
|
12425
|
+
color?: `${Color}` | undefined;
|
12426
|
+
/**
|
12427
|
+
* Whether the group is shared.
|
12428
|
+
* @since Chrome 137
|
12429
|
+
*/
|
12430
|
+
shared?: boolean | undefined;
|
12476
12431
|
/** Match group titles against a pattern. */
|
12477
|
-
title?: string;
|
12432
|
+
title?: string | undefined;
|
12478
12433
|
/** The ID of the parent window, or {@link windows.WINDOW_ID_CURRENT} for the current window. */
|
12479
|
-
windowId?: number;
|
12434
|
+
windowId?: number | undefined;
|
12480
12435
|
}
|
12481
12436
|
|
12482
12437
|
export interface UpdateProperties {
|
@@ -13892,334 +13847,231 @@ declare namespace chrome {
|
|
13892
13847
|
* Permissions: The chrome.windows API can be used without declaring any permission. However, the "tabs" permission is required in order to populate the url, title, and favIconUrl properties of Tab objects.
|
13893
13848
|
*/
|
13894
13849
|
export namespace windows {
|
13850
|
+
interface WindowsEvent<T extends (...args: any) => void> extends Omit<chrome.events.Event<T>, "addListener"> {
|
13851
|
+
addListener(callback: T, filter?: {
|
13852
|
+
windowTypes: `${WindowType}`[];
|
13853
|
+
}): void;
|
13854
|
+
}
|
13855
|
+
|
13895
13856
|
export interface Window {
|
13896
|
-
/**
|
13857
|
+
/** Array of {@link tabs.Tab} objects representing the current tabs in the window. */
|
13897
13858
|
tabs?: chrome.tabs.Tab[] | undefined;
|
13898
|
-
/**
|
13859
|
+
/** The offset of the window from the top edge of the screen in pixels. In some circumstances a window may not be assigned a `top` property; for example, when querying closed windows from the {@link sessions} API. */
|
13899
13860
|
top?: number | undefined;
|
13900
|
-
/**
|
13861
|
+
/** The height of the window, including the frame, in pixels. In some circumstances a window may not be assigned a `height` property, for example when querying closed windows from the {@link sessions} API. */
|
13901
13862
|
height?: number | undefined;
|
13902
|
-
/**
|
13863
|
+
/** The width of the window, including the frame, in pixels. In some circumstances a window may not be assigned a `width` property; for example, when querying closed windows from the {@link sessions} API. */
|
13903
13864
|
width?: number | undefined;
|
13904
|
-
/**
|
13905
|
-
|
13906
|
-
* @since Chrome 17
|
13907
|
-
*/
|
13908
|
-
state?: windowStateEnum | undefined;
|
13865
|
+
/** The state of this browser window. */
|
13866
|
+
state?: `${WindowState}` | undefined;
|
13909
13867
|
/** Whether the window is currently the focused window. */
|
13910
13868
|
focused: boolean;
|
13911
|
-
/**
|
13912
|
-
* Whether the window is set to be always on top.
|
13913
|
-
* @since Chrome 19
|
13914
|
-
*/
|
13869
|
+
/** Whether the window is set to be always on top. */
|
13915
13870
|
alwaysOnTop: boolean;
|
13916
13871
|
/** Whether the window is incognito. */
|
13917
13872
|
incognito: boolean;
|
13918
|
-
/**
|
13919
|
-
|
13920
|
-
|
13921
|
-
type?: windowTypeEnum | undefined;
|
13922
|
-
/** Optional. The ID of the window. Window IDs are unique within a browser session. Under some circumstances a Window may not be assigned an ID, for example when querying windows using the sessions API, in which case a session ID may be present. */
|
13873
|
+
/** The type of browser window this is. */
|
13874
|
+
type?: `${WindowType}` | undefined;
|
13875
|
+
/** The ID of the window. Window IDs are unique within a browser session. In some circumstances a window may not be assigned an `ID` property; for example, when querying windows using the {@link sessions} API, in which case a session ID may be present. */
|
13923
13876
|
id?: number | undefined;
|
13924
|
-
/**
|
13877
|
+
/** The offset of the window from the left edge of the screen in pixels. In some circumstances a window may not be assigned a `left` property; for example, when querying closed windows from the {@link sessions} API. */
|
13925
13878
|
left?: number | undefined;
|
13926
|
-
/**
|
13927
|
-
* Optional. The session ID used to uniquely identify a Window obtained from the sessions API.
|
13928
|
-
* @since Chrome 31
|
13929
|
-
*/
|
13879
|
+
/** The session ID used to uniquely identify a window, obtained from the {@link sessions} API. */
|
13930
13880
|
sessionId?: string | undefined;
|
13931
13881
|
}
|
13932
13882
|
|
13883
|
+
/** @since Chrome 88 */
|
13933
13884
|
export interface QueryOptions {
|
13934
|
-
/**
|
13935
|
-
* Optional.
|
13936
|
-
* If true, the windows.Window object will have a tabs property that contains a list of the tabs.Tab objects.
|
13937
|
-
* The Tab objects only contain the url, pendingUrl, title and favIconUrl properties if the extension's manifest file includes the "tabs" permission.
|
13938
|
-
*/
|
13885
|
+
/** If true, the {@link windows.Window} object has a `tabs` property that contains a list of the {@link tabs.Tab} objects. The `Tab` objects only contain the `url`, `pendingUrl`, `title`, and `favIconUrl` properties if the extension's manifest file includes the `"tabs"` permission. */
|
13939
13886
|
populate?: boolean | undefined;
|
13940
|
-
/**
|
13941
|
-
|
13942
|
-
*/
|
13943
|
-
windowTypes?: windowTypeEnum[] | undefined;
|
13887
|
+
/** If set, the {@link windows.Window} returned is filtered based on its type. If unset, the default filter is set to `['normal', 'popup']`. */
|
13888
|
+
windowTypes?: `${WindowType}`[] | undefined;
|
13944
13889
|
}
|
13945
13890
|
|
13946
13891
|
export interface CreateData {
|
13947
|
-
/**
|
13948
|
-
* Optional. The id of the tab for which you want to adopt to the new window.
|
13949
|
-
* @since Chrome 10
|
13950
|
-
*/
|
13892
|
+
/** The ID of the tab to add to the new window. */
|
13951
13893
|
tabId?: number | undefined;
|
13952
|
-
/**
|
13953
|
-
* Optional.
|
13954
|
-
* A URL or array of URLs to open as tabs in the window. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page.
|
13955
|
-
*/
|
13894
|
+
/** A URL or array of URLs to open as tabs in the window. Fully-qualified URLs must include a scheme, e.g., 'http://www.google.com', not 'www.google.com'. Non-fully-qualified URLs are considered relative within the extension. Defaults to the New Tab Page. */
|
13956
13895
|
url?: string | string[] | undefined;
|
13957
|
-
/**
|
13958
|
-
* Optional.
|
13959
|
-
* The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels.
|
13960
|
-
*/
|
13896
|
+
/** The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels. */
|
13961
13897
|
top?: number | undefined;
|
13962
|
-
/**
|
13963
|
-
* Optional.
|
13964
|
-
* The height in pixels of the new window, including the frame. If not specified defaults to a natural height.
|
13965
|
-
*/
|
13898
|
+
/** The height in pixels of the new window, including the frame. If not specified, defaults to a natural height. */
|
13966
13899
|
height?: number | undefined;
|
13967
|
-
/**
|
13968
|
-
* Optional.
|
13969
|
-
* The width in pixels of the new window, including the frame. If not specified defaults to a natural width.
|
13970
|
-
*/
|
13900
|
+
/** The width in pixels of the new window, including the frame. If not specified, defaults to a natural width. */
|
13971
13901
|
width?: number | undefined;
|
13972
|
-
/**
|
13973
|
-
* Optional. If true, opens an active window. If false, opens an inactive window.
|
13974
|
-
* @since Chrome 12
|
13975
|
-
*/
|
13902
|
+
/** If `true`, opens an active window. If `false`, opens an inactive window. */
|
13976
13903
|
focused?: boolean | undefined;
|
13977
|
-
/**
|
13904
|
+
/** Whether the new window should be an incognito window. */
|
13978
13905
|
incognito?: boolean | undefined;
|
13979
|
-
/**
|
13980
|
-
type?:
|
13981
|
-
/**
|
13982
|
-
* Optional.
|
13983
|
-
* The number of pixels to position the new window from the left edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels.
|
13984
|
-
*/
|
13906
|
+
/** Specifies what type of browser window to create. */
|
13907
|
+
type?: `${CreateType}` | undefined;
|
13908
|
+
/** The number of pixels to position the new window from the left edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels. */
|
13985
13909
|
left?: number | undefined;
|
13986
13910
|
/**
|
13987
|
-
*
|
13911
|
+
* The initial state of the window. The `minimized`, `maximized`, and `fullscreen` states cannot be combined with `left`, `top`, `width`, or `height`.
|
13988
13912
|
* @since Chrome 44
|
13989
13913
|
*/
|
13990
|
-
state?:
|
13914
|
+
state?: `${WindowState}` | undefined;
|
13991
13915
|
/**
|
13992
|
-
* If true
|
13916
|
+
* If `true`, the newly-created window's 'window.opener' is set to the caller and is in the same [unit of related browsing contexts](https://www.w3.org/TR/html51/browsers.html#unit-of-related-browsing-contexts) as the caller.
|
13993
13917
|
* @since Chrome 64
|
13994
13918
|
*/
|
13995
13919
|
setSelfAsOpener?: boolean | undefined;
|
13996
13920
|
}
|
13997
13921
|
|
13998
13922
|
export interface UpdateInfo {
|
13999
|
-
/**
|
13923
|
+
/** The offset from the top edge of the screen to move the window to in pixels. This value is ignored for panels. */
|
14000
13924
|
top?: number | undefined;
|
14001
|
-
/**
|
14002
|
-
* Optional. If true, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus. Set to false to cancel a previous draw attention request.
|
14003
|
-
* @since Chrome 14
|
14004
|
-
*/
|
13925
|
+
/** If `true`, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus. Set to `false` to cancel a previous `drawAttention` request. */
|
14005
13926
|
drawAttention?: boolean | undefined;
|
14006
|
-
/**
|
13927
|
+
/** The height to resize the window to in pixels. This value is ignored for panels. */
|
14007
13928
|
height?: number | undefined;
|
14008
|
-
/**
|
13929
|
+
/** The width to resize the window to in pixels. This value is ignored for panels. */
|
14009
13930
|
width?: number | undefined;
|
14010
|
-
/**
|
14011
|
-
|
14012
|
-
|
14013
|
-
*/
|
14014
|
-
state?: windowStateEnum | undefined;
|
14015
|
-
/**
|
14016
|
-
* Optional. If true, brings the window to the front. If false, brings the next window in the z-order to the front.
|
14017
|
-
* @since Chrome 8
|
14018
|
-
*/
|
13931
|
+
/** The new state of the window. The 'minimized', 'maximized', and 'fullscreen' states cannot be combined with 'left', 'top', 'width', or 'height'. */
|
13932
|
+
state?: `${WindowState}` | undefined;
|
13933
|
+
/** If `true`, brings the window to the front; cannot be combined with the state 'minimized'. If `false`, brings the next window in the z-order to the front; cannot be combined with the state 'fullscreen' or 'maximized'. */
|
14019
13934
|
focused?: boolean | undefined;
|
14020
|
-
/**
|
13935
|
+
/** The offset from the left edge of the screen to move the window to in pixels. This value is ignored for panels. */
|
14021
13936
|
left?: number | undefined;
|
14022
13937
|
}
|
14023
13938
|
|
14024
|
-
export interface WindowEventFilter {
|
14025
|
-
/**
|
14026
|
-
* Conditions that the window's type being created must satisfy. By default it will satisfy ['app', 'normal', 'panel', 'popup'], with 'app' and 'panel' window types limited to the extension's own windows.
|
14027
|
-
*/
|
14028
|
-
windowTypes: windowTypeEnum[];
|
14029
|
-
}
|
14030
|
-
|
14031
|
-
export interface WindowIdEvent extends chrome.events.Event<(windowId: number) => void> {
|
14032
|
-
addListener(
|
14033
|
-
callback: (windowId: number) => void,
|
14034
|
-
filters?: WindowEventFilter,
|
14035
|
-
): void;
|
14036
|
-
}
|
14037
|
-
|
14038
|
-
export interface WindowReferenceEvent extends chrome.events.Event<(window: Window) => void> {
|
14039
|
-
addListener(
|
14040
|
-
callback: (window: Window) => void,
|
14041
|
-
filters?: WindowEventFilter,
|
14042
|
-
): void;
|
14043
|
-
}
|
14044
|
-
|
14045
13939
|
/**
|
14046
13940
|
* Specifies what type of browser window to create.
|
14047
13941
|
* 'panel' is deprecated and is available only to existing whitelisted extensions on Chrome OS.
|
14048
13942
|
* @since Chrome 44
|
14049
13943
|
*/
|
14050
|
-
export
|
13944
|
+
export enum CreateType {
|
13945
|
+
/** Specifies the window as a standard window. */
|
13946
|
+
NORMAL = "normal",
|
13947
|
+
/** Specifies the window as a popup window. */
|
13948
|
+
POPUP = "popup",
|
13949
|
+
/** @deprecated Specifies the window as a panel. */
|
13950
|
+
PANEL = "panel",
|
13951
|
+
}
|
14051
13952
|
|
14052
13953
|
/**
|
14053
|
-
* The state of this browser window.
|
14054
|
-
* In some circumstances a window may not be assigned a state property; for example, when querying closed windows from the sessions API.
|
13954
|
+
* The state of this browser window. In some circumstances a window may not be assigned a `state` property; for example, when querying closed windows from the {@link sessions} API.
|
14055
13955
|
* @since Chrome 44
|
14056
13956
|
*/
|
14057
|
-
export
|
13957
|
+
export enum WindowState {
|
13958
|
+
/** Normal window state (not minimized, maximized, or fullscreen). */
|
13959
|
+
NORMAL = "normal",
|
13960
|
+
/** Minimized window state. */
|
13961
|
+
MINIMIZED = "minimized",
|
13962
|
+
/** Maximized window state. */
|
13963
|
+
MAXIMIZED = "maximized",
|
13964
|
+
/** Fullscreen window state. */
|
13965
|
+
FULLSCREEN = "fullscreen",
|
13966
|
+
/** Locked fullscreen window state. This fullscreen state cannot be exited by user action and is available only to allowlisted extensions on Chrome OS. */
|
13967
|
+
LOCKED_FULLSCREEN = "locked-fullscreen",
|
13968
|
+
}
|
14058
13969
|
|
14059
13970
|
/**
|
14060
|
-
* The type of browser window this is.
|
14061
|
-
* In some circumstances a window may not be assigned a type property; for example, when querying closed windows from the sessions API.
|
13971
|
+
* The type of browser window this is. In some circumstances a window may not be assigned a `type` property; for example, when querying closed windows from the {@link sessions} API.
|
14062
13972
|
* @since Chrome 44
|
14063
13973
|
*/
|
14064
|
-
export
|
13974
|
+
export enum WindowType {
|
13975
|
+
/** A normal browser window. */
|
13976
|
+
NORMAL = "normal",
|
13977
|
+
/** A browser popup. */
|
13978
|
+
POPUP = "popup",
|
13979
|
+
/** @deprecated A Chrome App panel-style window. Extensions can only see their own panel windows. */
|
13980
|
+
PANEL = "panel",
|
13981
|
+
/** @deprecated A Chrome App window. Extensions can only see their app own windows. */
|
13982
|
+
APP = "app",
|
13983
|
+
/** A Developer Tools window. */
|
13984
|
+
DEVTOOLS = "devtools",
|
13985
|
+
}
|
14065
13986
|
|
14066
|
-
/**
|
14067
|
-
|
14068
|
-
|
14069
|
-
|
14070
|
-
export
|
14071
|
-
/**
|
14072
|
-
* The windowId value that represents the absence of a chrome browser window.
|
14073
|
-
* @since Chrome 6
|
14074
|
-
*/
|
14075
|
-
export var WINDOW_ID_NONE: -1;
|
13987
|
+
/** The windowId value that represents the current window. */
|
13988
|
+
export const WINDOW_ID_CURRENT: -2;
|
13989
|
+
|
13990
|
+
/** The windowId value that represents the absence of a Chrome browser window */
|
13991
|
+
export const WINDOW_ID_NONE: -1;
|
14076
13992
|
|
14077
|
-
/** Gets details about a window. */
|
14078
|
-
export function get(windowId: number, callback: (window: chrome.windows.Window) => void): void;
|
14079
|
-
/**
|
14080
|
-
* Gets details about a window.
|
14081
|
-
* @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14082
|
-
*/
|
14083
|
-
export function get(windowId: number): Promise<chrome.windows.Window>;
|
14084
13993
|
/**
|
14085
13994
|
* Gets details about a window.
|
14086
|
-
*
|
13995
|
+
*
|
13996
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14087
13997
|
*/
|
13998
|
+
export function get(windowId: number, queryOptions?: QueryOptions): Promise<Window>;
|
13999
|
+
export function get(windowId: number, callback: (window: Window) => void): void;
|
14088
14000
|
export function get(
|
14089
14001
|
windowId: number,
|
14090
|
-
queryOptions: QueryOptions,
|
14091
|
-
callback: (window:
|
14002
|
+
queryOptions: QueryOptions | undefined,
|
14003
|
+
callback: (window: Window) => void,
|
14092
14004
|
): void;
|
14093
|
-
|
14094
|
-
* Gets details about a window.
|
14095
|
-
* @since Chrome 18
|
14096
|
-
* @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14097
|
-
*/
|
14098
|
-
export function get(windowId: number, queryOptions: QueryOptions): Promise<chrome.windows.Window>;
|
14099
|
-
/** Gets the current window. */
|
14100
|
-
export function getCurrent(callback: (window: chrome.windows.Window) => void): void;
|
14101
|
-
/**
|
14102
|
-
* Gets the current window.
|
14103
|
-
* @return The `getCurrent` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14104
|
-
*/
|
14105
|
-
export function getCurrent(): Promise<chrome.windows.Window>;
|
14106
|
-
/**
|
14107
|
-
* Gets the current window.
|
14108
|
-
* @param QueryOptions
|
14109
|
-
* @since Chrome 18
|
14110
|
-
*/
|
14111
|
-
export function getCurrent(queryOptions: QueryOptions, callback: (window: chrome.windows.Window) => void): void;
|
14005
|
+
|
14112
14006
|
/**
|
14113
14007
|
* Gets the current window.
|
14114
|
-
*
|
14115
|
-
*
|
14116
|
-
* @return The `getCurrent` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14117
|
-
*/
|
14118
|
-
export function getCurrent(queryOptions: QueryOptions): Promise<chrome.windows.Window>;
|
14119
|
-
/**
|
14120
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
14121
|
-
* @return The `create` method provides its result via callback or returned as a `Promise` (MV3 only). Contains details about the created window.
|
14122
|
-
*/
|
14123
|
-
export function create(): Promise<chrome.windows.Window>;
|
14124
|
-
/**
|
14125
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
14126
|
-
* @param callback
|
14127
|
-
* Optional parameter window: Contains details about the created window.
|
14128
|
-
*/
|
14129
|
-
export function create(callback: (window?: chrome.windows.Window) => void): void;
|
14130
|
-
/**
|
14131
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
14132
|
-
* @param CreateData
|
14133
|
-
* @return The `create` method provides its result via callback or returned as a `Promise` (MV3 only). Contains details about the created window.
|
14134
|
-
*/
|
14135
|
-
export function create(createData: CreateData): Promise<chrome.windows.Window>;
|
14136
|
-
/**
|
14137
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
14138
|
-
* @param CreateData
|
14139
|
-
* @param callback
|
14140
|
-
* Optional parameter window: Contains details about the created window.
|
14141
|
-
*/
|
14142
|
-
export function create(createData: CreateData, callback: (window?: chrome.windows.Window) => void): void;
|
14143
|
-
/**
|
14144
|
-
* Gets all windows.
|
14145
|
-
*/
|
14146
|
-
export function getAll(callback: (windows: chrome.windows.Window[]) => void): void;
|
14147
|
-
/**
|
14148
|
-
* Gets all windows.
|
14149
|
-
* @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14008
|
+
*
|
14009
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14150
14010
|
*/
|
14151
|
-
export function
|
14011
|
+
export function getCurrent(queryOptions?: QueryOptions): Promise<Window>;
|
14012
|
+
export function getCurrent(callback: (window: Window) => void): void;
|
14013
|
+
export function getCurrent(queryOptions: QueryOptions | undefined, callback: (window: Window) => void): void;
|
14014
|
+
|
14152
14015
|
/**
|
14153
|
-
*
|
14154
|
-
*
|
14016
|
+
* Creates (opens) a new browser window with any optional sizing, position, or default URL provided.
|
14017
|
+
*
|
14018
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14155
14019
|
*/
|
14156
|
-
export function
|
14020
|
+
export function create(createData?: CreateData): Promise<Window | undefined>;
|
14021
|
+
export function create(callback: (window?: Window) => void): void;
|
14022
|
+
export function create(createData: CreateData | undefined, callback: (window?: Window) => void): void;
|
14023
|
+
|
14157
14024
|
/**
|
14158
14025
|
* Gets all windows.
|
14159
|
-
*
|
14160
|
-
*
|
14026
|
+
*
|
14027
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14161
14028
|
*/
|
14162
|
-
export function getAll(queryOptions
|
14029
|
+
export function getAll(queryOptions?: QueryOptions): Promise<Window[]>;
|
14030
|
+
export function getAll(callback: (windows: Window[]) => void): void;
|
14031
|
+
export function getAll(queryOptions: QueryOptions | undefined, callback: (windows: Window[]) => void): void;
|
14032
|
+
|
14163
14033
|
/**
|
14164
|
-
* Updates the properties of a window. Specify only the properties that
|
14165
|
-
*
|
14034
|
+
* Updates the properties of a window. Specify only the properties that to be changed; unspecified properties are unchanged.
|
14035
|
+
*
|
14036
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14166
14037
|
*/
|
14167
|
-
export function update(
|
14168
|
-
|
14169
|
-
|
14170
|
-
): Promise<chrome.windows.Window>;
|
14171
|
-
/** Updates the properties of a window. Specify only the properties that you want to change; unspecified properties will be left unchanged. */
|
14172
|
-
export function update(
|
14173
|
-
windowId: number,
|
14174
|
-
updateInfo: UpdateInfo,
|
14175
|
-
callback: (window: chrome.windows.Window) => void,
|
14176
|
-
): void;
|
14038
|
+
export function update(windowId: number, updateInfo: UpdateInfo): Promise<Window>;
|
14039
|
+
export function update(windowId: number, updateInfo: UpdateInfo, callback: (window: Window) => void): void;
|
14040
|
+
|
14177
14041
|
/**
|
14178
|
-
* Removes (closes) a window
|
14179
|
-
*
|
14042
|
+
* Removes (closes) a window and all the tabs inside it.
|
14043
|
+
*
|
14044
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14180
14045
|
*/
|
14181
14046
|
export function remove(windowId: number): Promise<void>;
|
14182
|
-
/** Removes (closes) a window, and all the tabs inside it. */
|
14183
14047
|
export function remove(windowId: number, callback: () => void): void;
|
14048
|
+
|
14184
14049
|
/**
|
14185
14050
|
* Gets the window that was most recently focused — typically the window 'on top'.
|
14051
|
+
*
|
14052
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14186
14053
|
*/
|
14187
|
-
export function getLastFocused(
|
14188
|
-
|
14189
|
-
* Gets the window that was most recently focused — typically the window 'on top'.
|
14190
|
-
* @return The `getLastFocused` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14191
|
-
*/
|
14192
|
-
export function getLastFocused(): Promise<chrome.windows.Window>;
|
14193
|
-
/**
|
14194
|
-
* Gets the window that was most recently focused — typically the window 'on top'.
|
14195
|
-
* @since Chrome 18
|
14196
|
-
*/
|
14054
|
+
export function getLastFocused(queryOptions?: QueryOptions): Promise<Window>;
|
14055
|
+
export function getLastFocused(callback: (window: Window) => void): void;
|
14197
14056
|
export function getLastFocused(
|
14198
|
-
queryOptions: QueryOptions,
|
14199
|
-
callback: (window:
|
14057
|
+
queryOptions: QueryOptions | undefined,
|
14058
|
+
callback: (window: Window) => void,
|
14200
14059
|
): void;
|
14201
|
-
/**
|
14202
|
-
* Gets the window that was most recently focused — typically the window 'on top'.
|
14203
|
-
* @since Chrome 18
|
14204
|
-
* @return The `getLastFocused` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14205
|
-
*/
|
14206
|
-
export function getLastFocused(queryOptions: QueryOptions): Promise<chrome.windows.Window>;
|
14207
14060
|
|
14208
14061
|
/** Fired when a window is removed (closed). */
|
14209
|
-
export
|
14062
|
+
export const onRemoved: WindowsEvent<(windowId: number) => void>;
|
14063
|
+
|
14210
14064
|
/** Fired when a window is created. */
|
14211
|
-
export
|
14212
|
-
|
14213
|
-
|
14214
|
-
|
14215
|
-
*/
|
14216
|
-
export var onFocusChanged: WindowIdEvent;
|
14065
|
+
export const onCreated: WindowsEvent<(window: Window) => void>;
|
14066
|
+
|
14067
|
+
/** Fired when the currently focused window changes. Returns `chrome.windows.WINDOW_ID_NONE` if all Chrome windows have lost focus. **Note:** On some Linux window managers, `WINDOW_ID_NONE` is always sent immediately preceding a switch from one Chrome window to another. */
|
14068
|
+
export const onFocusChanged: WindowsEvent<(windowId: number) => void>;
|
14217
14069
|
|
14218
14070
|
/**
|
14219
14071
|
* Fired when a window has been resized; this event is only dispatched when the new bounds are committed, and not for in-progress changes.
|
14220
14072
|
* @since Chrome 86
|
14221
14073
|
*/
|
14222
|
-
export
|
14074
|
+
export const onBoundsChanged: events.Event<(window: Window) => void>;
|
14223
14075
|
}
|
14224
14076
|
|
14225
14077
|
////////////////////
|