@types/chrome 0.0.328 → 0.0.330
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 +922 -1055
- 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
|
////////////////////
|
@@ -8969,37 +8939,114 @@ declare namespace chrome {
|
|
8969
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.
|
8970
8940
|
*/
|
8971
8941
|
export namespace runtime {
|
8972
|
-
/** This
|
8973
|
-
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
|
+
|
8974
8948
|
/** The ID of the extension/app. */
|
8975
|
-
export
|
8976
|
-
|
8977
|
-
/**
|
8978
|
-
|
8979
|
-
|
8980
|
-
|
8981
|
-
|
8982
|
-
|
8983
|
-
|
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 */
|
8984
9009
|
export enum ContextType {
|
9010
|
+
/** Specifies the context type as a tab */
|
8985
9011
|
TAB = "TAB",
|
9012
|
+
/** Specifies the context type as an extension popup window */
|
8986
9013
|
POPUP = "POPUP",
|
9014
|
+
/** Specifies the context type as a service worker. */
|
8987
9015
|
BACKGROUND = "BACKGROUND",
|
9016
|
+
/** Specifies the context type as an offscreen document. */
|
8988
9017
|
OFFSCREEN_DOCUMENT = "OFFSCREEN_DOCUMENT",
|
9018
|
+
/** Specifies the context type as a side panel. */
|
8989
9019
|
SIDE_PANEL = "SIDE_PANEL",
|
9020
|
+
/** Specifies the context type as developer tools. */
|
8990
9021
|
DEVELOPER_TOOLS = "DEVELOPER_TOOLS",
|
8991
9022
|
}
|
8992
|
-
|
9023
|
+
|
9024
|
+
/**
|
9025
|
+
* The reason that this event is being dispatched.
|
9026
|
+
* @since Chrome 44
|
9027
|
+
*/
|
8993
9028
|
export enum OnInstalledReason {
|
9029
|
+
/** Specifies the event reason as an installation. */
|
8994
9030
|
INSTALL = "install",
|
9031
|
+
/** Specifies the event reason as an extension update. */
|
8995
9032
|
UPDATE = "update",
|
9033
|
+
/** Specifies the event reason as a Chrome update. */
|
8996
9034
|
CHROME_UPDATE = "chrome_update",
|
9035
|
+
/** Specifies the event reason as an update to a shared module. */
|
8997
9036
|
SHARED_MODULE_UPDATE = "shared_module_update",
|
8998
9037
|
}
|
8999
9038
|
|
9000
|
-
|
9001
|
-
|
9002
|
-
|
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",
|
9003
9050
|
}
|
9004
9051
|
|
9005
9052
|
/**
|
@@ -9008,7 +9055,7 @@ declare namespace chrome {
|
|
9008
9055
|
*/
|
9009
9056
|
export interface ContextFilter {
|
9010
9057
|
contextIds?: string[] | undefined;
|
9011
|
-
contextTypes?: ContextType[] | undefined;
|
9058
|
+
contextTypes?: `${ContextType}`[] | undefined;
|
9012
9059
|
documentIds?: string[] | undefined;
|
9013
9060
|
documentOrigins?: string[] | undefined;
|
9014
9061
|
documentUrls?: string[] | undefined;
|
@@ -9019,26 +9066,19 @@ declare namespace chrome {
|
|
9019
9066
|
}
|
9020
9067
|
|
9021
9068
|
export interface ConnectInfo {
|
9069
|
+
/** Will be passed into onConnect for processes that are listening for the connection event. */
|
9022
9070
|
name?: string | undefined;
|
9071
|
+
/** Whether the TLS channel ID will be passed into onConnectExternal for processes that are listening for the connection event. */
|
9023
9072
|
includeTlsChannelId?: boolean | undefined;
|
9024
9073
|
}
|
9025
9074
|
|
9026
9075
|
export interface InstalledDetails {
|
9027
|
-
/**
|
9028
|
-
* The reason that this event is being dispatched.
|
9029
|
-
*/
|
9076
|
+
/** The reason that this event is being dispatched. */
|
9030
9077
|
reason: `${OnInstalledReason}`;
|
9031
|
-
/**
|
9032
|
-
|
9033
|
-
|
9034
|
-
|
9035
|
-
previousVersion?: string | undefined;
|
9036
|
-
/**
|
9037
|
-
* Optional.
|
9038
|
-
* Indicates the ID of the imported shared module extension which updated. This is present only if 'reason' is 'shared_module_update'.
|
9039
|
-
* @since Chrome 29
|
9040
|
-
*/
|
9041
|
-
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;
|
9042
9082
|
}
|
9043
9083
|
|
9044
9084
|
/**
|
@@ -9049,29 +9089,20 @@ declare namespace chrome {
|
|
9049
9089
|
/** A unique identifier for this context */
|
9050
9090
|
contextId: string;
|
9051
9091
|
/** The type of context this corresponds to. */
|
9052
|
-
contextType: ContextType
|
9053
|
-
/**
|
9054
|
-
|
9055
|
-
|
9056
|
-
|
9057
|
-
|
9058
|
-
|
9059
|
-
|
9060
|
-
* The origin of the document associated with this context, or undefined if the context is not hosted in a document.
|
9061
|
-
*/
|
9062
|
-
documentOrigin?: string | undefined;
|
9063
|
-
/**
|
9064
|
-
* Optional.
|
9065
|
-
* The URL of the document associated with this context, or undefined if the context is not hosted in a document.
|
9066
|
-
*/
|
9067
|
-
documentUrl?: string | undefined;
|
9068
|
-
/** 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. */
|
9069
9100
|
frameId: number;
|
9070
9101
|
/** Whether the context is associated with an incognito profile. */
|
9071
9102
|
incognito: boolean;
|
9072
|
-
/** 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. */
|
9073
9104
|
tabId: number;
|
9074
|
-
/** 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. */
|
9075
9106
|
windowId: number;
|
9076
9107
|
}
|
9077
9108
|
|
@@ -9080,132 +9111,91 @@ declare namespace chrome {
|
|
9080
9111
|
includeTlsChannelId?: boolean | undefined;
|
9081
9112
|
}
|
9082
9113
|
|
9083
|
-
/**
|
9084
|
-
* An object containing information about the script context that sent a message or request.
|
9085
|
-
* @since Chrome 26
|
9086
|
-
*/
|
9114
|
+
/** An object containing information about the script context that sent a message or request */
|
9087
9115
|
export interface MessageSender {
|
9088
|
-
/** The ID of the extension
|
9089
|
-
id?: string
|
9090
|
-
/** 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. */
|
9091
|
-
tab?: chrome.tabs.Tab
|
9092
|
-
/** The name of the native application that opened the connection, if any.
|
9093
|
-
* @since Chrome 74
|
9094
|
-
*/
|
9095
|
-
nativeApplication?: string | undefined;
|
9096
|
-
/**
|
9097
|
-
* The frame that opened the connection. 0 for top-level frames, positive for child frames. This will only be set when tab is set.
|
9098
|
-
* @since Chrome 41
|
9099
|
-
*/
|
9100
|
-
frameId?: number | undefined;
|
9101
|
-
/**
|
9102
|
-
* 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.
|
9103
|
-
* @since Chrome 28
|
9104
|
-
*/
|
9105
|
-
url?: string | undefined;
|
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;
|
9106
9120
|
/**
|
9107
|
-
* The
|
9108
|
-
* @since Chrome
|
9121
|
+
* The name of the native application that opened the connection, if any.
|
9122
|
+
* @since Chrome 74
|
9109
9123
|
*/
|
9110
|
-
|
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;
|
9111
9131
|
/**
|
9112
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.
|
9113
9133
|
* @since Chrome 80
|
9114
9134
|
*/
|
9115
|
-
origin?: string
|
9135
|
+
origin?: string;
|
9116
9136
|
/**
|
9117
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.
|
9118
9138
|
* @since Chrome 106
|
9119
9139
|
*/
|
9120
|
-
documentLifecycle?: extensionTypes.DocumentLifecycle
|
9140
|
+
documentLifecycle?: extensionTypes.DocumentLifecycle;
|
9121
9141
|
/**
|
9122
9142
|
* A UUID of the document that opened the connection.
|
9123
9143
|
* @since Chrome 106
|
9124
9144
|
*/
|
9125
|
-
documentId?: string
|
9145
|
+
documentId?: string;
|
9126
9146
|
}
|
9127
9147
|
|
9128
|
-
/**
|
9129
|
-
* An object containing information about the current platform.
|
9130
|
-
* @since Chrome 36
|
9131
|
-
*/
|
9148
|
+
/** An object containing information about the current platform. */
|
9132
9149
|
export interface PlatformInfo {
|
9133
|
-
/**
|
9134
|
-
|
9135
|
-
|
9136
|
-
|
9137
|
-
/**
|
9138
|
-
|
9139
|
-
*/
|
9140
|
-
arch: PlatformArch;
|
9141
|
-
/**
|
9142
|
-
* The native client architecture. This may be different from arch on some platforms.
|
9143
|
-
*/
|
9144
|
-
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}`;
|
9145
9156
|
}
|
9146
9157
|
|
9147
|
-
/**
|
9148
|
-
* An object which allows two way communication with other pages.
|
9149
|
-
* @since Chrome 26
|
9150
|
-
*/
|
9158
|
+
/** An object which allows two way communication with other pages. */
|
9151
9159
|
export interface Port {
|
9160
|
+
/** Send a message to the other end of the port. If the port is disconnected, an error is thrown. */
|
9152
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. */
|
9153
9163
|
disconnect: () => void;
|
9154
|
-
/**
|
9155
|
-
|
9156
|
-
|
9157
|
-
|
9158
|
-
|
9159
|
-
|
9160
|
-
|
9161
|
-
/** An object which allows the addition and removal of listeners for a Chrome event. */
|
9162
|
-
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}. */
|
9163
9171
|
name: string;
|
9164
9172
|
}
|
9165
9173
|
|
9166
|
-
export interface UpdateAvailableDetails {
|
9167
|
-
/** The version number of the available update. */
|
9168
|
-
version: string;
|
9169
|
-
}
|
9170
|
-
|
9171
9174
|
export interface UpdateCheckDetails {
|
9172
9175
|
/** The version of the available update. */
|
9173
9176
|
version: string;
|
9174
9177
|
}
|
9175
9178
|
|
9176
|
-
/**
|
9177
|
-
|
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
|
+
}
|
9178
9191
|
|
9179
|
-
/** Result of the update check. */
|
9180
9192
|
export interface RequestUpdateCheckResult {
|
9181
|
-
/**
|
9182
|
-
status: RequestUpdateCheckStatus
|
9183
|
-
/**
|
9184
|
-
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;
|
9185
9197
|
}
|
9186
9198
|
|
9187
|
-
export interface PortDisconnectEvent extends chrome.events.Event<(port: Port) => void> {}
|
9188
|
-
|
9189
|
-
export interface PortMessageEvent extends chrome.events.Event<(message: any, port: Port) => void> {}
|
9190
|
-
|
9191
|
-
export interface ExtensionMessageEvent extends
|
9192
|
-
chrome.events.Event<
|
9193
|
-
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
9194
|
-
>
|
9195
|
-
{}
|
9196
|
-
|
9197
|
-
export interface ExtensionConnectEvent extends chrome.events.Event<(port: Port) => void> {}
|
9198
|
-
|
9199
|
-
export interface RuntimeInstalledEvent extends chrome.events.Event<(details: InstalledDetails) => void> {}
|
9200
|
-
|
9201
|
-
export interface RuntimeEvent extends chrome.events.Event<() => void> {}
|
9202
|
-
|
9203
|
-
export interface RuntimeRestartRequiredEvent extends chrome.events.Event<(reason: string) => void> {}
|
9204
|
-
|
9205
|
-
export interface RuntimeUpdateAvailableEvent
|
9206
|
-
extends chrome.events.Event<(details: UpdateAvailableDetails) => void>
|
9207
|
-
{}
|
9208
|
-
|
9209
9199
|
export interface ManifestIcons {
|
9210
9200
|
[size: number]: string;
|
9211
9201
|
}
|
@@ -9581,282 +9571,225 @@ declare namespace chrome {
|
|
9581
9571
|
export type Manifest = ManifestV2 | ManifestV3;
|
9582
9572
|
|
9583
9573
|
/**
|
9584
|
-
* Attempts to connect
|
9585
|
-
*
|
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.
|
9586
9578
|
*/
|
9587
9579
|
export function connect(connectInfo?: ConnectInfo): Port;
|
9580
|
+
export function connect(extensionId: string | undefined, connectInfo?: ConnectInfo): Port;
|
9581
|
+
|
9588
9582
|
/**
|
9589
|
-
*
|
9590
|
-
* @since Chrome 26
|
9591
|
-
* @param extensionId Optional.
|
9592
|
-
* 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.
|
9593
|
-
*/
|
9594
|
-
export function connect(extensionId: string, connectInfo?: ConnectInfo): Port;
|
9595
|
-
/**
|
9596
|
-
* Connects to a native application in the host machine.
|
9597
|
-
* @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.
|
9598
9584
|
* @param application The name of the registered application to connect to.
|
9599
9585
|
*/
|
9600
9586
|
export function connectNative(application: string): Port;
|
9601
9587
|
/**
|
9602
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.
|
9603
|
-
*
|
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.
|
9604
9594
|
*/
|
9605
|
-
export function getBackgroundPage(): Promise<Window>;
|
9606
|
-
/** 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>;
|
9607
9596
|
export function getBackgroundPage(callback: (backgroundPage?: Window) => void): void;
|
9597
|
+
|
9608
9598
|
/**
|
9609
9599
|
* Fetches information about active contexts associated with this extension
|
9610
|
-
* @since Chrome 116 MV3.
|
9611
|
-
* @return Provides the matching context, if any via callback or returned as a `Promise` (MV3 only).
|
9612
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.
|
9613
|
-
*/
|
9614
|
-
export function getContexts(filter: ContextFilter): Promise<ExtensionContext[]>;
|
9615
|
-
/**
|
9616
|
-
* Fetches information about active contexts associated with this extension
|
9617
9601
|
* @since Chrome 116 MV3.
|
9618
|
-
* @return Provides the matching context, if any via callback or returned as a `Promise` (MV3 only).
|
9619
|
-
* @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.
|
9620
|
-
* @param callback Called with results
|
9621
9602
|
*/
|
9603
|
+
export function getContexts(filter: ContextFilter): Promise<ExtensionContext[]>;
|
9622
9604
|
export function getContexts(filter: ContextFilter, callback: (contexts: ExtensionContext[]) => void): void;
|
9605
|
+
|
9623
9606
|
/**
|
9624
9607
|
* Returns details about the app or extension from the manifest. The object returned is a serialization of the full manifest file.
|
9625
9608
|
* @return The manifest details.
|
9626
9609
|
*/
|
9627
9610
|
export function getManifest(): Manifest;
|
9611
|
+
|
9628
9612
|
/**
|
9629
9613
|
* Returns a DirectoryEntry for the package directory.
|
9630
|
-
*
|
9614
|
+
*
|
9615
|
+
* Foreground only
|
9616
|
+
*
|
9617
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 122.
|
9631
9618
|
*/
|
9619
|
+
export function getPackageDirectoryEntry(): Promise<DirectoryEntry>;
|
9632
9620
|
export function getPackageDirectoryEntry(callback: (directoryEntry: DirectoryEntry) => void): void;
|
9621
|
+
|
9633
9622
|
/**
|
9634
9623
|
* Returns information about the current platform.
|
9635
|
-
*
|
9636
|
-
*
|
9637
|
-
*/
|
9638
|
-
export function getPlatformInfo(callback: (platformInfo: PlatformInfo) => void): void;
|
9639
|
-
/**
|
9640
|
-
* Returns information about the current platform.
|
9641
|
-
* @since Chrome 29
|
9642
|
-
* @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.
|
9643
9626
|
*/
|
9644
9627
|
export function getPlatformInfo(): Promise<PlatformInfo>;
|
9628
|
+
export function getPlatformInfo(callback: (platformInfo: PlatformInfo) => void): void;
|
9629
|
+
|
9645
9630
|
/**
|
9646
9631
|
* Converts a relative path within an app/extension install directory to a fully-qualified URL.
|
9647
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.
|
9648
9634
|
*/
|
9649
9635
|
export function getURL(path: string): string;
|
9650
|
-
|
9651
|
-
|
9652
|
-
* @since Chrome 25
|
9653
|
-
*/
|
9636
|
+
|
9637
|
+
/** Reloads the app or extension. This method is not supported in kiosk mode. For kiosk mode, use {@link chrome.runtime.restart()} method. */
|
9654
9638
|
export function reload(): void;
|
9639
|
+
|
9655
9640
|
/**
|
9656
|
-
* Requests an update check for this app/extension.
|
9657
|
-
*
|
9658
|
-
*
|
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.
|
9659
9650
|
*/
|
9660
9651
|
export function requestUpdateCheck(): Promise<RequestUpdateCheckResult>;
|
9661
|
-
/**
|
9662
|
-
* Requests an update check for this app/extension.
|
9663
|
-
* @since Chrome 25
|
9664
|
-
* @param callback
|
9665
|
-
* Parameter status: Result of the update check. One of: "throttled", "no_update", or "update_available"
|
9666
|
-
* Optional parameter details: If an update is available, this contains more information about the available update.
|
9667
|
-
*/
|
9668
9652
|
export function requestUpdateCheck(
|
9669
|
-
callback: (status: RequestUpdateCheckStatus
|
9653
|
+
callback: (status: `${RequestUpdateCheckStatus}`, details?: { version: string }) => void,
|
9670
9654
|
): void;
|
9671
|
-
|
9672
|
-
|
9673
|
-
* @since Chrome 32
|
9674
|
-
*/
|
9655
|
+
|
9656
|
+
/** Restart the ChromeOS device when the app runs in kiosk mode. Otherwise, it's no-op. */
|
9675
9657
|
export function restart(): void;
|
9658
|
+
|
9676
9659
|
/**
|
9677
|
-
* Restart the ChromeOS device when the app runs in kiosk mode after the
|
9678
|
-
*
|
9679
|
-
*
|
9680
|
-
* cancelled. It's a no-op in non-kiosk mode. It's only allowed to be
|
9681
|
-
* 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.
|
9682
9663
|
* @since Chrome 53
|
9683
|
-
* @param seconds
|
9684
|
-
* @param callback
|
9685
|
-
*/
|
9686
|
-
export function restartAfterDelay(seconds: number, callback?: () => void): void;
|
9687
|
-
/**
|
9688
|
-
* 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.
|
9689
|
-
* @since Chrome 26
|
9690
|
-
* 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.
|
9691
9664
|
*/
|
9692
|
-
export function
|
9665
|
+
export function restartAfterDelay(seconds: number): Promise<void>;
|
9666
|
+
export function restartAfterDelay(seconds: number, callback: () => void): void;
|
9667
|
+
|
9693
9668
|
/**
|
9694
|
-
* Sends a single message to event listeners within your extension
|
9695
|
-
*
|
9696
|
-
*
|
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.
|
9697
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;
|
9698
9677
|
export function sendMessage<M = any, R = any>(
|
9699
9678
|
message: M,
|
9700
|
-
options: MessageOptions,
|
9701
|
-
|
9679
|
+
options: MessageOptions | undefined,
|
9680
|
+
callback: (response: R) => void,
|
9702
9681
|
): void;
|
9703
|
-
/**
|
9704
|
-
* 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.
|
9705
|
-
* @since Chrome 26
|
9706
|
-
* @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.
|
9707
|
-
* 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.
|
9708
|
-
*/
|
9709
9682
|
export function sendMessage<M = any, R = any>(
|
9710
9683
|
extensionId: string | undefined | null,
|
9711
9684
|
message: M,
|
9712
|
-
|
9713
|
-
):
|
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 32
|
9717
|
-
* @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.
|
9718
|
-
* 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.
|
9719
|
-
*/
|
9720
|
-
export function sendMessage<Message = any, Response = any>(
|
9685
|
+
options?: MessageOptions,
|
9686
|
+
): Promise<R>;
|
9687
|
+
export function sendMessage<M = any, R = any>(
|
9721
9688
|
extensionId: string | undefined | null,
|
9722
|
-
message:
|
9723
|
-
|
9724
|
-
responseCallback: (response: Response) => void,
|
9689
|
+
message: M,
|
9690
|
+
callback: (response: R) => void,
|
9725
9691
|
): void;
|
9726
|
-
/**
|
9727
|
-
* 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.
|
9728
|
-
* @since Chrome 26
|
9729
|
-
*/
|
9730
|
-
export function sendMessage<M = any, R = any>(message: M): Promise<R>;
|
9731
|
-
/**
|
9732
|
-
* 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.
|
9733
|
-
* @since Chrome 32
|
9734
|
-
*/
|
9735
9692
|
export function sendMessage<M = any, R = any>(
|
9736
|
-
message: M,
|
9737
|
-
options: MessageOptions,
|
9738
|
-
): Promise<R>;
|
9739
|
-
/**
|
9740
|
-
* 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.
|
9741
|
-
* @since Chrome 26
|
9742
|
-
* @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.
|
9743
|
-
*/
|
9744
|
-
export function sendMessage<M = any, R = any>(extensionId: string | undefined | null, message: M): Promise<R>;
|
9745
|
-
/**
|
9746
|
-
* 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.
|
9747
|
-
* @since Chrome 32
|
9748
|
-
* @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.
|
9749
|
-
*/
|
9750
|
-
export function sendMessage<Message = any, Response = any>(
|
9751
9693
|
extensionId: string | undefined | null,
|
9752
|
-
message:
|
9753
|
-
options: MessageOptions,
|
9754
|
-
|
9755
|
-
/**
|
9756
|
-
* Send a single message to a native application.
|
9757
|
-
* @since Chrome 28
|
9758
|
-
* @param application The of the native messaging host.
|
9759
|
-
* @param message The message that will be passed to the native messaging host.
|
9760
|
-
* 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.
|
9761
|
-
*/
|
9762
|
-
export function sendNativeMessage(
|
9763
|
-
application: string,
|
9764
|
-
message: object,
|
9765
|
-
responseCallback: (response: any) => void,
|
9694
|
+
message: M,
|
9695
|
+
options: MessageOptions | undefined,
|
9696
|
+
callback: (response: R) => void,
|
9766
9697
|
): void;
|
9698
|
+
|
9767
9699
|
/**
|
9768
|
-
* Send a single message to a native application.
|
9769
|
-
*
|
9770
|
-
*
|
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.
|
9771
9704
|
* @param message The message that will be passed to the native messaging host.
|
9772
9705
|
*/
|
9706
|
+
export function sendNativeMessage(application: string, message: object): Promise<any>;
|
9773
9707
|
export function sendNativeMessage(
|
9774
9708
|
application: string,
|
9775
9709
|
message: object,
|
9776
|
-
|
9710
|
+
callback: (response: any) => void,
|
9711
|
+
): void;
|
9712
|
+
|
9777
9713
|
/**
|
9778
|
-
* Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum
|
9779
|
-
*
|
9780
|
-
*
|
9781
|
-
* 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.
|
9782
|
-
* @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.
|
9783
9718
|
*/
|
9784
|
-
export function setUninstallURL(url: string
|
9719
|
+
export function setUninstallURL(url: string): Promise<void>;
|
9720
|
+
export function setUninstallURL(url: string, callback: () => void): void;
|
9721
|
+
|
9785
9722
|
/**
|
9786
9723
|
* Open your Extension's options page, if possible.
|
9724
|
+
*
|
9787
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.
|
9788
|
-
*
|
9789
|
-
* @
|
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
|
9790
9730
|
*/
|
9791
9731
|
export function openOptionsPage(): Promise<void>;
|
9792
|
-
|
9793
|
-
|
9794
|
-
|
9795
|
-
|
9796
|
-
|
9797
|
-
|
9798
|
-
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>;
|
9799
9739
|
|
9800
9740
|
/**
|
9801
|
-
* Fired when a connection is made from
|
9802
|
-
* @since Chrome
|
9803
|
-
*/
|
9804
|
-
export var onConnect: ExtensionConnectEvent;
|
9805
|
-
/**
|
9806
|
-
* Fired when a connection is made from another extension.
|
9807
|
-
* @since Chrome 26
|
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
|
9808
9743
|
*/
|
9809
|
-
export
|
9744
|
+
export const onConnectNative: events.Event<(port: Port) => void>;
|
9745
|
+
|
9810
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. */
|
9811
|
-
export
|
9812
|
-
|
9813
|
-
|
9814
|
-
|
9815
|
-
|
9816
|
-
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
|
+
|
9817
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. */
|
9818
|
-
export
|
9753
|
+
export const onInstalled: events.Event<(details: InstalledDetails) => void>;
|
9754
|
+
|
9819
9755
|
/** Sent after onSuspend to indicate that the app won't be unloaded after all. */
|
9820
|
-
export
|
9821
|
-
|
9822
|
-
|
9823
|
-
|
9824
|
-
|
9825
|
-
|
9826
|
-
|
9827
|
-
|
9828
|
-
|
9829
|
-
|
9830
|
-
|
9831
|
-
|
9832
|
-
|
9833
|
-
|
9834
|
-
|
9835
|
-
|
9836
|
-
|
9837
|
-
|
9838
|
-
* @since Chrome 25
|
9839
|
-
*/
|
9840
|
-
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
|
+
|
9841
9774
|
/**
|
9842
|
-
* @deprecated since Chrome 33. Please use chrome.runtime.onRestartRequired.
|
9843
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}.
|
9844
9777
|
*/
|
9845
|
-
export
|
9778
|
+
export const onBrowserUpdateAvailable: events.Event<() => void>;
|
9846
9779
|
|
9847
9780
|
/**
|
9848
|
-
*
|
9849
|
-
* @
|
9850
|
-
* 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
|
9851
9783
|
*/
|
9852
|
-
export
|
9784
|
+
export const onUserScriptConnect: events.Event<(port: Port) => void>;
|
9853
9785
|
|
9854
9786
|
/**
|
9855
|
-
*
|
9856
|
-
* @
|
9857
|
-
* 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
|
9858
9789
|
*/
|
9859
|
-
export
|
9790
|
+
export const onUserScriptMessage: events.Event<
|
9791
|
+
(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void
|
9792
|
+
>;
|
9860
9793
|
}
|
9861
9794
|
|
9862
9795
|
////////////////////
|
@@ -9869,11 +9802,22 @@ declare namespace chrome {
|
|
9869
9802
|
* @since Chrome 88, MV3
|
9870
9803
|
*/
|
9871
9804
|
export namespace scripting {
|
9872
|
-
|
9873
|
-
export
|
9805
|
+
/** The origin for a style change. See style origins for more info. */
|
9806
|
+
export enum StyleOrigin {
|
9807
|
+
AUTHOR = "AUTHOR",
|
9808
|
+
USER = "USER",
|
9809
|
+
}
|
9874
9810
|
|
9875
|
-
|
9876
|
-
|
9811
|
+
/**
|
9812
|
+
* The JavaScript world for a script to execute within.
|
9813
|
+
* @since Chrome 95
|
9814
|
+
*/
|
9815
|
+
export enum ExecutionWorld {
|
9816
|
+
/** Specifies the isolated world, which is the execution environment unique to this extension. */
|
9817
|
+
ISOLATED = "ISOLATED",
|
9818
|
+
/** Specifies the main world of the DOM, which is the execution environment shared with the host page's JavaScript. */
|
9819
|
+
MAIN = "MAIN",
|
9820
|
+
}
|
9877
9821
|
|
9878
9822
|
export interface InjectionResult<T extends any = any> {
|
9879
9823
|
/**
|
@@ -9886,100 +9830,162 @@ declare namespace chrome {
|
|
9886
9830
|
* @since Chrome 90
|
9887
9831
|
*/
|
9888
9832
|
frameId: number;
|
9889
|
-
|
9890
|
-
result?: T
|
9833
|
+
/** The result of the script execution. */
|
9834
|
+
result?: T;
|
9891
9835
|
}
|
9892
9836
|
|
9893
|
-
export
|
9894
|
-
|
9895
|
-
|
9896
|
-
|
9897
|
-
|
9898
|
-
|
9899
|
-
|
9900
|
-
|
9901
|
-
|
9902
|
-
|
9903
|
-
|
9904
|
-
|
9905
|
-
|
9837
|
+
export type InjectionTarget =
|
9838
|
+
& {
|
9839
|
+
/** The ID of the tab into which to inject. */
|
9840
|
+
tabId: number;
|
9841
|
+
}
|
9842
|
+
& (
|
9843
|
+
| {
|
9844
|
+
/** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` or `documentIds` is specified. */
|
9845
|
+
allFrames?: boolean | undefined;
|
9846
|
+
/**
|
9847
|
+
* The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set.
|
9848
|
+
* @since Chrome 106
|
9849
|
+
*/
|
9850
|
+
documentIds?: never | undefined;
|
9851
|
+
/** The IDs of specific frames to inject into. */
|
9852
|
+
frameIds?: never | undefined;
|
9853
|
+
}
|
9854
|
+
| {
|
9855
|
+
/** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` or `documentIds` is specified. */
|
9856
|
+
allFrames?: false | undefined;
|
9857
|
+
/**
|
9858
|
+
* The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set.
|
9859
|
+
* @since Chrome 106
|
9860
|
+
*/
|
9861
|
+
documentIds?: never | undefined;
|
9862
|
+
/** The IDs of specific frames to inject into. */
|
9863
|
+
frameIds: number[] | undefined;
|
9864
|
+
}
|
9865
|
+
| {
|
9866
|
+
/** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` or `documentIds` is specified. */
|
9867
|
+
allFrames?: false | undefined;
|
9868
|
+
/**
|
9869
|
+
* The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set.
|
9870
|
+
* @since Chrome 106
|
9871
|
+
*/
|
9872
|
+
documentIds?: string[] | undefined;
|
9873
|
+
/** The IDs of specific frames to inject into. */
|
9874
|
+
frameIds?: never | undefined;
|
9875
|
+
}
|
9876
|
+
);
|
9906
9877
|
|
9907
|
-
export
|
9908
|
-
|
9909
|
-
|
9910
|
-
|
9911
|
-
|
9912
|
-
|
9913
|
-
|
9914
|
-
|
9915
|
-
|
9916
|
-
|
9878
|
+
export type CSSInjection =
|
9879
|
+
& {
|
9880
|
+
/** The style origin for the injection. Defaults to `'AUTHOR'`. */
|
9881
|
+
origin?: `${StyleOrigin}` | undefined;
|
9882
|
+
/** Details specifying the target into which to insert the CSS. */
|
9883
|
+
target: InjectionTarget;
|
9884
|
+
}
|
9885
|
+
& (
|
9886
|
+
| {
|
9887
|
+
/** A string containing the CSS to inject. Exactly one of `files` and `css` must be specified. */
|
9888
|
+
css: string;
|
9889
|
+
/** The path of the CSS files to inject, relative to the extension's root directory. Exactly one of `files` and `css` must be specified. */
|
9890
|
+
files?: never | undefined;
|
9891
|
+
}
|
9892
|
+
| {
|
9893
|
+
/** A string containing the CSS to inject. Exactly one of `files` and `css` must be specified. */
|
9894
|
+
css?: never | undefined;
|
9895
|
+
/** The path of the CSS files to inject, relative to the extension's root directory. Exactly one of `files` and `css` must be specified. */
|
9896
|
+
files: string[];
|
9897
|
+
}
|
9898
|
+
);
|
9917
9899
|
|
9918
9900
|
export type ScriptInjection<Args extends any[], Result> =
|
9919
9901
|
& {
|
9920
|
-
|
9902
|
+
/** Details specifying the target into which to inject the script. */
|
9921
9903
|
target: InjectionTarget;
|
9922
|
-
|
9923
|
-
world?: ExecutionWorld
|
9924
|
-
|
9904
|
+
/** The JavaScript "world" to run the script in. Defaults to `ISOLATED`. */
|
9905
|
+
world?: `${ExecutionWorld}`;
|
9906
|
+
/**
|
9907
|
+
* Whether the injection should be triggered in the target as soon as possible. Note that this is not a guarantee that injection will occur prior to page load, as the page may have already loaded by the time the script reaches the target.
|
9908
|
+
* @since Chrome 102
|
9909
|
+
*/
|
9925
9910
|
injectImmediately?: boolean;
|
9926
9911
|
}
|
9927
9912
|
& (
|
9928
9913
|
| {
|
9929
|
-
|
9914
|
+
/** A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of `files` or `func` must be specified. */
|
9915
|
+
func?: never | undefined;
|
9916
|
+
/** The path of the JS or CSS files to inject, relative to the extension's root directory. Exactly one of files or func must be specified. */
|
9930
9917
|
files: string[];
|
9931
9918
|
}
|
9932
9919
|
| ({
|
9933
|
-
|
9920
|
+
/** A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of `files` or `func` must be specified. */
|
9934
9921
|
func: () => Result;
|
9922
|
+
/** The path of the JS or CSS files to inject, relative to the extension's root directory. Exactly one of files or func must be specified. */
|
9923
|
+
files?: never | undefined;
|
9935
9924
|
} | {
|
9936
|
-
|
9937
|
-
func: (...args: Args) => Result;
|
9938
|
-
/* The arguments to carry into a provided function. This is only valid if the func parameter is specified. These arguments must be JSON-serializable. */
|
9925
|
+
/** The arguments to pass to the provided function. This is only valid if the `func` parameter is specified. These arguments must be JSON-serializable. */
|
9939
9926
|
args: Args;
|
9927
|
+
/** A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of `files` or `func` must be specified. */
|
9928
|
+
func: (...args: Args) => Result;
|
9929
|
+
/** The path of the JS or CSS files to inject, relative to the extension's root directory. Exactly one of files or func must be specified. */
|
9930
|
+
files?: never | undefined;
|
9940
9931
|
})
|
9941
9932
|
);
|
9942
9933
|
|
9943
9934
|
type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
|
9944
9935
|
|
9945
|
-
|
9946
|
-
|
9947
|
-
|
9948
|
-
|
9949
|
-
|
9950
|
-
|
9951
|
-
|
9952
|
-
|
9953
|
-
|
9954
|
-
|
9955
|
-
|
9956
|
-
|
9936
|
+
/** @since Chrome 96 */
|
9937
|
+
type RegisteredContentScript =
|
9938
|
+
& {
|
9939
|
+
/** The id of the content script, specified in the API call. Must not start with a '_' as it's reserved as a prefix for generated script IDs. */
|
9940
|
+
id: string;
|
9941
|
+
/** If specified true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched. */
|
9942
|
+
allFrames?: boolean | undefined;
|
9943
|
+
/** Excludes pages that this content script would otherwise be injected into. See Match Patterns for more details on the syntax of these strings. */
|
9944
|
+
excludeMatches?: string[] | undefined;
|
9945
|
+
/**
|
9946
|
+
* Indicates whether the script can be injected into frames where the URL contains an unsupported scheme; specifically: about:, data:, blob:, or filesystem:. In these cases, the URL's origin is checked to determine if the script should be injected. If the origin is `null` (as is the case for data: URLs) then the used origin is either the frame that created the current frame or the frame that initiated the navigation to this frame. Note that this may not be the parent frame.
|
9947
|
+
* @since Chrome 119
|
9948
|
+
*/
|
9949
|
+
matchOriginAsFallback?: boolean | undefined;
|
9950
|
+
/** Specifies which pages this content script will be injected into. See Match Patterns for more details on the syntax of these strings. Must be specified for {@link registerContentScripts}. */
|
9951
|
+
matches?: string[] | undefined;
|
9952
|
+
/** Specifies if this content script will persist into future sessions. The default is true. */
|
9953
|
+
persistAcrossSessions?: boolean | undefined;
|
9954
|
+
/** Specifies when JavaScript files are injected into the web page. The preferred and default value is `document_idle`. */
|
9955
|
+
runAt?: extensionTypes.RunAt | undefined;
|
9956
|
+
/** The JavaScript "world" to run the script in. Defaults to `ISOLATED`. */
|
9957
|
+
world?: `${ExecutionWorld}` | undefined;
|
9958
|
+
}
|
9959
|
+
& (
|
9960
|
+
| {
|
9961
|
+
/** The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array. */
|
9962
|
+
js: string[];
|
9963
|
+
/** The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array, before any DOM is constructed or displayed for the page. */
|
9964
|
+
css?: string[] | undefined;
|
9965
|
+
}
|
9966
|
+
| {
|
9967
|
+
/** The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array. */
|
9968
|
+
js?: string[] | undefined;
|
9969
|
+
/** The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array, before any DOM is constructed or displayed for the page. */
|
9970
|
+
css: string[];
|
9971
|
+
}
|
9972
|
+
);
|
9957
9973
|
|
9958
|
-
|
9959
|
-
|
9960
|
-
|
9961
|
-
|
9962
|
-
origin?: StyleOrigin;
|
9963
|
-
target?: InjectionTarget;
|
9974
|
+
/** @since Chrome 96 */
|
9975
|
+
export interface ContentScriptFilter {
|
9976
|
+
/** If specified, {@link getRegisteredContentScripts} will only return scripts with an id specified in this list. */
|
9977
|
+
ids?: string[] | undefined;
|
9964
9978
|
}
|
9965
9979
|
|
9966
9980
|
/**
|
9967
|
-
* Injects a script into a target context.
|
9968
|
-
*
|
9969
|
-
*
|
9970
|
-
* @
|
9981
|
+
* Injects a script into a target context. By default, the script will be run at `document_idle`, or immediately if the page has already loaded. If the `injectImmediately` property is set, the script will inject without waiting, even if the page has not finished loading. If the script evaluates to a promise, the browser will wait for the promise to settle and return the resulting value.
|
9982
|
+
*
|
9983
|
+
* Can return its result via Promise since Chrome 90.
|
9984
|
+
* @param injection The details of the script which to inject.
|
9971
9985
|
*/
|
9972
9986
|
export function executeScript<Args extends any[], Result>(
|
9973
9987
|
injection: ScriptInjection<Args, Result>,
|
9974
9988
|
): Promise<Array<InjectionResult<Awaited<Result>>>>;
|
9975
|
-
|
9976
|
-
/**
|
9977
|
-
* Injects a script into a target context. The script will be run at document_end.
|
9978
|
-
* @param injection
|
9979
|
-
* The details of the script which to inject.
|
9980
|
-
* @param callback
|
9981
|
-
* Invoked upon completion of the injection. The resulting array contains the result of execution for each frame where the injection succeeded.
|
9982
|
-
*/
|
9983
9989
|
export function executeScript<Args extends any[], Result>(
|
9984
9990
|
injection: ScriptInjection<Args, Result>,
|
9985
9991
|
callback: (results: Array<InjectionResult<Awaited<Result>>>) => void,
|
@@ -9987,102 +9993,56 @@ declare namespace chrome {
|
|
9987
9993
|
|
9988
9994
|
/**
|
9989
9995
|
* Inserts a CSS stylesheet into a target context. If multiple frames are specified, unsuccessful injections are ignored.
|
9990
|
-
*
|
9991
|
-
*
|
9992
|
-
* @
|
9996
|
+
*
|
9997
|
+
* Can return its result via Promise since Chrome 90.
|
9998
|
+
* @param injection The details of the styles to insert.
|
9993
9999
|
*/
|
9994
10000
|
export function insertCSS(injection: CSSInjection): Promise<void>;
|
9995
|
-
|
9996
|
-
/**
|
9997
|
-
* Inserts a CSS stylesheet into a target context. If multiple frames are specified, unsuccessful injections are ignored.
|
9998
|
-
* @param injection
|
9999
|
-
* The details of the styles to insert.
|
10000
|
-
* @param callback
|
10001
|
-
* Invoked upon completion of the injection.
|
10002
|
-
*/
|
10003
10001
|
export function insertCSS(injection: CSSInjection, callback: () => void): void;
|
10004
10002
|
|
10005
10003
|
/**
|
10006
10004
|
* Removes a CSS stylesheet that was previously inserted by this extension from a target context.
|
10007
|
-
* @param injection
|
10008
|
-
* The details of the styles to remove.
|
10009
|
-
* Note that the css, files, and origin properties must exactly match the stylesheet inserted through `insertCSS`.
|
10010
|
-
* Attempting to remove a non-existent stylesheet is a no-op.
|
10011
|
-
* @return This only returns a Promise when the callback parameter is not specified, and with MV3.
|
10005
|
+
* @param injection The details of the styles to remove. Note that the `css`, `files`, and `origin` properties must exactly match the stylesheet inserted through {@link insertCSS}. Attempting to remove a non-existent stylesheet is a no-op.
|
10012
10006
|
* @since Chrome 90
|
10013
10007
|
*/
|
10014
10008
|
export function removeCSS(injection: CSSInjection): Promise<void>;
|
10015
|
-
|
10016
|
-
/**
|
10017
|
-
* Removes a CSS stylesheet that was previously inserted by this extension from a target context.
|
10018
|
-
* @param injection
|
10019
|
-
* The details of the styles to remove.
|
10020
|
-
* Note that the css, files, and origin properties must exactly match the stylesheet inserted through `insertCSS`.
|
10021
|
-
* Attempting to remove a non-existent stylesheet is a no-op.
|
10022
|
-
* @param callback
|
10023
|
-
* Invoked upon completion of the removal.
|
10024
|
-
* @since Chrome 90
|
10025
|
-
*/
|
10026
10009
|
export function removeCSS(injection: CSSInjection, callback: () => void): void;
|
10027
10010
|
|
10028
10011
|
/**
|
10029
|
-
* Registers one or more content scripts
|
10030
|
-
* @param scripts
|
10012
|
+
* Registers one or more content scripts for this extension
|
10013
|
+
* @param scripts Contains a list of scripts to be registered. If there are errors during script parsing/file validation, or if the IDs specified already exist, then no scripts are registered.
|
10014
|
+
* @since Chrome 96
|
10031
10015
|
*/
|
10032
10016
|
export function registerContentScripts(scripts: RegisteredContentScript[]): Promise<void>;
|
10033
|
-
|
10034
|
-
/**
|
10035
|
-
* Registers one or more content scripts.
|
10036
|
-
* @param scripts
|
10037
|
-
* @param callback
|
10038
|
-
*/
|
10039
10017
|
export function registerContentScripts(scripts: RegisteredContentScript[], callback: () => void): void;
|
10040
10018
|
|
10041
10019
|
/**
|
10042
|
-
*
|
10043
|
-
* @param filter
|
10044
|
-
* @
|
10020
|
+
* Unregisters content scripts for this extension.
|
10021
|
+
* @param filter If specified, only unregisters dynamic content scripts which match the filter. Otherwise, all of the extension's dynamic content scripts are unregistered.
|
10022
|
+
* @since Chrome 96
|
10045
10023
|
*/
|
10046
10024
|
export function unregisterContentScripts(filter?: ContentScriptFilter): Promise<void>;
|
10047
|
-
|
10048
|
-
/**
|
10049
|
-
* Unregister one or more content scripts.
|
10050
|
-
* @param filter
|
10051
|
-
* @param callback
|
10052
|
-
*/
|
10053
10025
|
export function unregisterContentScripts(callback: () => void): void;
|
10054
|
-
export function unregisterContentScripts(filter: ContentScriptFilter, callback: () => void): void;
|
10026
|
+
export function unregisterContentScripts(filter: ContentScriptFilter | undefined, callback: () => void): void;
|
10055
10027
|
|
10056
10028
|
/**
|
10057
|
-
* Returns all
|
10058
|
-
*
|
10059
|
-
* @
|
10029
|
+
* Returns all dynamically registered content scripts for this extension that match the given filter.
|
10030
|
+
* @param filter An object to filter the extension's dynamically registered scripts.
|
10031
|
+
* @since Chrome 96
|
10060
10032
|
*/
|
10061
10033
|
export function getRegisteredContentScripts(filter?: ContentScriptFilter): Promise<RegisteredContentScript[]>;
|
10062
|
-
|
10063
|
-
/**
|
10064
|
-
* Returns all the content scripts registered with scripting.registerContentScripts()
|
10065
|
-
* or a subset of the registered scripts when using a filter.
|
10066
|
-
* @param filter
|
10067
|
-
* @param callback
|
10068
|
-
*/
|
10069
10034
|
export function getRegisteredContentScripts(callback: (scripts: RegisteredContentScript[]) => void): void;
|
10070
10035
|
export function getRegisteredContentScripts(
|
10071
|
-
filter: ContentScriptFilter,
|
10036
|
+
filter: ContentScriptFilter | undefined,
|
10072
10037
|
callback: (scripts: RegisteredContentScript[]) => void,
|
10073
10038
|
): void;
|
10074
10039
|
|
10075
10040
|
/**
|
10076
|
-
* Updates one or more content scripts.
|
10077
|
-
* @param scripts
|
10041
|
+
* Updates one or more content scripts for this extension.
|
10042
|
+
* @param scripts Contains a list of scripts to be updated. A property is only updated for the existing script if it is specified in this object. If there are errors during script parsing/file validation, or if the IDs specified do not correspond to a fully registered script, then no scripts are updated.
|
10043
|
+
* @since Chrome 96
|
10078
10044
|
*/
|
10079
10045
|
export function updateContentScripts(scripts: RegisteredContentScript[]): Promise<void>;
|
10080
|
-
|
10081
|
-
/**
|
10082
|
-
* Updates one or more content scripts.
|
10083
|
-
* @param scripts
|
10084
|
-
* @param callback
|
10085
|
-
*/
|
10086
10046
|
export function updateContentScripts(scripts: RegisteredContentScript[], callback: () => void): void;
|
10087
10047
|
}
|
10088
10048
|
|
@@ -12467,6 +12427,11 @@ declare namespace chrome {
|
|
12467
12427
|
color: `${Color}`;
|
12468
12428
|
/** The ID of the group. Group IDs are unique within a browser session. */
|
12469
12429
|
id: number;
|
12430
|
+
/**
|
12431
|
+
* Whether the group is shared.
|
12432
|
+
* @since Chrome 137
|
12433
|
+
*/
|
12434
|
+
shared: boolean;
|
12470
12435
|
/** The title of the group. */
|
12471
12436
|
title?: string;
|
12472
12437
|
/** The ID of the window that contains the group. */
|
@@ -12482,13 +12447,18 @@ declare namespace chrome {
|
|
12482
12447
|
|
12483
12448
|
export interface QueryInfo {
|
12484
12449
|
/** Whether the groups are collapsed. */
|
12485
|
-
collapsed?: boolean;
|
12450
|
+
collapsed?: boolean | undefined;
|
12486
12451
|
/** The color of the groups. */
|
12487
|
-
color?: `${Color}
|
12452
|
+
color?: `${Color}` | undefined;
|
12453
|
+
/**
|
12454
|
+
* Whether the group is shared.
|
12455
|
+
* @since Chrome 137
|
12456
|
+
*/
|
12457
|
+
shared?: boolean | undefined;
|
12488
12458
|
/** Match group titles against a pattern. */
|
12489
|
-
title?: string;
|
12459
|
+
title?: string | undefined;
|
12490
12460
|
/** The ID of the parent window, or {@link windows.WINDOW_ID_CURRENT} for the current window. */
|
12491
|
-
windowId?: number;
|
12461
|
+
windowId?: number | undefined;
|
12492
12462
|
}
|
12493
12463
|
|
12494
12464
|
export interface UpdateProperties {
|
@@ -13904,334 +13874,231 @@ declare namespace chrome {
|
|
13904
13874
|
* 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.
|
13905
13875
|
*/
|
13906
13876
|
export namespace windows {
|
13877
|
+
interface WindowsEvent<T extends (...args: any) => void> extends Omit<chrome.events.Event<T>, "addListener"> {
|
13878
|
+
addListener(callback: T, filter?: {
|
13879
|
+
windowTypes: `${WindowType}`[];
|
13880
|
+
}): void;
|
13881
|
+
}
|
13882
|
+
|
13907
13883
|
export interface Window {
|
13908
|
-
/**
|
13884
|
+
/** Array of {@link tabs.Tab} objects representing the current tabs in the window. */
|
13909
13885
|
tabs?: chrome.tabs.Tab[] | undefined;
|
13910
|
-
/**
|
13886
|
+
/** 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. */
|
13911
13887
|
top?: number | undefined;
|
13912
|
-
/**
|
13888
|
+
/** 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. */
|
13913
13889
|
height?: number | undefined;
|
13914
|
-
/**
|
13890
|
+
/** 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. */
|
13915
13891
|
width?: number | undefined;
|
13916
|
-
/**
|
13917
|
-
|
13918
|
-
* @since Chrome 17
|
13919
|
-
*/
|
13920
|
-
state?: windowStateEnum | undefined;
|
13892
|
+
/** The state of this browser window. */
|
13893
|
+
state?: `${WindowState}` | undefined;
|
13921
13894
|
/** Whether the window is currently the focused window. */
|
13922
13895
|
focused: boolean;
|
13923
|
-
/**
|
13924
|
-
* Whether the window is set to be always on top.
|
13925
|
-
* @since Chrome 19
|
13926
|
-
*/
|
13896
|
+
/** Whether the window is set to be always on top. */
|
13927
13897
|
alwaysOnTop: boolean;
|
13928
13898
|
/** Whether the window is incognito. */
|
13929
13899
|
incognito: boolean;
|
13930
|
-
/**
|
13931
|
-
|
13932
|
-
|
13933
|
-
type?: windowTypeEnum | undefined;
|
13934
|
-
/** 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. */
|
13900
|
+
/** The type of browser window this is. */
|
13901
|
+
type?: `${WindowType}` | undefined;
|
13902
|
+
/** 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. */
|
13935
13903
|
id?: number | undefined;
|
13936
|
-
/**
|
13904
|
+
/** 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. */
|
13937
13905
|
left?: number | undefined;
|
13938
|
-
/**
|
13939
|
-
* Optional. The session ID used to uniquely identify a Window obtained from the sessions API.
|
13940
|
-
* @since Chrome 31
|
13941
|
-
*/
|
13906
|
+
/** The session ID used to uniquely identify a window, obtained from the {@link sessions} API. */
|
13942
13907
|
sessionId?: string | undefined;
|
13943
13908
|
}
|
13944
13909
|
|
13910
|
+
/** @since Chrome 88 */
|
13945
13911
|
export interface QueryOptions {
|
13946
|
-
/**
|
13947
|
-
* Optional.
|
13948
|
-
* If true, the windows.Window object will have a tabs property that contains a list of the tabs.Tab objects.
|
13949
|
-
* The Tab objects only contain the url, pendingUrl, title and favIconUrl properties if the extension's manifest file includes the "tabs" permission.
|
13950
|
-
*/
|
13912
|
+
/** 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. */
|
13951
13913
|
populate?: boolean | undefined;
|
13952
|
-
/**
|
13953
|
-
|
13954
|
-
*/
|
13955
|
-
windowTypes?: windowTypeEnum[] | undefined;
|
13914
|
+
/** If set, the {@link windows.Window} returned is filtered based on its type. If unset, the default filter is set to `['normal', 'popup']`. */
|
13915
|
+
windowTypes?: `${WindowType}`[] | undefined;
|
13956
13916
|
}
|
13957
13917
|
|
13958
13918
|
export interface CreateData {
|
13959
|
-
/**
|
13960
|
-
* Optional. The id of the tab for which you want to adopt to the new window.
|
13961
|
-
* @since Chrome 10
|
13962
|
-
*/
|
13919
|
+
/** The ID of the tab to add to the new window. */
|
13963
13920
|
tabId?: number | undefined;
|
13964
|
-
/**
|
13965
|
-
* Optional.
|
13966
|
-
* 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.
|
13967
|
-
*/
|
13921
|
+
/** 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. */
|
13968
13922
|
url?: string | string[] | undefined;
|
13969
|
-
/**
|
13970
|
-
* Optional.
|
13971
|
-
* 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.
|
13972
|
-
*/
|
13923
|
+
/** 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. */
|
13973
13924
|
top?: number | undefined;
|
13974
|
-
/**
|
13975
|
-
* Optional.
|
13976
|
-
* The height in pixels of the new window, including the frame. If not specified defaults to a natural height.
|
13977
|
-
*/
|
13925
|
+
/** The height in pixels of the new window, including the frame. If not specified, defaults to a natural height. */
|
13978
13926
|
height?: number | undefined;
|
13979
|
-
/**
|
13980
|
-
* Optional.
|
13981
|
-
* The width in pixels of the new window, including the frame. If not specified defaults to a natural width.
|
13982
|
-
*/
|
13927
|
+
/** The width in pixels of the new window, including the frame. If not specified, defaults to a natural width. */
|
13983
13928
|
width?: number | undefined;
|
13984
|
-
/**
|
13985
|
-
* Optional. If true, opens an active window. If false, opens an inactive window.
|
13986
|
-
* @since Chrome 12
|
13987
|
-
*/
|
13929
|
+
/** If `true`, opens an active window. If `false`, opens an inactive window. */
|
13988
13930
|
focused?: boolean | undefined;
|
13989
|
-
/**
|
13931
|
+
/** Whether the new window should be an incognito window. */
|
13990
13932
|
incognito?: boolean | undefined;
|
13991
|
-
/**
|
13992
|
-
type?:
|
13993
|
-
/**
|
13994
|
-
* Optional.
|
13995
|
-
* 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.
|
13996
|
-
*/
|
13933
|
+
/** Specifies what type of browser window to create. */
|
13934
|
+
type?: `${CreateType}` | undefined;
|
13935
|
+
/** 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. */
|
13997
13936
|
left?: number | undefined;
|
13998
13937
|
/**
|
13999
|
-
*
|
13938
|
+
* The initial state of the window. The `minimized`, `maximized`, and `fullscreen` states cannot be combined with `left`, `top`, `width`, or `height`.
|
14000
13939
|
* @since Chrome 44
|
14001
13940
|
*/
|
14002
|
-
state?:
|
13941
|
+
state?: `${WindowState}` | undefined;
|
14003
13942
|
/**
|
14004
|
-
* If true
|
13943
|
+
* 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.
|
14005
13944
|
* @since Chrome 64
|
14006
13945
|
*/
|
14007
13946
|
setSelfAsOpener?: boolean | undefined;
|
14008
13947
|
}
|
14009
13948
|
|
14010
13949
|
export interface UpdateInfo {
|
14011
|
-
/**
|
13950
|
+
/** The offset from the top edge of the screen to move the window to in pixels. This value is ignored for panels. */
|
14012
13951
|
top?: number | undefined;
|
14013
|
-
/**
|
14014
|
-
* 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.
|
14015
|
-
* @since Chrome 14
|
14016
|
-
*/
|
13952
|
+
/** 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. */
|
14017
13953
|
drawAttention?: boolean | undefined;
|
14018
|
-
/**
|
13954
|
+
/** The height to resize the window to in pixels. This value is ignored for panels. */
|
14019
13955
|
height?: number | undefined;
|
14020
|
-
/**
|
13956
|
+
/** The width to resize the window to in pixels. This value is ignored for panels. */
|
14021
13957
|
width?: number | undefined;
|
14022
|
-
/**
|
14023
|
-
|
14024
|
-
|
14025
|
-
*/
|
14026
|
-
state?: windowStateEnum | undefined;
|
14027
|
-
/**
|
14028
|
-
* Optional. If true, brings the window to the front. If false, brings the next window in the z-order to the front.
|
14029
|
-
* @since Chrome 8
|
14030
|
-
*/
|
13958
|
+
/** The new state of the window. The 'minimized', 'maximized', and 'fullscreen' states cannot be combined with 'left', 'top', 'width', or 'height'. */
|
13959
|
+
state?: `${WindowState}` | undefined;
|
13960
|
+
/** 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'. */
|
14031
13961
|
focused?: boolean | undefined;
|
14032
|
-
/**
|
13962
|
+
/** The offset from the left edge of the screen to move the window to in pixels. This value is ignored for panels. */
|
14033
13963
|
left?: number | undefined;
|
14034
13964
|
}
|
14035
13965
|
|
14036
|
-
export interface WindowEventFilter {
|
14037
|
-
/**
|
14038
|
-
* 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.
|
14039
|
-
*/
|
14040
|
-
windowTypes: windowTypeEnum[];
|
14041
|
-
}
|
14042
|
-
|
14043
|
-
export interface WindowIdEvent extends chrome.events.Event<(windowId: number) => void> {
|
14044
|
-
addListener(
|
14045
|
-
callback: (windowId: number) => void,
|
14046
|
-
filters?: WindowEventFilter,
|
14047
|
-
): void;
|
14048
|
-
}
|
14049
|
-
|
14050
|
-
export interface WindowReferenceEvent extends chrome.events.Event<(window: Window) => void> {
|
14051
|
-
addListener(
|
14052
|
-
callback: (window: Window) => void,
|
14053
|
-
filters?: WindowEventFilter,
|
14054
|
-
): void;
|
14055
|
-
}
|
14056
|
-
|
14057
13966
|
/**
|
14058
13967
|
* Specifies what type of browser window to create.
|
14059
13968
|
* 'panel' is deprecated and is available only to existing whitelisted extensions on Chrome OS.
|
14060
13969
|
* @since Chrome 44
|
14061
13970
|
*/
|
14062
|
-
export
|
13971
|
+
export enum CreateType {
|
13972
|
+
/** Specifies the window as a standard window. */
|
13973
|
+
NORMAL = "normal",
|
13974
|
+
/** Specifies the window as a popup window. */
|
13975
|
+
POPUP = "popup",
|
13976
|
+
/** @deprecated Specifies the window as a panel. */
|
13977
|
+
PANEL = "panel",
|
13978
|
+
}
|
14063
13979
|
|
14064
13980
|
/**
|
14065
|
-
* The state of this browser window.
|
14066
|
-
* In some circumstances a window may not be assigned a state property; for example, when querying closed windows from the sessions API.
|
13981
|
+
* 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.
|
14067
13982
|
* @since Chrome 44
|
14068
13983
|
*/
|
14069
|
-
export
|
13984
|
+
export enum WindowState {
|
13985
|
+
/** Normal window state (not minimized, maximized, or fullscreen). */
|
13986
|
+
NORMAL = "normal",
|
13987
|
+
/** Minimized window state. */
|
13988
|
+
MINIMIZED = "minimized",
|
13989
|
+
/** Maximized window state. */
|
13990
|
+
MAXIMIZED = "maximized",
|
13991
|
+
/** Fullscreen window state. */
|
13992
|
+
FULLSCREEN = "fullscreen",
|
13993
|
+
/** Locked fullscreen window state. This fullscreen state cannot be exited by user action and is available only to allowlisted extensions on Chrome OS. */
|
13994
|
+
LOCKED_FULLSCREEN = "locked-fullscreen",
|
13995
|
+
}
|
14070
13996
|
|
14071
13997
|
/**
|
14072
|
-
* The type of browser window this is.
|
14073
|
-
* In some circumstances a window may not be assigned a type property; for example, when querying closed windows from the sessions API.
|
13998
|
+
* 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.
|
14074
13999
|
* @since Chrome 44
|
14075
14000
|
*/
|
14076
|
-
export
|
14001
|
+
export enum WindowType {
|
14002
|
+
/** A normal browser window. */
|
14003
|
+
NORMAL = "normal",
|
14004
|
+
/** A browser popup. */
|
14005
|
+
POPUP = "popup",
|
14006
|
+
/** @deprecated A Chrome App panel-style window. Extensions can only see their own panel windows. */
|
14007
|
+
PANEL = "panel",
|
14008
|
+
/** @deprecated A Chrome App window. Extensions can only see their app own windows. */
|
14009
|
+
APP = "app",
|
14010
|
+
/** A Developer Tools window. */
|
14011
|
+
DEVTOOLS = "devtools",
|
14012
|
+
}
|
14077
14013
|
|
14078
|
-
/**
|
14079
|
-
|
14080
|
-
|
14081
|
-
|
14082
|
-
export
|
14083
|
-
/**
|
14084
|
-
* The windowId value that represents the absence of a chrome browser window.
|
14085
|
-
* @since Chrome 6
|
14086
|
-
*/
|
14087
|
-
export var WINDOW_ID_NONE: -1;
|
14014
|
+
/** The windowId value that represents the current window. */
|
14015
|
+
export const WINDOW_ID_CURRENT: -2;
|
14016
|
+
|
14017
|
+
/** The windowId value that represents the absence of a Chrome browser window */
|
14018
|
+
export const WINDOW_ID_NONE: -1;
|
14088
14019
|
|
14089
|
-
/** Gets details about a window. */
|
14090
|
-
export function get(windowId: number, callback: (window: chrome.windows.Window) => void): void;
|
14091
|
-
/**
|
14092
|
-
* Gets details about a window.
|
14093
|
-
* @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14094
|
-
*/
|
14095
|
-
export function get(windowId: number): Promise<chrome.windows.Window>;
|
14096
14020
|
/**
|
14097
14021
|
* Gets details about a window.
|
14098
|
-
*
|
14022
|
+
*
|
14023
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14099
14024
|
*/
|
14025
|
+
export function get(windowId: number, queryOptions?: QueryOptions): Promise<Window>;
|
14026
|
+
export function get(windowId: number, callback: (window: Window) => void): void;
|
14100
14027
|
export function get(
|
14101
14028
|
windowId: number,
|
14102
|
-
queryOptions: QueryOptions,
|
14103
|
-
callback: (window:
|
14029
|
+
queryOptions: QueryOptions | undefined,
|
14030
|
+
callback: (window: Window) => void,
|
14104
14031
|
): void;
|
14105
|
-
|
14106
|
-
* Gets details about a window.
|
14107
|
-
* @since Chrome 18
|
14108
|
-
* @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14109
|
-
*/
|
14110
|
-
export function get(windowId: number, queryOptions: QueryOptions): Promise<chrome.windows.Window>;
|
14111
|
-
/** Gets the current window. */
|
14112
|
-
export function getCurrent(callback: (window: chrome.windows.Window) => void): void;
|
14113
|
-
/**
|
14114
|
-
* Gets the current window.
|
14115
|
-
* @return The `getCurrent` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14116
|
-
*/
|
14117
|
-
export function getCurrent(): Promise<chrome.windows.Window>;
|
14118
|
-
/**
|
14119
|
-
* Gets the current window.
|
14120
|
-
* @param QueryOptions
|
14121
|
-
* @since Chrome 18
|
14122
|
-
*/
|
14123
|
-
export function getCurrent(queryOptions: QueryOptions, callback: (window: chrome.windows.Window) => void): void;
|
14032
|
+
|
14124
14033
|
/**
|
14125
14034
|
* Gets the current window.
|
14126
|
-
*
|
14127
|
-
*
|
14128
|
-
* @return The `getCurrent` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14129
|
-
*/
|
14130
|
-
export function getCurrent(queryOptions: QueryOptions): Promise<chrome.windows.Window>;
|
14131
|
-
/**
|
14132
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
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(): Promise<chrome.windows.Window>;
|
14136
|
-
/**
|
14137
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
14138
|
-
* @param callback
|
14139
|
-
* Optional parameter window: Contains details about the created window.
|
14140
|
-
*/
|
14141
|
-
export function create(callback: (window?: chrome.windows.Window) => void): void;
|
14142
|
-
/**
|
14143
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
14144
|
-
* @param CreateData
|
14145
|
-
* @return The `create` method provides its result via callback or returned as a `Promise` (MV3 only). Contains details about the created window.
|
14146
|
-
*/
|
14147
|
-
export function create(createData: CreateData): Promise<chrome.windows.Window>;
|
14148
|
-
/**
|
14149
|
-
* Creates (opens) a new browser with any optional sizing, position or default URL provided.
|
14150
|
-
* @param CreateData
|
14151
|
-
* @param callback
|
14152
|
-
* Optional parameter window: Contains details about the created window.
|
14153
|
-
*/
|
14154
|
-
export function create(createData: CreateData, callback: (window?: chrome.windows.Window) => void): void;
|
14155
|
-
/**
|
14156
|
-
* Gets all windows.
|
14157
|
-
*/
|
14158
|
-
export function getAll(callback: (windows: chrome.windows.Window[]) => void): void;
|
14159
|
-
/**
|
14160
|
-
* Gets all windows.
|
14161
|
-
* @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14035
|
+
*
|
14036
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14162
14037
|
*/
|
14163
|
-
export function
|
14038
|
+
export function getCurrent(queryOptions?: QueryOptions): Promise<Window>;
|
14039
|
+
export function getCurrent(callback: (window: Window) => void): void;
|
14040
|
+
export function getCurrent(queryOptions: QueryOptions | undefined, callback: (window: Window) => void): void;
|
14041
|
+
|
14164
14042
|
/**
|
14165
|
-
*
|
14166
|
-
*
|
14043
|
+
* Creates (opens) a new browser window with any optional sizing, position, or default URL provided.
|
14044
|
+
*
|
14045
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14167
14046
|
*/
|
14168
|
-
export function
|
14047
|
+
export function create(createData?: CreateData): Promise<Window | undefined>;
|
14048
|
+
export function create(callback: (window?: Window) => void): void;
|
14049
|
+
export function create(createData: CreateData | undefined, callback: (window?: Window) => void): void;
|
14050
|
+
|
14169
14051
|
/**
|
14170
14052
|
* Gets all windows.
|
14171
|
-
*
|
14172
|
-
*
|
14053
|
+
*
|
14054
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14173
14055
|
*/
|
14174
|
-
export function getAll(queryOptions
|
14056
|
+
export function getAll(queryOptions?: QueryOptions): Promise<Window[]>;
|
14057
|
+
export function getAll(callback: (windows: Window[]) => void): void;
|
14058
|
+
export function getAll(queryOptions: QueryOptions | undefined, callback: (windows: Window[]) => void): void;
|
14059
|
+
|
14175
14060
|
/**
|
14176
|
-
* Updates the properties of a window. Specify only the properties that
|
14177
|
-
*
|
14061
|
+
* Updates the properties of a window. Specify only the properties that to be changed; unspecified properties are unchanged.
|
14062
|
+
*
|
14063
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14178
14064
|
*/
|
14179
|
-
export function update(
|
14180
|
-
|
14181
|
-
|
14182
|
-
): Promise<chrome.windows.Window>;
|
14183
|
-
/** Updates the properties of a window. Specify only the properties that you want to change; unspecified properties will be left unchanged. */
|
14184
|
-
export function update(
|
14185
|
-
windowId: number,
|
14186
|
-
updateInfo: UpdateInfo,
|
14187
|
-
callback: (window: chrome.windows.Window) => void,
|
14188
|
-
): void;
|
14065
|
+
export function update(windowId: number, updateInfo: UpdateInfo): Promise<Window>;
|
14066
|
+
export function update(windowId: number, updateInfo: UpdateInfo, callback: (window: Window) => void): void;
|
14067
|
+
|
14189
14068
|
/**
|
14190
|
-
* Removes (closes) a window
|
14191
|
-
*
|
14069
|
+
* Removes (closes) a window and all the tabs inside it.
|
14070
|
+
*
|
14071
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14192
14072
|
*/
|
14193
14073
|
export function remove(windowId: number): Promise<void>;
|
14194
|
-
/** Removes (closes) a window, and all the tabs inside it. */
|
14195
14074
|
export function remove(windowId: number, callback: () => void): void;
|
14075
|
+
|
14196
14076
|
/**
|
14197
14077
|
* Gets the window that was most recently focused — typically the window 'on top'.
|
14078
|
+
*
|
14079
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 88.
|
14198
14080
|
*/
|
14199
|
-
export function getLastFocused(
|
14200
|
-
|
14201
|
-
* Gets the window that was most recently focused — typically the window 'on top'.
|
14202
|
-
* @return The `getLastFocused` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14203
|
-
*/
|
14204
|
-
export function getLastFocused(): Promise<chrome.windows.Window>;
|
14205
|
-
/**
|
14206
|
-
* Gets the window that was most recently focused — typically the window 'on top'.
|
14207
|
-
* @since Chrome 18
|
14208
|
-
*/
|
14081
|
+
export function getLastFocused(queryOptions?: QueryOptions): Promise<Window>;
|
14082
|
+
export function getLastFocused(callback: (window: Window) => void): void;
|
14209
14083
|
export function getLastFocused(
|
14210
|
-
queryOptions: QueryOptions,
|
14211
|
-
callback: (window:
|
14084
|
+
queryOptions: QueryOptions | undefined,
|
14085
|
+
callback: (window: Window) => void,
|
14212
14086
|
): void;
|
14213
|
-
/**
|
14214
|
-
* Gets the window that was most recently focused — typically the window 'on top'.
|
14215
|
-
* @since Chrome 18
|
14216
|
-
* @return The `getLastFocused` method provides its result via callback or returned as a `Promise` (MV3 only).
|
14217
|
-
*/
|
14218
|
-
export function getLastFocused(queryOptions: QueryOptions): Promise<chrome.windows.Window>;
|
14219
14087
|
|
14220
14088
|
/** Fired when a window is removed (closed). */
|
14221
|
-
export
|
14089
|
+
export const onRemoved: WindowsEvent<(windowId: number) => void>;
|
14090
|
+
|
14222
14091
|
/** Fired when a window is created. */
|
14223
|
-
export
|
14224
|
-
|
14225
|
-
|
14226
|
-
|
14227
|
-
*/
|
14228
|
-
export var onFocusChanged: WindowIdEvent;
|
14092
|
+
export const onCreated: WindowsEvent<(window: Window) => void>;
|
14093
|
+
|
14094
|
+
/** 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. */
|
14095
|
+
export const onFocusChanged: WindowsEvent<(windowId: number) => void>;
|
14229
14096
|
|
14230
14097
|
/**
|
14231
14098
|
* Fired when a window has been resized; this event is only dispatched when the new bounds are committed, and not for in-progress changes.
|
14232
14099
|
* @since Chrome 86
|
14233
14100
|
*/
|
14234
|
-
export
|
14101
|
+
export const onBoundsChanged: events.Event<(window: Window) => void>;
|
14235
14102
|
}
|
14236
14103
|
|
14237
14104
|
////////////////////
|