mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #31218 from madmages/master
[@type/chrome] More precise types in contentSettings
This commit is contained in:
Vendored
+142
-13
@@ -762,6 +762,9 @@ declare namespace chrome.commands {
|
||||
* Permissions: "contentSettings"
|
||||
*/
|
||||
declare namespace chrome.contentSettings {
|
||||
|
||||
type ScopeEnum = 'regular' | 'incognito_session_only';
|
||||
|
||||
export interface ClearDetails {
|
||||
/**
|
||||
* Optional.
|
||||
@@ -770,7 +773,7 @@ declare namespace chrome.contentSettings {
|
||||
* * regular: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere),
|
||||
* * incognito_session_only: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings).
|
||||
*/
|
||||
scope?: string;
|
||||
scope?: ScopeEnum;
|
||||
}
|
||||
|
||||
export interface SetDetails {
|
||||
@@ -781,11 +784,63 @@ declare namespace chrome.contentSettings {
|
||||
/** Optional. The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see Content Setting Patterns. */
|
||||
secondaryPattern?: string;
|
||||
/** Optional. Where to set the setting (default: regular). */
|
||||
scope?: string;
|
||||
scope?: ScopeEnum;
|
||||
/** The pattern for the primary URL. For details on the format of a pattern, see Content Setting Patterns. */
|
||||
primaryPattern: string;
|
||||
}
|
||||
|
||||
export interface CookieSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'session_only';
|
||||
}
|
||||
|
||||
export interface ImagesSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block';
|
||||
}
|
||||
|
||||
export interface JavascriptSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block';
|
||||
}
|
||||
|
||||
export interface LocationSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface PluginsSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'detect_important_content';
|
||||
}
|
||||
|
||||
export interface PopupsSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block';
|
||||
}
|
||||
|
||||
export interface NotificationsSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface FullscreenSetDetails extends SetDetails {
|
||||
setting: 'allow';
|
||||
}
|
||||
|
||||
export interface MouselockSetDetails extends SetDetails {
|
||||
setting: 'allow';
|
||||
}
|
||||
|
||||
export interface MicrophoneSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface CameraSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface PpapiBrokerSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface MultipleAutomaticDownloadsSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface GetDetails {
|
||||
/** Optional. The secondary URL for which the content setting should be retrieved. Defaults to the primary URL. Note that the meaning of a secondary URL depends on the content type, and not all content types use secondary URLs. */
|
||||
secondaryUrl?: string;
|
||||
@@ -829,6 +884,58 @@ declare namespace chrome.contentSettings {
|
||||
get(details: GetDetails, callback: (details: ReturnedDetails) => void): void;
|
||||
}
|
||||
|
||||
export interface CookieContentSetting extends ContentSetting{
|
||||
set(details: CookieSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface PopupsContentSetting extends ContentSetting{
|
||||
set(details: PopupsSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface JavascriptContentSetting extends ContentSetting{
|
||||
set(details: JavascriptSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface NotificationsContentSetting extends ContentSetting{
|
||||
set(details: NotificationsSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface PluginsContentSetting extends ContentSetting{
|
||||
set(details: PluginsSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface ImagesContentSetting extends ContentSetting{
|
||||
set(details: ImagesSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface LocationContentSetting extends ContentSetting{
|
||||
set(details: LocationSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface FullscreenContentSetting extends ContentSetting{
|
||||
set(details: FullscreenSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface MouselockContentSetting extends ContentSetting{
|
||||
set(details: MouselockSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface MicrophoneContentSetting extends ContentSetting{
|
||||
set(details: MicrophoneSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface CameraContentSetting extends ContentSetting{
|
||||
set(details: CameraSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface PpapiBrokerContentSetting extends ContentSetting{
|
||||
set(details: PpapiBrokerSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface MultipleAutomaticDownloadsContentSetting extends ContentSetting{
|
||||
set(details: MultipleAutomaticDownloadsSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
/** The only content type using resource identifiers is contentSettings.plugins. For more information, see Resource Identifiers. */
|
||||
export interface ResourceIdentifier {
|
||||
/** The resource identifier for the given content type. */
|
||||
@@ -845,7 +952,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is allow.
|
||||
* The primary URL is the URL representing the cookie origin. The secondary URL is the URL of the top-level frame.
|
||||
*/
|
||||
export var cookies: ContentSetting;
|
||||
export var cookies: CookieContentSetting;
|
||||
/**
|
||||
* Whether to allow sites to show pop-ups. One of
|
||||
* allow: Allow sites to show pop-ups,
|
||||
@@ -853,7 +960,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is block.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var popups: ContentSetting;
|
||||
export var popups: PopupsContentSetting;
|
||||
/**
|
||||
* Whether to run JavaScript. One of
|
||||
* allow: Run JavaScript,
|
||||
@@ -861,7 +968,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is allow.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var javascript: ContentSetting;
|
||||
export var javascript: JavascriptContentSetting;
|
||||
/**
|
||||
* Whether to allow sites to show desktop notifications. One of
|
||||
* allow: Allow sites to show desktop notifications,
|
||||
@@ -870,7 +977,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the document which wants to show the notification. The secondary URL is not used.
|
||||
*/
|
||||
export var notifications: ContentSetting;
|
||||
export var notifications: NotificationsContentSetting;
|
||||
/**
|
||||
* Whether to run plugins. One of
|
||||
* allow: Run plugins automatically,
|
||||
@@ -879,7 +986,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is allow.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var plugins: ContentSetting;
|
||||
export var plugins: PluginsContentSetting;
|
||||
/**
|
||||
* Whether to show images. One of
|
||||
* allow: Show images,
|
||||
@@ -887,7 +994,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is allow.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is the URL of the image.
|
||||
*/
|
||||
export var images: ContentSetting;
|
||||
export var images: ImagesContentSetting;
|
||||
/**
|
||||
* Since Chrome 42.
|
||||
* Whether to allow Geolocation. One of
|
||||
@@ -897,7 +1004,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the document which requested location data. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL).
|
||||
*/
|
||||
export var location: ContentSetting;
|
||||
export var location: LocationContentSetting;
|
||||
/**
|
||||
* Since Chrome 42.
|
||||
* Whether to allow sites to toggle the fullscreen mode. One of
|
||||
@@ -906,7 +1013,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the document which requested to toggle the fullscreen mode. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL).
|
||||
*/
|
||||
export var fullscreen: ContentSetting;
|
||||
export var fullscreen: FullscreenContentSetting;
|
||||
/**
|
||||
* Since Chrome 42.
|
||||
* Whether to allow sites to disable the mouse cursor. One of
|
||||
@@ -916,7 +1023,29 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var mouselock: ContentSetting;
|
||||
export var mouselock: MouselockContentSetting;
|
||||
/**
|
||||
* Since Chrome 46.
|
||||
* Whether to allow sites to access the microphone. One of
|
||||
* allow: Allow sites to access the microphone,
|
||||
* block: Don't allow sites to access the microphone,
|
||||
* ask: Ask when a site wants to access the microphone.
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the document which requested microphone access. The secondary URL is not used.
|
||||
* NOTE: The 'allow' setting is not valid if both patterns are ''.
|
||||
*/
|
||||
export var microphone: MicrophoneContentSetting;
|
||||
/**
|
||||
* Since Chrome 46.
|
||||
* Whether to allow sites to access the camera. One of
|
||||
* allow: Allow sites to access the camera,
|
||||
* block: Don't allow sites to access the camera,
|
||||
* ask: Ask when a site wants to access the camera.
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the document which requested camera access. The secondary URL is not used.
|
||||
* NOTE: The 'allow' setting is not valid if both patterns are ''.
|
||||
*/
|
||||
export var camera: CameraContentSetting;
|
||||
/**
|
||||
* Since Chrome 42.
|
||||
* Whether to allow sites to run plugins unsandboxed. One of
|
||||
@@ -926,7 +1055,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var unsandboxedPlugins: ContentSetting;
|
||||
export var unsandboxedPlugins: PpapiBrokerContentSetting;
|
||||
/**
|
||||
* Since Chrome 42.
|
||||
* Whether to allow sites to download multiple files automatically. One of
|
||||
@@ -936,7 +1065,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var automaticDownloads: ContentSetting;
|
||||
export var automaticDownloads: MultipleAutomaticDownloadsContentSetting;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
Reference in New Issue
Block a user