diff --git a/CS410TeamWXYZ-ProgressReport.pdf b/CS410TeamWXYZ-ProgressReport.pdf
new file mode 100644
index 000000000..7ef2917cc
Binary files /dev/null and b/CS410TeamWXYZ-ProgressReport.pdf differ
diff --git a/CS410TeamWXYZ-ProjectProposalSubmission.pdf b/CS410TeamWXYZ-ProjectProposalSubmission.pdf
new file mode 100644
index 000000000..e7e4faefb
Binary files /dev/null and b/CS410TeamWXYZ-ProjectProposalSubmission.pdf differ
diff --git a/ProjectDocumentationAndUsage.pdf b/ProjectDocumentationAndUsage.pdf
new file mode 100755
index 000000000..24bad5958
Binary files /dev/null and b/ProjectDocumentationAndUsage.pdf differ
diff --git a/README.md b/README.md
index a7b40d2cc..793501397 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,115 @@
-# CourseProject
+# CS410-Final-Project
+A chrome extension that indexes the current page to allow users to search over the page using common retrieval functions.
-Please fork this repository and paste the github link of your fork on Microsoft CMT. Detailed instructions are on Coursera under Week 1: Course Project Overview/Week 9 Activities.
+[Software Documentation](#implementation)
+
+[Usage](#usage)
+
+[Demo Video](https://www.youtube.com/watch?v=agyJ-4IclAc "Demo Video")
+
+# Overview
+
+The objective of this project is to develop a Chrome extension for intelligent browsing. Specifically, we developed a Chrome extension that indexes the current page to allow users to search over the page using the OkapiBM25 ranking function from the metapy package. In addition, we implemented a frontend UI that the users can use to input a search string, and the top 5 results are displayed back to the user.
+The text preprocessing, cleaning, indexing, and ranking functionalities are handled in the backend flask-api using the metapy package.
+
+## Implementation
+The software is implemented in two components:
+
+### (1) Frontend – Chrome extension
+
+The core UI is implemented in popout.html and popout.css, consisting of the UI code for search and display results. The extension is located in the chrome_intelli_search folder.
+backend.js file contains the event listeners to handle the search submission on click by extracting the text from the currently active tab. We utilize the chrome.scripting.executeScript to execute the text scraper functionality on the active window, POST and fetch data from the backend flask-api using the javascript ‘fetch’ method and dynamically render the resulting json results. We utilize basic HTML, CSS, Javascript, and default Chrome extension APIs to accomplish the frontend-backend communication and UI rendering.
+
+### (2) Backend - Flask API server
+
+The backend server is designed with Flask-API, and the text search indexing/ranking functionality is developed using the MetaPy packages. All the required packages to run the server are in the requirements.txt file. The server is run locally for the initial implementation is per user. The flask-API server is located in the flaskapi folder.
+
+The Flask-API implements a /search route that expects at least two parameters, the raw text from the HTML page(corpus) and the search string. Optionally, a ranker option can be passed to test out other available rankers. However, for this project, we implement OkapiBM25 as the default ranker.
+The search engine pipeline is a three-stage pipeline with Preprocessing, tokenization/stemming, and indexing/ranking stages.
+
+### Preprocessing Pipeline:
+1. Split lines
+2. Get rid of lines with one word or less
+3. Create data set each sentence in a line
+4. Write to dataset file from the configuration file
+
+### Tokenization/Stop Word removal/Stemming/N-Grams
+We utilize the Metapy’s rich API to perform further preprocessing of the documents as follows:
+1. ICUTokenizer to tokenize raw text and provide an Iterable that spits out the individual text tokens.
+2. Lowercase to convert all tokens to lowercase
+3. Porter2 Stemmer to stemmer, or lemmatize the tokens by reducing the words from its inflections.
+4. Ngram-word-1 to bag of words” representation or “unigram word counts”.
+
+### Indexing and Ranking
+
+An inverted index is created using the metapy’s make_inverted_index function and BM25 ranker is instantiated with the parameters k1=2.4, b=0.75 and k3=400. A query document is created using the search string and the ranker is queried to score and return the top-5 results.
+
+#Project Environments:
+1. Python 3.7, Metapy, Flask-API
+2. Chrome
+
+
+### Testing the Backend :
+#### Sample Server Request/Response
+```
+$:~/code/admin/ill/CS410Text/CS410-CourseProject-Team-WXYZ/flaskapi
+$ curl -X POST -H "Content-Type: application/json" -d '{"corpus":"Hello Inteli Searcher", "search": "searcher", "ranker": "test"}' -i http://127.0.0.1:5000/search
+HTTP/1.0 200 OK
+Content-Type: application/json
+Content-Length: 45
+Access-Control-Allow-Origin: *
+Access-Control-Allow-Headers: Content-Type,Authorization
+Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS
+Access-Control-Allow-Credentials: true
+Server: Werkzeug/1.0.0 Python/3.7.6
+Date: Fri, 09 Dec 2022 04:30:45 GMT
+```
+
+```
+{"search_results":["Hello Inteli Searcher"]}
+```
+
+# Usage:
+#### Requirements: Python Version 3.7
+
+### 1. Run Flask-API server
+```
+$cd /flaskapi
+
+Optional: Setting pythong 3.7 environment in conda.
+
+$ conda create -n testenv python=3.7
+$ conda activate testenv
+
+**This project was tested on python version 3.7. Please use a Python version 3.7 environment.
+
+$ pip install -r requirements.txt
+$ python app.py
+```
+
+
+
+Testing the API:
+
+```
+$ curl -X POST -H "Content-Type: application/json" -d '{"corpus":"Hello Inteli Searcher", "search": "searcher", "ranker": "test"}' -i http://127.0.0.1:5000/search
+ ```
+
+
+
+### 2. Install Chrome Extension
+
+
+
+
+
+### 3. Browse, Search & Results
+
+
+
+Items are highlighted once the user clicks on each of the search results. Items are not unhighlighted, however, until page is refreshed.
+
+
+### Contribution of Team:
+
+All team members participated in all the backend and frontend work. Lot of hours were spent on learning the technology and getting up to speed on tasks such as developing Chrome extensions and developing in Flask-API.
diff --git a/chrome_intelli_search/backend.js b/chrome_intelli_search/backend.js
new file mode 100644
index 000000000..8a15e2aeb
--- /dev/null
+++ b/chrome_intelli_search/backend.js
@@ -0,0 +1,90 @@
+//Get all the UI objects for manipulation
+let searchButton = document.getElementById("search");
+let inputSearch = document.getElementById("search-box-input");
+let resultsContainer = document.getElementById("searchResultsContainer");
+let ranker = document.getElementById("documentTypeDropdown");
+let resultsList = document.getElementById("search-results");
+let lastItem = '';
+//Add Click event listener for the search button
+searchButton.addEventListener("click", async () => {
+ let [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
+
+ //Utilizing chrome extension scripting library execute script to send the page text and search string
+ //to backend api for searchinging
+ //The executeScript executes the searchText function in the current active tabs context and scrapes the text of the HTML document
+ //On success calls the fetch data to retrieve the ranked results.
+ chrome.scripting.executeScript({
+ target: { tabId: tab.id },
+ func: searchText,
+ },
+ (response) => {
+ fetchData(response[0].result, inputSearch.value, ranker.value).then((data) => {
+ searchButton.innerText = 'Search';
+ resultsList.innerHTML = '';
+ //Construct results list
+ for(const item of data.search_results) {
+ const li = document.createElement("li");
+ li.innerText = item;
+ li.addEventListener("click", async() => {
+ chrome.scripting.executeScript({
+ target: { tabId: tab.id },
+ func: elemsContainingText,
+ args: [item]
+ });
+ })
+ resultsList.appendChild(li);
+ }
+ let x = JSON.stringify(data.search_results);
+ console.log(x);
+
+ });
+ });
+
+});
+
+//Function to fetchData from the backend
+//Currently the server runs on the local machine
+async function fetchData(corpus, search, ranker) {
+ searchButton.innerHTML = 'Searching...';
+ const url = "http://127.0.0.1:5000/search";
+ data = {
+ "corpus": corpus,
+ "search" : search,
+ "ranker": ranker
+ };
+
+ let results = await fetch(url, {
+ method: 'POST',
+ cache: 'no-cache',
+ //mode: 'no-cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(data)
+ }).then(response => response.json())
+ .then(json => {
+ console.log(JSON.stringify(json));
+ return json;
+ })
+
+ return results;
+}
+
+// The body of this function will be executed as a content script inside the
+// current page to extract the current tabs to text to search
+function searchText() {
+ return document.body.innerText;
+}
+
+function elemsContainingText(item) {
+ console.log('item',item);
+ let elementList = [...document.querySelectorAll("p,h1,h2,h3,h4,h5,h6,li,span")];
+ console.log(elementList);
+ for (let el of elementList) {
+ if (el.innerText.includes(item)) {
+ console.log(el);
+ el.style.backgroundColor="yellow";
+ }
+ }
+ return;
+}
\ No newline at end of file
diff --git a/chrome_intelli_search/background.js b/chrome_intelli_search/background.js
new file mode 100644
index 000000000..fb11f3521
--- /dev/null
+++ b/chrome_intelli_search/background.js
@@ -0,0 +1,6 @@
+let color = '#3aa757';
+
+chrome.runtime.onInstalled.addListener(() => {
+ chrome.storage.sync.set({ color });
+ console.log('Default background color set to %cgreen', `color: ${color}`);
+});
\ No newline at end of file
diff --git a/chrome_intelli_search/images/get_started128.png b/chrome_intelli_search/images/get_started128.png
new file mode 100644
index 000000000..4c1cf8761
Binary files /dev/null and b/chrome_intelli_search/images/get_started128.png differ
diff --git a/chrome_intelli_search/images/get_started16.png b/chrome_intelli_search/images/get_started16.png
new file mode 100644
index 000000000..fb8531c8e
Binary files /dev/null and b/chrome_intelli_search/images/get_started16.png differ
diff --git a/chrome_intelli_search/images/get_started32.png b/chrome_intelli_search/images/get_started32.png
new file mode 100644
index 000000000..77152233a
Binary files /dev/null and b/chrome_intelli_search/images/get_started32.png differ
diff --git a/chrome_intelli_search/images/get_started48.png b/chrome_intelli_search/images/get_started48.png
new file mode 100644
index 000000000..94ddde9b3
Binary files /dev/null and b/chrome_intelli_search/images/get_started48.png differ
diff --git a/chrome_intelli_search/images/popup.js b/chrome_intelli_search/images/popup.js
new file mode 100644
index 000000000..e69de29bb
diff --git a/chrome_intelli_search/manifest.json b/chrome_intelli_search/manifest.json
new file mode 100644
index 000000000..b207d11aa
--- /dev/null
+++ b/chrome_intelli_search/manifest.json
@@ -0,0 +1,26 @@
+{
+ "name": "CS410 Final Project Extension",
+ "description": "This extension does some thingies",
+ "version": "1.0",
+ "manifest_version": 3,
+ "background": {
+ "service_worker": "background.js"
+ },
+ "permissions": ["storage", "activeTab", "scripting", "tabs"],
+ "action": {
+ "default_popup": "popup.html",
+ "default_icon": {
+ "16": "/images/get_started16.png",
+ "32": "/images/get_started32.png",
+ "48": "/images/get_started48.png",
+ "128": "/images/get_started128.png"
+ }
+ },
+ "icons": {
+ "16": "/images/get_started16.png",
+ "32": "/images/get_started32.png",
+ "48": "/images/get_started48.png",
+ "128": "/images/get_started128.png"
+ },
+ "options_page": "options.html"
+}
diff --git a/chrome_intelli_search/node_modules/.package-lock.json b/chrome_intelli_search/node_modules/.package-lock.json
new file mode 100644
index 000000000..42b8ea808
--- /dev/null
+++ b/chrome_intelli_search/node_modules/.package-lock.json
@@ -0,0 +1,38 @@
+{
+ "name": "cs410-final-project",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "node_modules/@types/chrome": {
+ "version": "0.0.200",
+ "resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.0.200.tgz",
+ "integrity": "sha512-oNT2/KHgZECTzj4oavLc20r3D2yFufLwGNaLFAN8YxYyNVJGenX3l3oGBynhoT/Azm3eAfyDynrdca6jB7CNzw==",
+ "dev": true,
+ "dependencies": {
+ "@types/filesystem": "*",
+ "@types/har-format": "*"
+ }
+ },
+ "node_modules/@types/filesystem": {
+ "version": "0.0.32",
+ "resolved": "https://registry.npmjs.org/@types/filesystem/-/filesystem-0.0.32.tgz",
+ "integrity": "sha512-Yuf4jR5YYMR2DVgwuCiP11s0xuVRyPKmz8vo6HBY3CGdeMj8af93CFZX+T82+VD1+UqHOxTq31lO7MI7lepBtQ==",
+ "dev": true,
+ "dependencies": {
+ "@types/filewriter": "*"
+ }
+ },
+ "node_modules/@types/filewriter": {
+ "version": "0.0.29",
+ "resolved": "https://registry.npmjs.org/@types/filewriter/-/filewriter-0.0.29.tgz",
+ "integrity": "sha512-BsPXH/irW0ht0Ji6iw/jJaK8Lj3FJemon2gvEqHKpCdDCeemHa+rI3WBGq5z7cDMZgoLjY40oninGxqk+8NzNQ==",
+ "dev": true
+ },
+ "node_modules/@types/har-format": {
+ "version": "1.2.9",
+ "resolved": "https://registry.npmjs.org/@types/har-format/-/har-format-1.2.9.tgz",
+ "integrity": "sha512-rffW6MhQ9yoa75bdNi+rjZBAvu2HhehWJXlhuWXnWdENeuKe82wUgAwxYOb7KRKKmxYN+D/iRKd2NDQMLqlUmg==",
+ "dev": true
+ }
+ }
+}
diff --git a/chrome_intelli_search/node_modules/@types/chrome/LICENSE b/chrome_intelli_search/node_modules/@types/chrome/LICENSE
new file mode 100644
index 000000000..9e841e7a2
--- /dev/null
+++ b/chrome_intelli_search/node_modules/@types/chrome/LICENSE
@@ -0,0 +1,21 @@
+ MIT License
+
+ Copyright (c) Microsoft Corporation.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE
diff --git a/chrome_intelli_search/node_modules/@types/chrome/README.md b/chrome_intelli_search/node_modules/@types/chrome/README.md
new file mode 100644
index 000000000..c30344e5d
--- /dev/null
+++ b/chrome_intelli_search/node_modules/@types/chrome/README.md
@@ -0,0 +1,16 @@
+# Installation
+> `npm install --save @types/chrome`
+
+# Summary
+This package contains type definitions for Chrome extension development (http://developer.chrome.com/extensions/).
+
+# Details
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
+
+### Additional Details
+ * Last updated: Wed, 26 Oct 2022 20:32:58 GMT
+ * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
+ * Global values: `chrome`
+
+# Credits
+These definitions were written by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [sreimer15](https://github.com/sreimer15), [MatCarlson](https://github.com/MatCarlson), [ekinsol](https://github.com/ekinsol), [Brian Wilson](https://github.com/echoabstract), [Sebastiaan Pasma](https://github.com/spasma), [bdbai](https://github.com/bdbai), [pokutuna](https://github.com/pokutuna), [Jason Xian](https://github.com/JasonXian), [userTim](https://github.com/usertim), [Idan Zeierman](https://github.com/idan315), [Nicolas Rodriguez](https://github.com/nicolas377), and [Ido Salomon](https://github.com/idosal).
diff --git a/chrome_intelli_search/node_modules/@types/chrome/chrome-cast/index.d.ts b/chrome_intelli_search/node_modules/@types/chrome/chrome-cast/index.d.ts
new file mode 100644
index 000000000..e81df0522
--- /dev/null
+++ b/chrome_intelli_search/node_modules/@types/chrome/chrome-cast/index.d.ts
@@ -0,0 +1,1161 @@
+// Type definitions for Chrome Cast application development
+// Project: https://developers.google.com/cast/
+// Definitions by: Thomas Stig Jacobsen
+// Stefan Ullinger
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+////////////////////
+// Cast
+// @see https://code.google.com/p/chromium/codesearch#chromium/src/ui/file_manager/externs/chrome_cast.js
+////////////////////
+declare namespace chrome.cast {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.AutoJoinPolicy
+ */
+ export enum AutoJoinPolicy {
+ CUSTOM_CONTROLLER_SCOPED = 'custom_controller_scoped',
+ TAB_AND_ORIGIN_SCOPED = 'tab_and_origin_scoped',
+ ORIGIN_SCOPED = 'origin_scoped',
+ PAGE_SCOPED = 'page_scoped',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.DefaultActionPolicy
+ */
+ export enum DefaultActionPolicy {
+ CREATE_SESSION = 'create_session',
+ CAST_THIS_TAB = 'cast_this_tab',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.Capability
+ */
+ export enum Capability {
+ VIDEO_OUT = 'video_out',
+ AUDIO_OUT = 'audio_out',
+ VIDEO_IN = 'video_in',
+ AUDIO_IN = 'audio_in',
+ MULTIZONE_GROUP = 'multizone_group',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ErrorCode
+ */
+ export enum ErrorCode {
+ CANCEL = 'cancel',
+ TIMEOUT = 'timeout',
+ API_NOT_INITIALIZED = 'api_not_initialized',
+ INVALID_PARAMETER = 'invalid_parameter',
+ EXTENSION_NOT_COMPATIBLE = 'extension_not_compatible',
+ EXTENSION_MISSING = 'extension_missing',
+ RECEIVER_UNAVAILABLE = 'receiver_unavailable',
+ SESSION_ERROR = 'session_error',
+ CHANNEL_ERROR = 'channel_error',
+ LOAD_MEDIA_FAILED = 'load_media_failed',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ReceiverAvailability
+ */
+ export enum ReceiverAvailability {
+ AVAILABLE = 'available',
+ UNAVAILABLE = 'unavailable',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.SenderPlatform
+ */
+ export enum SenderPlatform {
+ CHROME = 'chrome',
+ IOS = 'ios',
+ ANDROID = 'android',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ReceiverType
+ */
+ export enum ReceiverType {
+ CAST = 'cast',
+ DIAL = 'dial',
+ HANGOUT = 'hangout',
+ CUSTOM = 'custom',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ReceiverAction
+ */
+ export enum ReceiverAction {
+ CAST = 'cast',
+ STOP = 'stop',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.SessionStatus
+ */
+ export enum SessionStatus {
+ CONNECTED = 'connected',
+ DISCONNECTED = 'disconnected',
+ STOPPED = 'stopped',
+ }
+
+ /**
+ * @const {!Array}
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.VERSION
+ */
+ export var VERSION: Array;
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.isAvailable
+ */
+ export var isAvailable: boolean;
+
+ /**
+ * @param apiConfig
+ * @param successCallback
+ * @param errorCallback
+ */
+ export function initialize(
+ apiConfig: chrome.cast.ApiConfig,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param successCallback
+ * @param errorCallback
+ * @param opt_sessionRequest
+ * @param opt_label
+ */
+ export function requestSession(
+ successCallback: (session: chrome.cast.Session) => void,
+ errorCallback: (error: chrome.cast.Error) => void,
+ sessionRequest?: chrome.cast.SessionRequest,
+ label?: string,
+ ): void;
+
+ /**
+ * @param sessionId The id of the session to join.
+ */
+ export function requestSessionById(sessionId: string): void;
+
+ /**
+ * @param listener
+ */
+ export function addReceiverActionListener(
+ listener: (receiver: chrome.cast.Receiver, receiverAction: chrome.cast.ReceiverAction) => void,
+ ): void;
+
+ /**
+ * @param listener
+ */
+ export function removeReceiverActionListener(
+ listener: (receiver: chrome.cast.Receiver, receiverAction: chrome.cast.ReceiverAction) => void,
+ ): void;
+
+ /**
+ * @param message The message to log.
+ */
+ export function logMessage(message: string): void;
+
+ /**
+ * @param receivers
+ * @param successCallback
+ * @param errorCallback
+ */
+ export function setCustomReceivers(
+ receivers: Array,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param receiver
+ * @param successCallback
+ * @param errorCallback
+ */
+ export function setReceiverDisplayStatus(
+ receiver: chrome.cast.Receiver,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param escaped A string to unescape.
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.unescape
+ */
+ export function unescape(escaped: string): string;
+
+ export class ApiConfig {
+ /**
+ * @param sessionRequest
+ * @param sessionListener
+ * @param receiverListener
+ * @param opt_autoJoinPolicy
+ * @param opt_defaultActionPolicy
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ApiConfig
+ */
+ constructor(
+ sessionRequest: chrome.cast.SessionRequest,
+ sessionListener: (session: chrome.cast.Session) => void,
+ receiverListener: (receiverAvailability: chrome.cast.ReceiverAvailability) => void,
+ autoJoinPolicy?: chrome.cast.AutoJoinPolicy,
+ defaultActionPolicy?: chrome.cast.DefaultActionPolicy,
+ );
+
+ sessionRequest: chrome.cast.SessionRequest;
+ sessionListener: (session: chrome.cast.Session) => void;
+ receiverListener: (receiverAvailability: chrome.cast.ReceiverAvailability) => void;
+ autoJoinPolicy: chrome.cast.AutoJoinPolicy;
+ defaultActionPolicy: chrome.cast.DefaultActionPolicy;
+ }
+
+ export class Error {
+ /**
+ * @param code
+ * @param opt_description
+ * @param opt_details
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Error
+ */
+ constructor(code: chrome.cast.ErrorCode, description?: string, details?: Object);
+
+ code: chrome.cast.ErrorCode;
+ description: string | null;
+ details: object;
+ }
+
+ export class Image {
+ /**
+ * @param url
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Image
+ */
+ constructor(url: string);
+
+ url: string;
+ height: number | null;
+ width: number | null;
+ }
+
+ export class SenderApplication {
+ /**
+ * @param platform
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SenderApplication
+ */
+ constructor(platform: chrome.cast.SenderPlatform);
+
+ platform: chrome.cast.SenderPlatform;
+ url: string | null;
+ packageId: string | null;
+ }
+
+ export class SessionRequest {
+ /**
+ * @param appId
+ * @param opt_capabilities
+ * @param opt_timeout
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SessionRequest
+ */
+ constructor(appId: string, capabilities?: Array, timeout?: number);
+
+ appId: string;
+ capabilities: Array;
+ requestSessionTimeout: number;
+ language: string | null;
+ }
+
+ export class Session {
+ /**
+ * @param sessionId
+ * @param appId
+ * @param displayName
+ * @param appImages
+ * @param receiver
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Session
+ */
+ constructor(
+ sessionId: string,
+ appId: string,
+ displayName: string,
+ appImages: Array,
+ receiver: chrome.cast.Receiver,
+ );
+
+ sessionId: string;
+ appId: string;
+ displayName: string;
+ appImages: Array;
+ receiver: chrome.cast.Receiver;
+ senderApps: Array;
+ namespaces: Array<{ name: string }>;
+ media: Array;
+ status: chrome.cast.SessionStatus;
+ statusText: string | null;
+ transportId: string;
+
+ /**
+ * @param newLevel
+ * @param successCallback
+ * @param errorCallback
+ */
+ setReceiverVolumeLevel(
+ newLevel: number,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param muted
+ * @param successCallback
+ * @param errorCallback
+ */
+ setReceiverMuted(
+ muted: boolean,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param successCallback
+ * @param errorCallback
+ */
+ leave(successCallback: Function, errorCallback: (error: chrome.cast.Error) => void): void;
+
+ /**
+ * @param successCallback
+ * @param errorCallback
+ */
+ stop(successCallback: Function, errorCallback: (error: chrome.cast.Error) => void): void;
+
+ /**
+ * @param namespace
+ * @param message
+ * @param successCallback
+ * @param errorCallback
+ */
+ sendMessage(
+ namespace: string,
+ message: string | object,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param listener
+ */
+ addUpdateListener(listener: (isAlive: boolean) => void): void;
+
+ /**
+ * @param listener
+ */
+ removeUpdateListener(listener: (isAlive: boolean) => void): void;
+
+ /**
+ * @param namespace
+ * @param listener
+ */
+ addMessageListener(namespace: string, listener: (namespace: string, message: string) => void): void;
+
+ /**
+ * @param namespace
+ * @param listener
+ */
+ removeMessageListener(namespace: string, listener: (namespace: string, message: string) => void): void;
+
+ /**
+ * @param listener
+ */
+ addMediaListener(listener: (media: chrome.cast.media.Media) => void): void;
+
+ /**
+ * @param listener
+ */
+ removeMediaListener(listener: (media: chrome.cast.media.Media) => void): void;
+
+ /**
+ * @param loadRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ loadMedia(
+ loadRequest: chrome.cast.media.LoadRequest,
+ successCallback: (media: chrome.cast.media.Media) => void,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param queueLoadRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ queueLoad(
+ queueLoadRequest: chrome.cast.media.QueueLoadRequest,
+ successCallback: (media: chrome.cast.media.Media) => void,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+ }
+
+ export class Receiver {
+ /**
+ * @param label
+ * @param friendlyName
+ * @param opt_capabilities
+ * @param opt_volume
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Receiver
+ */
+ constructor(
+ label: string,
+ friendlyName: string,
+ capabilities?: Array,
+ volume?: chrome.cast.Volume,
+ );
+
+ label: string;
+ friendlyName: string;
+ capabilities: Array;
+ volume: chrome.cast.Volume;
+ receiverType: chrome.cast.ReceiverType;
+ displayStatus: chrome.cast.ReceiverDisplayStatus;
+ }
+
+ export class ReceiverDisplayStatus {
+ /**
+ * @param statusText
+ * @param appImages
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverDisplayStatus
+ */
+ constructor(statusText: string, appImages: Array);
+
+ statusText: string;
+ appImages: Array;
+ }
+
+ export class Volume {
+ /**
+ * @param opt_level
+ * @param opt_muted
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Volume
+ */
+ constructor(level?: number, muted?: boolean);
+
+ level: number | null;
+ muted: boolean | null;
+ }
+}
+
+declare namespace chrome.cast.media {
+ export var DEFAULT_MEDIA_RECEIVER_APP_ID: string;
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.MediaCommand
+ */
+ export enum MediaCommand {
+ PAUSE = 'pause',
+ SEEK = 'seek',
+ STREAM_VOLUME = 'stream_volume',
+ STREAM_MUTE = 'stream_mute',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.MetadataType
+ */
+ export enum MetadataType {
+ GENERIC,
+ TV_SHOW,
+ MOVIE,
+ MUSIC_TRACK,
+ PHOTO,
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.PlayerState
+ */
+ export enum PlayerState {
+ IDLE = 'IDLE',
+ PLAYING = 'PLAYING',
+ PAUSED = 'PAUSED',
+ BUFFERING = 'BUFFERING',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.ResumeState
+ */
+ export enum ResumeState {
+ PLAYBACK_START = 'PLAYBACK_START',
+ PLAYBACK_PAUSE = 'PLAYBACK_PAUSE',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.StreamType
+ */
+ export enum StreamType {
+ BUFFERED = 'BUFFERED',
+ LIVE = 'LIVE',
+ OTHER = 'OTHER',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.IdleReason
+ */
+ export enum IdleReason {
+ CANCELLED = 'CANCELLED',
+ INTERRUPTED = 'INTERRUPTED',
+ FINISHED = 'FINISHED',
+ ERROR = 'ERROR',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.RepeatMode
+ */
+ export enum RepeatMode {
+ OFF = 'REPEAT_OFF',
+ ALL = 'REPEAT_ALL',
+ SINGLE = 'REPEAT_SINGLE',
+ ALL_AND_SHUFFLE = 'REPEAT_ALL_AND_SHUFFLE',
+ }
+
+ export class QueueItem {
+ /**
+ * @param mediaInfo
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueItem
+ */
+ constructor(mediaInfo: chrome.cast.media.MediaInfo);
+
+ activeTrackIds: Array;
+ autoplay: boolean;
+ customData: Object;
+ itemId: number;
+ media: chrome.cast.media.MediaInfo;
+ preloadTime: number;
+ startTime: number;
+ }
+
+ export class QueueLoadRequest {
+ /**
+ * @param items
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest
+ */
+ constructor(items: Array);
+
+ customData: Object;
+ items: Array;
+ repeatMode: chrome.cast.media.RepeatMode;
+ startIndex: number;
+ }
+
+ export class QueueInsertItemsRequest {
+ /**
+ * @param itemsToInsert
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueInsertItemsRequest
+ */
+ constructor(itemsToInsert: Array);
+
+ customData: Object;
+ insertBefore: number;
+ items: Array;
+ }
+
+ export class QueueRemoveItemsRequest {
+ /**
+ * @param itemIdsToRemove
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueRemoveItemsRequest
+ */
+ constructor(itemIdsToRemove: Array);
+
+ customData: Object;
+ itemIds: Array;
+ }
+
+ export class QueueReorderItemsRequest {
+ /**
+ * @param itemIdsToReorder
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueReorderItemsRequest
+ */
+ constructor(itemIdsToReorder: Array);
+
+ customData: Object;
+ insertBefore: number;
+ itemIds: Array;
+ }
+
+ export class QueueUpdateItemsRequest {
+ /**
+ * @param itemsToUpdate
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueUpdateItemsRequest
+ */
+ constructor(itemsToUpdate: Array);
+
+ customData: Object;
+ item: Array;
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TrackType
+ */
+ export enum TrackType {
+ TEXT = 'TEXT',
+ AUDIO = 'AUDIO',
+ VIDEO = 'VIDEO',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackType
+ */
+ export enum TextTrackType {
+ SUBTITLES = 'SUBTITLES',
+ CAPTIONS = 'CAPTIONS',
+ DESCRIPTIONS = 'DESCRIPTIONS',
+ CHAPTERS = 'CHAPTERS',
+ METADATA = 'METADATA',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackEdgeType
+ */
+ export enum TextTrackEdgeType {
+ NONE = 'NONE',
+ OUTLINE = 'OUTLINE',
+ DROP_SHADOW = 'DROP_SHADOW',
+ RAISED = 'RAISED',
+ DEPRESSED = 'DEPRESSED',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackWindowType
+ */
+ export enum TextTrackWindowType {
+ NONE = 'NONE',
+ NORMAL = 'NORMAL',
+ ROUNDED_CORNERS = 'ROUNDED_CORNERS',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackFontGenericFamily
+ */
+ export enum TextTrackFontGenericFamily {
+ SANS_SERIF = 'SANS_SERIF',
+ MONOSPACED_SANS_SERIF = 'MONOSPACED_SANS_SERIF',
+ SERIF = 'SERIF',
+ MONOSPACED_SERIF = 'MONOSPACED_SERIF',
+ CASUAL = 'CASUAL',
+ CURSIVE = 'CURSIVE',
+ SMALL_CAPITALS = 'SMALL_CAPITALS',
+ }
+
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackFontStyle
+ */
+ export enum TextTrackFontStyle {
+ NORMAL = 'NORMAL',
+ BOLD = 'BOLD',
+ BOLD_ITALIC = 'BOLD_ITALIC',
+ ITALIC = 'ITALIC',
+ }
+
+ export class GetStatusRequest {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GetStatusRequest
+ */
+ constructor();
+
+ customData: Object;
+ }
+
+ export class PauseRequest {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PauseRequest
+ */
+ constructor();
+
+ customData: Object;
+ }
+
+ export class PlayRequest {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayRequest
+ */
+ constructor();
+
+ customData: Object;
+ }
+
+ export class SeekRequest {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.SeekRequest
+ */
+ constructor();
+
+ currentTime: number;
+ resumeState: chrome.cast.media.ResumeState;
+ customData: Object;
+ }
+
+ export class StopRequest {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StopRequest
+ */
+ constructor();
+
+ customData: Object;
+ }
+
+ export class VolumeRequest {
+ /**
+ * @param volume
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.VolumeRequest
+ */
+ constructor(volume: chrome.cast.Volume);
+
+ volume: chrome.cast.Volume;
+ customData: Object;
+ }
+
+ export class LoadRequest {
+ /**
+ * @param mediaInfo
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.LoadRequest
+ */
+ constructor(mediaInfo: chrome.cast.media.MediaInfo);
+
+ activeTrackIds: Array;
+ autoplay: boolean;
+ currentTime: number;
+ customData: Object;
+ media: chrome.cast.media.MediaInfo;
+ playbackRate?: number | undefined;
+ }
+
+ export class EditTracksInfoRequest {
+ /**
+ * @param opt_activeTrackIds
+ * @param opt_textTrackStyle
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.EditTracksInfoRequest
+ */
+ constructor(activeTrackIds?: Array, textTrackStyle?: chrome.cast.media.TextTrackStyle);
+
+ activeTrackIds: Array;
+ textTrackStyle: chrome.cast.media.TextTrackStyle;
+ }
+
+ export class GenericMediaMetadata {
+ images: Array;
+ metadataType: chrome.cast.media.MetadataType;
+ releaseDate: string;
+ /** @deprecated. Use releaseDate instead. */
+ releaseYear: number;
+ subtitle: string;
+ title: string;
+ /** @deprecated. Use metadataType instead. */
+ type: chrome.cast.media.MetadataType;
+ }
+
+ export class MovieMediaMetadata {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MovieMediaMetadata
+ */
+ constructor();
+
+ images: Array;
+ metadataType: chrome.cast.media.MetadataType;
+ releaseDate: string;
+ /** @deprecated. Use releaseDate instead. */
+ releaseYear: number;
+ subtitle: string;
+ title: string;
+ studio: string;
+ /** @deprecated. Use metadataType instead. */
+ type: chrome.cast.media.MetadataType;
+ }
+
+ export class TvShowMediaMetadata {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TvShowMediaMetadata
+ */
+ constructor();
+
+ metadataType: chrome.cast.media.MetadataType;
+ seriesTitle: string;
+ title: string;
+ season: number;
+ episode: number;
+ images: Array;
+ originalAirdate: string;
+
+ /** @deprecated. Use metadataType instead. */
+ type: chrome.cast.media.MetadataType;
+ /** @deprecated. Use title instead. */
+ episodeTitle: string;
+ /** @deprecated. Use season instead. */
+ seasonNumber: number;
+ /** @deprecated. Use episode instead. */
+ episodeNumber: number;
+ /** @deprecated. Use originalAirdate instead. */
+ releaseYear: number;
+ }
+
+ export class MusicTrackMediaMetadata {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MusicTrackMediaMetadata
+ */
+ constructor();
+
+ metadataType: chrome.cast.media.MetadataType;
+ albumName: string;
+ title: string;
+ albumArtist: string;
+ artist: string;
+ composer: string;
+ songName: string;
+ trackNumber: number;
+ discNumber: number;
+ images: Array;
+ releaseDate: string;
+
+ /** @deprecated. Use metadataType instead. */
+ type: chrome.cast.media.MetadataType;
+ /** @deprecated. Use artist instead. */
+ artistName: string;
+ /** @deprecated. Use releaseDate instead. */
+ releaseYear: number;
+ }
+
+ export class PhotoMediaMetadata {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PhotoMediaMetadata
+ */
+ constructor();
+
+ metadataType: chrome.cast.media.MetadataType;
+ title: string;
+ artist: string;
+ location: string;
+ images: Array;
+ latitude: number;
+ longitude: number;
+ width: number;
+ height: number;
+ creationDateTime: string;
+
+ /** @deprecated. Use metadataType instead. */
+ type: chrome.cast.media.MetadataType;
+ }
+
+ export class MediaInfo {
+ /**
+ * @param contentId
+ * @param contentType
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaInfo
+ */
+ constructor(contentId: string, contentType: string);
+
+ contentId: string;
+ streamType: chrome.cast.media.StreamType;
+ contentType: string;
+ metadata: any;
+ duration: number;
+ tracks: Array;
+ textTrackStyle: chrome.cast.media.TextTrackStyle;
+ customData: Object;
+ }
+
+ export class Media {
+ /**
+ * @param sessionId
+ * @param mediaSessionId
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.Media
+ */
+ constructor(sessionId: string, mediaSessionId: number);
+
+ activeTrackIds: Array;
+ currentItemId: number;
+ customData: Object;
+ idleReason: chrome.cast.media.IdleReason | null;
+ items: Array;
+ liveSeekableRange?: chrome.cast.media.LiveSeekableRange | undefined;
+ loadingItemId: number;
+ media: chrome.cast.media.MediaInfo;
+ mediaSessionId: number;
+ playbackRate: number;
+ playerState: chrome.cast.media.PlayerState;
+ preloadedItemId: number;
+ repeatMode: chrome.cast.media.RepeatMode;
+ sessionId: string;
+ supportedMediaCommands: Array;
+ volume: chrome.cast.Volume;
+
+ /** @deprecated. Use getEstimatedTime instead */
+ currentTime: number;
+
+ /**
+ * @param getStatusRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ getStatus(
+ getStatusRequest: chrome.cast.media.GetStatusRequest,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param playRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ play(
+ playRequest: chrome.cast.media.PlayRequest,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param pauseRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ pause(
+ pauseRequest: chrome.cast.media.PauseRequest,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param seekRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ seek(
+ seekRequest: chrome.cast.media.SeekRequest,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param stopRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ stop(
+ stopRequest: chrome.cast.media.StopRequest,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param volumeRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ setVolume(
+ volumeRequest: chrome.cast.media.VolumeRequest,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param editTracksInfoRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ editTracksInfo(
+ editTracksInfoRequest: chrome.cast.media.EditTracksInfoRequest,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param command
+ * @return whether or not the receiver supports the given chrome.cast.media.MediaCommand
+ */
+ supportsCommand(command: chrome.cast.media.MediaCommand): boolean;
+
+ /**
+ * @param listener
+ */
+ addUpdateListener(listener: (isAlive: boolean) => void): void;
+
+ /**
+ * @param listener
+ */
+ removeUpdateListener(listener: (isAlive: boolean) => void): void;
+
+ /**
+ * @return
+ * @suppress {deprecated} Uses currentTime member to compute estimated time.
+ */
+ getEstimatedTime(): number;
+
+ /**
+ * @param item
+ * @param successCallback
+ * @param errorCallback
+ */
+ queueAppendItem(
+ item: chrome.cast.media.QueueItem,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param queueInsertItemsRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ queueInsertItems(
+ queueInsertItemsRequest: chrome.cast.media.QueueInsertItemsRequest,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param itemId
+ * @param successCallback
+ * @param errorCallback
+ */
+ queueJumpToItem(
+ itemId: number,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param itemId
+ * @param newIndex
+ * @param successCallback
+ * @param errorCallback
+ */
+ queueMoveItemToNewIndex(
+ itemId: number,
+ newIndex: number,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param successCallback
+ * @param errorCallback
+ */
+ queueNext(successCallback: Function, errorCallback: (error: chrome.cast.Error) => void): void;
+
+ /**
+ * @param successCallback
+ * @param errorCallback
+ */
+ queuePrev(successCallback: Function, errorCallback: (error: chrome.cast.Error) => void): void;
+
+ /**
+ * @param itemId
+ * @param successCallback
+ * @param errorCallback
+ */
+ queueRemoveItem(
+ itemId: number,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param queueReorderItemsRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ queueReorderItems(
+ queueReorderItemsRequest: chrome.cast.media.QueueReorderItemsRequest,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param repeatMode
+ * @param successCallback
+ * @param errorCallback
+ */
+ queueSetRepeatMode(
+ repeatMode: chrome.cast.media.RepeatMode,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+
+ /**
+ * @param queueUpdateItemsRequest
+ * @param successCallback
+ * @param errorCallback
+ */
+ queueUpdateItems(
+ queueUpdateItemsRequest: chrome.cast.media.QueueUpdateItemsRequest,
+ successCallback: Function,
+ errorCallback: (error: chrome.cast.Error) => void,
+ ): void;
+ }
+
+ export class Track {
+ /**
+ * @param trackId
+ * @param trackType
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.Track
+ */
+ constructor(trackId: number, trackType: chrome.cast.media.TrackType);
+
+ trackId: number;
+ trackContentId: string;
+ trackContentType: string;
+ type: chrome.cast.media.TrackType;
+ name: string;
+ language: string;
+ subtype: chrome.cast.media.TextTrackType;
+ customData: Object;
+ }
+
+ export class TextTrackStyle {
+ /**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackStyle
+ */
+ constructor();
+
+ foregroundColor: string;
+ backgroundColor: string;
+ edgeType: chrome.cast.media.TextTrackEdgeType;
+ edgeColor: string;
+ windowType: chrome.cast.media.TextTrackWindowType;
+ windowColor: string;
+ windowRoundedCornerRadius: number;
+ fontScale: number;
+ fontFamily: string;
+ fontGenericFamily: chrome.cast.media.TextTrackFontGenericFamily;
+ fontStyle: chrome.cast.media.TextTrackFontStyle;
+ customData: Object;
+ }
+
+ export class LiveSeekableRange {
+ /**
+ * @param start
+ * @param end
+ * @param isMovingWindow
+ * @param isLiveDone
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.LiveSeekableRange
+ */
+ constructor(start?: number, end?: number, isMovingWindow?: boolean, isLiveDone?: boolean);
+
+ start?: number | undefined;
+ end?: number | undefined;
+ isMovingWindow?: boolean | undefined;
+ isLiveDone?: boolean | undefined;
+ }
+}
+
+/**
+ * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.timeout
+ */
+declare namespace chrome.cast.media.timeout {
+ export var load: number;
+ export var getStatus: number;
+ export var play: number;
+ export var pause: number;
+ export var seek: number;
+ export var stop: number;
+ export var setVolume: number;
+ export var editTracksInfo: number;
+ export var queueInsert: number;
+ export var queueLoad: number;
+ export var queueRemove: number;
+ export var queueReorder: number;
+ export var queueUpdate: number;
+}
diff --git a/chrome_intelli_search/node_modules/@types/chrome/har-format/index.d.ts b/chrome_intelli_search/node_modules/@types/chrome/har-format/index.d.ts
new file mode 100644
index 000000000..c1d5b8fd2
--- /dev/null
+++ b/chrome_intelli_search/node_modules/@types/chrome/har-format/index.d.ts
@@ -0,0 +1,6 @@
+import { Entry, Log } from 'har-format';
+
+declare global {
+ export type HARFormatEntry = Entry;
+ export type HARFormatLog = Log;
+}
diff --git a/chrome_intelli_search/node_modules/@types/chrome/index.d.ts b/chrome_intelli_search/node_modules/@types/chrome/index.d.ts
new file mode 100644
index 000000000..6e0e4ca09
--- /dev/null
+++ b/chrome_intelli_search/node_modules/@types/chrome/index.d.ts
@@ -0,0 +1,12276 @@
+// Type definitions for Chrome extension development
+// Project: http://developer.chrome.com/extensions/
+// Definitions by: Matthew Kimber
+// otiai10
+// sreimer15
+// MatCarlson
+// ekinsol
+// Brian Wilson
+// Sebastiaan Pasma
+// bdbai
+// pokutuna
+// Jason Xian
+// userTim
+// Idan Zeierman
+// Nicolas Rodriguez
+// Ido Salomon
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.4
+
+///
+///
+///
+
+////////////////////
+// Global object
+////////////////////
+interface Window {
+ chrome: typeof chrome;
+}
+
+////////////////////
+// Accessibility Features
+////////////////////
+/**
+ * Use the chrome.accessibilityFeatures API to manage Chrome's accessibility features. This API relies on the ChromeSetting prototype of the type API for getting and setting individual accessibility features. In order to get feature states the extension must request accessibilityFeatures.read permission. For modifying feature state, the extension needs accessibilityFeatures.modify permission. Note that accessibilityFeatures.modify does not imply accessibilityFeatures.read permission.
+ * Availability: Since Chrome 37.
+ * Permissions: "accessibilityFeatures.read"
+ * Important: This API works only on Chrome OS.
+ */
+declare namespace chrome.accessibilityFeatures {
+ /** **ChromeOS only.** Spoken feedback (text-to-speech). */
+ export var spokenFeedback: chrome.types.ChromeSetting;
+ /** **ChromeOS only.** Enlarged cursor. */
+ export var largeCursor: chrome.types.ChromeSetting;
+ /** **ChromeOS only.** Sticky modifier keys (like shift or alt). */
+ export var stickyKeys: chrome.types.ChromeSetting;
+ /** **ChromeOS only.** High contrast rendering mode. */
+ export var highContrast: chrome.types.ChromeSetting;
+ /** **ChromeOS only.** Full screen magnification. */
+ export var screenMagnifier: chrome.types.ChromeSetting;
+ /** **ChromeOS only.** Auto mouse click after mouse stops moving. */
+ export var autoclick: chrome.types.ChromeSetting;
+ /** **ChromeOS only.** Virtual on-screen keyboard. */
+ export var virtualKeyboard: chrome.types.ChromeSetting;
+ /**
+ * **ChromeOS only.**
+ * Caret highlighting.
+ * @since Chrome 51.
+ */
+ export var caretHighlight: chrome.types.ChromeSetting;
+ /**
+ * **ChromeOS only.**
+ * Cursor highlighting.
+ * @since Chrome 51.
+ */
+ export var cursorHighlight: chrome.types.ChromeSetting;
+ /**
+ * **ChromeOS only.**
+ * Focus highlighting.
+ * @since Chrome 51.
+ */
+ export var focusHighlight: chrome.types.ChromeSetting;
+ /**
+ * **ChromeOS only.**
+ * Select-to-speak.
+ * @since Chrome 51.
+ */
+ export var selectToSpeak: chrome.types.ChromeSetting;
+ /**
+ * **ChromeOS only.**
+ * Switch Access.
+ * @since Chrome 51.
+ */
+ export var switchAccess: chrome.types.ChromeSetting;
+ /**
+ * @since Chrome 42.
+ */
+ export var animationPolicy: chrome.types.ChromeSetting;
+}
+
+////////////////////
+// Action
+////////////////////
+/**
+ * Use the chrome.action API to control the extension's icon in the Google Chrome toolbar.
+ * Availability: Since Chrome 88. Manifest v3.
+ * Manifest: "action": {...}
+ */
+declare namespace chrome.action {
+ export interface BadgeBackgroundColorDetails {
+ /** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with a CSS value, with opaque red being #FF0000 or #F00. */
+ color: string | ColorArray;
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
+ tabId?: number | undefined;
+ }
+
+ export interface BadgeTextDetails {
+ /** Any number of characters can be passed, but only about four can fit in the space. */
+ text: string;
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
+ tabId?: number | undefined;
+ }
+
+ export type ColorArray = [number, number, number, number];
+
+ export interface TitleDetails {
+ /** The string the action should display when moused over. */
+ title: string;
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
+ tabId?: number | undefined;
+ }
+
+ export interface PopupDetails {
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
+ tabId?: number | undefined;
+ /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */
+ popup: string;
+ }
+
+ export interface BrowserClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> { }
+
+ export interface TabIconDetails {
+ /** Optional. Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' */
+ path?: string | { [index: number]: string } | undefined;
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
+ tabId?: number | undefined;
+ /** Optional. Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' */
+ imageData?: ImageData | { [index: number]: ImageData } | undefined;
+ }
+
+ export interface TabDetails {
+ /** Optional. The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
+ tabId?: number | undefined;
+ }
+
+ /**
+ * Since Chrome 88.
+ * Disables the action for a tab.
+ * @param tabId The id of the tab for which you want to modify the action.
+ * @return The `disable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function disable(tabId?: number): Promise;
+
+ /**
+ * Since Chrome 88.
+ * Disables the action for a tab.
+ * @param tabId The id of the tab for which you want to modify the action.
+ * @param callback
+ */
+ export function disable(tabId?: number, callback?: () => void): void;
+
+ /**
+ * Since Chrome 88.
+ * Enables the action for a tab. By default, actions are enabled.
+ * @param tabId The id of the tab for which you want to modify the action.
+ * @return The `enable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function enable(tabId?: number): Promise;
+
+ /**
+ * Since Chrome 88.
+ * Enables the action for a tab. By default, actions are enabled.
+ * @param tabId The id of the tab for which you want to modify the action.
+ * @param callback
+ */
+ export function enable(tabId?: number, callback?: () => void): void;
+
+ /**
+ * Since Chrome 88.
+ * Gets the background color of the action.
+ * @param callback The callback parameter should be a function that looks like this:
+ * (result: ColorArray) => {...}
+ */
+ export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
+ /**
+ * Since Chrome 88.
+ * Gets the background color of the action.
+ * @return The `getBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getBadgeBackgroundColor(details: TabDetails): Promise;
+
+ /**
+ * Since Chrome 88.
+ * Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.
+ * If displayActionCountAsBadgeText is enabled, a placeholder text will be returned unless the
+ * declarativeNetRequestFeedback permission is present or tab-specific badge text was provided.
+ * @param callback The callback parameter should be a function that looks like this:
+ * (result: string) => {...}
+ */
+ export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
+
+ /**
+ * Since Chrome 88.
+ * Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.
+ * If displayActionCountAsBadgeText is enabled, a placeholder text will be returned unless the
+ * declarativeNetRequestFeedback permission is present or tab-specific badge text was provided.
+ * @return The `getBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getBadgeText(details: TabDetails): Promise;
+
+ /**
+ * Since Chrome 88.
+ * Gets the html document set as the popup for this action.
+ * @param callback The callback parameter should be a function that looks like this:
+ * (result: string) => {...}
+ */
+ export function getPopup(details: TabDetails, callback: (result: string) => void): void;
+
+ /**
+ * Since Chrome 88.
+ * Gets the html document set as the popup for this action.
+ * @return The `getPopup` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getPopup(details: TabDetails): Promise;
+
+ /**
+ * Since Chrome 88.
+ * Gets the title of the action.
+ * @param callback The callback parameter should be a function that looks like this:
+ * (result: string) => {...}
+ */
+ export function getTitle(details: TabDetails, callback: (result: string) => void): void;
+
+ /**
+ * Since Chrome 88.
+ * Gets the title of the action.
+ * @return The `getTitle` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getTitle(details: TabDetails): Promise;
+
+ /**
+ * Since Chrome 88.
+ * Sets the background color for the badge.
+ * @return The `setBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function setBadgeBackgroundColor(details: BadgeBackgroundColorDetails): Promise;
+
+ /**
+ * Since Chrome 88.
+ * Sets the background color for the badge.
+ * @param callback The callback parameter should be a function that looks like this:
+ * () => {...}
+ */
+ export function setBadgeBackgroundColor(details: BadgeBackgroundColorDetails, callback?: () => void): void;
+
+ /**
+ * Since Chrome 88.
+ * Sets the badge text for the action. The badge is displayed on top of the icon.
+ * @return The `setBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function setBadgeText(details: BadgeTextDetails): Promise;
+
+ /**
+ * Since Chrome 88.
+ * Sets the badge text for the action. The badge is displayed on top of the icon.
+ * @param callback The callback parameter should be a function that looks like this:
+ * () => {...}
+ */
+ export function setBadgeText(details: BadgeTextDetails, callback?: () => void): void;
+
+ /**
+ * Since Chrome 88.
+ * Sets the icon for the action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element,
+ * or as dictionary of either one of those. Either the path or the imageData property must be specified.
+ * @param callback The callback parameter should be a function that looks like this:
+ * () => {...}
+ */
+ export function setIcon(details: TabIconDetails, callback?: () => void): void;
+
+ /**
+ * Since Chrome 88.
+ * Sets the html document to be opened as a popup when the user clicks on the action's icon.
+ * @return The `setPopup` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function setPopup(details: PopupDetails): Promise;
+
+ /**
+ * Since Chrome 88.
+ * Sets the html document to be opened as a popup when the user clicks on the action's icon.
+ * @param callback The callback parameter should be a function that looks like this:
+ * () => {...}
+ */
+ export function setPopup(details: PopupDetails, callback?: () => void): void;
+
+ /**
+ * Since Chrome 88.
+ * Sets the title of the action. This shows up in the tooltip.
+ * @return The `setTitle` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function setTitle(details: TitleDetails): Promise;
+
+ /**
+ * Since Chrome 88.
+ * Sets the title of the action. This shows up in the tooltip.
+ * @param callback The callback parameter should be a function that looks like this:
+ * () => {...}
+ */
+ export function setTitle(details: TitleDetails, callback?: () => void): void;
+
+ /** Fired when an action icon is clicked. This event will not fire if the action has a popup. */
+ export var onClicked: BrowserClickedEvent;
+}
+
+////////////////////
+// Alarms
+////////////////////
+/**
+ * Use the chrome.alarms API to schedule code to run periodically or at a specified time in the future.
+ * Availability: Since Chrome 22.
+ * Permissions: "alarms"
+ */
+declare namespace chrome.alarms {
+ export interface AlarmCreateInfo {
+ /** Optional. Length of time in minutes after which the onAlarm event should fire. */
+ delayInMinutes?: number | undefined;
+ /** Optional. If set, the onAlarm event should fire every periodInMinutes minutes after the initial event specified by when or delayInMinutes. If not set, the alarm will only fire once. */
+ periodInMinutes?: number | undefined;
+ /** Optional. Time at which the alarm should fire, in milliseconds past the epoch (e.g. Date.now() + n). */
+ when?: number | undefined;
+ }
+
+ export interface Alarm {
+ /** Optional. If not null, the alarm is a repeating alarm and will fire again in periodInMinutes minutes. */
+ periodInMinutes?: number | undefined;
+ /** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. Date.now() + n). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */
+ scheduledTime: number;
+ /** Name of this alarm. */
+ name: string;
+ }
+
+ export interface AlarmEvent extends chrome.events.Event<(alarm: Alarm) => void> { }
+
+ /**
+ * Creates an alarm. Near the time(s) specified by alarmInfo, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.
+ * In order to reduce the load on the user's machine, Chrome limits alarms to at most once every 1 minute but may delay them an arbitrary amount more. That is, setting delayInMinutes or periodInMinutes to less than 1 will not be honored and will cause a warning. when can be set to less than 1 minute after "now" without warning but won't actually cause the alarm to fire for at least 1 minute.
+ * To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire.
+ * @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either when or delayInMinutes (but not both). If periodInMinutes is set, the alarm will repeat every periodInMinutes minutes after the initial event. If neither when or delayInMinutes is set for a repeating alarm, periodInMinutes is used as the default for delayInMinutes.
+ */
+ export function create(alarmInfo: AlarmCreateInfo): void;
+ /**
+ * Creates an alarm. Near the time(s) specified by alarmInfo, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.
+ * In order to reduce the load on the user's machine, Chrome limits alarms to at most once every 1 minute but may delay them an arbitrary amount more. That is, setting delayInMinutes or periodInMinutes to less than 1 will not be honored and will cause a warning. when can be set to less than 1 minute after "now" without warning but won't actually cause the alarm to fire for at least 1 minute.
+ * To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire.
+ * @param name Optional name to identify this alarm. Defaults to the empty string.
+ * @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either when or delayInMinutes (but not both). If periodInMinutes is set, the alarm will repeat every periodInMinutes minutes after the initial event. If neither when or delayInMinutes is set for a repeating alarm, periodInMinutes is used as the default for delayInMinutes.
+ */
+ export function create(name: string, alarmInfo: AlarmCreateInfo): void;
+ /**
+ * Gets an array of all the alarms.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of Alarm alarms) {...};
+ */
+ export function getAll(callback: (alarms: Alarm[]) => void): void;
+ /**
+ * Gets an array of all the alarms.
+ * @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getAll(): Promise;
+ /**
+ * Clears all alarms.
+ * function(boolean wasCleared) {...};
+ * @return The `clearAll` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function clearAll(): Promise;
+ /**
+ * Clears all alarms.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function(boolean wasCleared) {...};
+ */
+ export function clearAll(callback?: (wasCleared: boolean) => void): void;
+ /**
+ * Clears the alarm with the given name.
+ * @param name The name of the alarm to clear. Defaults to the empty string.
+ * @return The `clear` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function clear(name?: string): Promise;
+ /**
+ * Clears the alarm with the given name.
+ * @param name The name of the alarm to clear. Defaults to the empty string.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function(boolean wasCleared) {...};
+ */
+ export function clear(name?: string, callback?: (wasCleared: boolean) => void): void;
+ /**
+ * Clears the alarm without a name.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function(boolean wasCleared) {...};
+ */
+ export function clear(callback: (wasCleared: boolean) => void): void;
+ /**
+ * Clears the alarm without a name.
+ * @return The `clear` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function clear(): Promise;
+ /**
+ * Retrieves details about the specified alarm.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function( Alarm alarm) {...};
+ */
+ export function get(callback: (alarm: Alarm) => void): void;
+ /**
+ * Retrieves details about the specified alarm.
+ * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function get(): Promise;
+ /**
+ * Retrieves details about the specified alarm.
+ * @param name The name of the alarm to get. Defaults to the empty string.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function( Alarm alarm) {...};
+ */
+ export function get(name: string, callback: (alarm: Alarm) => void): void;
+ /**
+ * Retrieves details about the specified alarm.
+ * @param name The name of the alarm to get. Defaults to the empty string.
+ * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function get(name: string): Promise;
+
+ /** Fired when an alarm has elapsed. Useful for event pages. */
+ export var onAlarm: AlarmEvent;
+}
+
+////////////////////
+// Browser
+////////////////////
+/**
+ * Use the chrome.browser API to interact with the Chrome browser associated with
+ * the current application and Chrome profile.
+ */
+declare namespace chrome.browser {
+ export interface Options {
+ /** The URL to navigate to when the new tab is initially opened. */
+ url: string;
+ }
+
+ /**
+ * Opens a new tab in a browser window associated with the current application
+ * and Chrome profile. If no browser window for the Chrome profile is opened,
+ * a new one is opened prior to creating the new tab.
+ * @param options Configures how the tab should be opened.
+ * @param callback Called when the tab was successfully
+ * created, or failed to be created. If failed, runtime.lastError will be set.
+ */
+ export function openTab(options: Options, callback: () => void): void;
+
+ /**
+ * Opens a new tab in a browser window associated with the current application
+ * and Chrome profile. If no browser window for the Chrome profile is opened,
+ * a new one is opened prior to creating the new tab. Since Chrome 42 only.
+ * @param options Configures how the tab should be opened.
+ */
+ export function openTab(options: Options): void;
+}
+
+////////////////////
+// Bookmarks
+////////////////////
+/**
+ * Use the chrome.bookmarks API to create, organize, and otherwise manipulate bookmarks. Also see Override Pages, which you can use to create a custom Bookmark Manager page.
+ * Availability: Since Chrome 5.
+ * Permissions: "bookmarks"
+ */
+declare namespace chrome.bookmarks {
+ /** A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder. */
+ export interface BookmarkTreeNode {
+ /** Optional. The 0-based position of this node within its parent folder. */
+ index?: number | undefined;
+ /** Optional. When this node was created, in milliseconds since the epoch (new Date(dateAdded)). */
+ dateAdded?: number | undefined;
+ /** The text displayed for the node. */
+ title: string;
+ /** Optional. The URL navigated to when a user clicks the bookmark. Omitted for folders. */
+ url?: string | undefined;
+ /** Optional. When the contents of this folder last changed, in milliseconds since the epoch. */
+ dateGroupModified?: number | undefined;
+ /** The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted. */
+ id: string;
+ /** Optional. The id of the parent folder. Omitted for the root node. */
+ parentId?: string | undefined;
+ /** Optional. An ordered list of children of this node. */
+ children?: BookmarkTreeNode[] | undefined;
+ /**
+ * Optional.
+ * Since Chrome 37.
+ * Indicates the reason why this node is unmodifiable. The managed value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default).
+ */
+ unmodifiable?: 'managed' | undefined;
+ }
+
+ export interface BookmarkRemoveInfo {
+ index: number;
+ parentId: string;
+ node: BookmarkTreeNode;
+ }
+
+ export interface BookmarkMoveInfo {
+ index: number;
+ oldIndex: number;
+ parentId: string;
+ oldParentId: string;
+ }
+
+ export interface BookmarkChangeInfo {
+ url?: string | undefined;
+ title: string;
+ }
+
+ export interface BookmarkReorderInfo {
+ childIds: string[];
+ }
+
+ export interface BookmarkRemovedEvent
+ extends chrome.events.Event<(id: string, removeInfo: BookmarkRemoveInfo) => void> { }
+
+ export interface BookmarkImportEndedEvent extends chrome.events.Event<() => void> { }
+
+ export interface BookmarkMovedEvent extends chrome.events.Event<(id: string, moveInfo: BookmarkMoveInfo) => void> { }
+
+ export interface BookmarkImportBeganEvent extends chrome.events.Event<() => void> { }
+
+ export interface BookmarkChangedEvent
+ extends chrome.events.Event<(id: string, changeInfo: BookmarkChangeInfo) => void> { }
+
+ export interface BookmarkCreatedEvent
+ extends chrome.events.Event<(id: string, bookmark: BookmarkTreeNode) => void> { }
+
+ export interface BookmarkChildrenReordered
+ extends chrome.events.Event<(id: string, reorderInfo: BookmarkReorderInfo) => void> { }
+
+ export interface BookmarkSearchQuery {
+ query?: string | undefined;
+ url?: string | undefined;
+ title?: string | undefined;
+ }
+
+ export interface BookmarkCreateArg {
+ /** Optional. Defaults to the Other Bookmarks folder. */
+ parentId?: string | undefined;
+ index?: number | undefined;
+ title?: string | undefined;
+ url?: string | undefined;
+ }
+
+ export interface BookmarkDestinationArg {
+ parentId?: string | undefined;
+ index?: number | undefined;
+ }
+
+ export interface BookmarkChangesArg {
+ title?: string | undefined;
+ url?: string | undefined;
+ }
+
+ /** @deprecated since Chrome 38. Bookmark write operations are no longer limited by Chrome. */
+ export var MAX_WRITE_OPERATIONS_PER_HOUR: number;
+ /** @deprecated since Chrome 38. Bookmark write operations are no longer limited by Chrome. */
+ export var MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number;
+
+ /**
+ * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.
+ * @param query A string of words and quoted phrases that are matched against bookmark URLs and titles.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of BookmarkTreeNode results) {...};
+ */
+ export function search(query: string, callback: (results: BookmarkTreeNode[]) => void): void;
+ /**
+ * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.
+ * @param query A string of words and quoted phrases that are matched against bookmark URLs and titles.
+ * @return The `search` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function search(query: string): Promise;
+ /**
+ * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.
+ * @param query An object with one or more of the properties query, url, and title specified. Bookmarks matching all specified properties will be produced.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of BookmarkTreeNode results) {...};
+ */
+ export function search(query: BookmarkSearchQuery, callback: (results: BookmarkTreeNode[]) => void): void;
+ /**
+ * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.
+ * @param query An object with one or more of the properties query, url, and title specified. Bookmarks matching all specified properties will be produced.
+ * @return The `search` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function search(query: BookmarkSearchQuery): Promise;
+ /**
+ * Retrieves the entire Bookmarks hierarchy.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of BookmarkTreeNode results) {...};
+ */
+ export function getTree(callback: (results: BookmarkTreeNode[]) => void): void;
+ /**
+ * Retrieves the entire Bookmarks hierarchy.
+ * @return The `getTree` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getTree(): Promise;
+ /**
+ * Retrieves the recently added bookmarks.
+ * @param numberOfItems The maximum number of items to return.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of BookmarkTreeNode results) {...};
+ */
+ export function getRecent(numberOfItems: number, callback: (results: BookmarkTreeNode[]) => void): void;
+ /**
+ * Retrieves the recently added bookmarks.
+ * @param numberOfItems The maximum number of items to return.
+ * @return The `getRecent` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getRecent(numberOfItems: number): Promise;
+ /**
+ * Retrieves the specified BookmarkTreeNode.
+ * @param id A single string-valued id
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of BookmarkTreeNode results) {...};
+ */
+ export function get(id: string, callback: (results: BookmarkTreeNode[]) => void): void;
+ /**
+ * Retrieves the specified BookmarkTreeNode.
+ * @param id A single string-valued id
+ * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function get(id: string): Promise;
+ /**
+ * Retrieves the specified BookmarkTreeNode.
+ * @param idList An array of string-valued ids
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of BookmarkTreeNode results) {...};
+ */
+ export function get(idList: string[], callback: (results: BookmarkTreeNode[]) => void): void;
+ /**
+ * Retrieves the specified BookmarkTreeNode.
+ * @param idList An array of string-valued ids
+ * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function get(idList: string[]): Promise;
+ /**
+ * Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.
+ * @return The `create` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function create(bookmark: BookmarkCreateArg): Promise;
+ /**
+ * Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function( BookmarkTreeNode result) {...};
+ */
+ export function create(bookmark: BookmarkCreateArg, callback?: (result: BookmarkTreeNode) => void): void;
+ /**
+ * Moves the specified BookmarkTreeNode to the provided location.
+ * @return The `move` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function move(
+ id: string,
+ destination: BookmarkDestinationArg,
+ ): Promise;
+ /**
+ * Moves the specified BookmarkTreeNode to the provided location.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function( BookmarkTreeNode result) {...};
+ */
+ export function move(
+ id: string,
+ destination: BookmarkDestinationArg,
+ callback?: (result: BookmarkTreeNode) => void,
+ ): void;
+ /**
+ * Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. Note: Currently, only 'title' and 'url' are supported.
+ * @return The `update` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function update(
+ id: string,
+ changes: BookmarkChangesArg,
+ ): Promise;
+ /**
+ * Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. Note: Currently, only 'title' and 'url' are supported.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function( BookmarkTreeNode result) {...};
+ */
+ export function update(
+ id: string,
+ changes: BookmarkChangesArg,
+ callback?: (result: BookmarkTreeNode) => void,
+ ): void;
+ /**
+ * Removes a bookmark or an empty bookmark folder.
+ * @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function remove(id: string): Promise;
+ /**
+ * Removes a bookmark or an empty bookmark folder.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function remove(id: string, callback?: Function): void;
+ /**
+ * Retrieves the children of the specified BookmarkTreeNode id.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of BookmarkTreeNode results) {...};
+ */
+ export function getChildren(id: string, callback: (results: BookmarkTreeNode[]) => void): void;
+ /**
+ * Retrieves the children of the specified BookmarkTreeNode id.
+ * @return The `getChildren` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getChildren(id: string): Promise;
+ /**
+ * Since Chrome 14.
+ * Retrieves part of the Bookmarks hierarchy, starting at the specified node.
+ * @param id The ID of the root of the subtree to retrieve.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of BookmarkTreeNode results) {...};
+ */
+ export function getSubTree(id: string, callback: (results: BookmarkTreeNode[]) => void): void;
+ /**
+ * Since Chrome 14.
+ * Retrieves part of the Bookmarks hierarchy, starting at the specified node.
+ * @param id The ID of the root of the subtree to retrieve.
+ * @return The `getSubTree` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getSubTree(id: string): Promise;
+ /**
+ * Recursively removes a bookmark folder.
+ * @return The `removeTree` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeTree(id: string): Promise;
+ /**
+ * Recursively removes a bookmark folder.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeTree(id: string, callback?: Function): void;
+
+ /** Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents. */
+ export var onRemoved: BookmarkRemovedEvent;
+ /** Fired when a bookmark import session is ended. */
+ export var onImportEnded: BookmarkImportEndedEvent;
+ /** Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately. */
+ export var onImportBegan: BookmarkImportBeganEvent;
+ /** Fired when a bookmark or folder changes. Note: Currently, only title and url changes trigger this. */
+ export var onChanged: BookmarkChangedEvent;
+ /** Fired when a bookmark or folder is moved to a different parent folder. */
+ export var onMoved: BookmarkMovedEvent;
+ /** Fired when a bookmark or folder is created. */
+ export var onCreated: BookmarkCreatedEvent;
+ /** Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move(). */
+ export var onChildrenReordered: BookmarkChildrenReordered;
+}
+
+////////////////////
+// Browser Action
+////////////////////
+/**
+ * Use browser actions to put icons in the main Google Chrome toolbar, to the right of the address bar. In addition to its icon, a browser action can also have a tooltip, a badge, and a popup.
+ * Availability: Since Chrome 5.
+ * Manifest: "browser_action": {...}
+ */
+declare namespace chrome.browserAction {
+ export interface BadgeBackgroundColorDetails {
+ /** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with a CSS value, with opaque red being #FF0000 or #F00. */
+ color: string | ColorArray;
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
+ tabId?: number | undefined;
+ }
+
+ export interface BadgeTextDetails {
+ /** Any number of characters can be passed, but only about four can fit in the space. */
+ text?: string | null | undefined;
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
+ tabId?: number | undefined;
+ }
+
+ export type ColorArray = [number, number, number, number];
+
+ export interface TitleDetails {
+ /** The string the browser action should display when moused over. */
+ title: string;
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
+ tabId?: number | undefined;
+ }
+
+ export interface TabDetails {
+ /** Optional. Specify the tab to get the information. If no tab is specified, the non-tab-specific information is returned. */
+ tabId?: number | undefined;
+ }
+
+ export interface TabIconDetails {
+ /** Optional. Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' */
+ path?: string | { [index: string]: string } | undefined;
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
+ tabId?: number | undefined;
+ /** Optional. Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' */
+ imageData?: ImageData | { [index: number]: ImageData } | undefined;
+ }
+
+ export interface PopupDetails {
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
+ tabId?: number | undefined;
+ /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */
+ popup: string;
+ }
+
+ export interface BrowserClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> { }
+
+ /**
+ * Since Chrome 22.
+ * Enables the browser action for a tab. By default, browser actions are enabled.
+ * @param tabId The id of the tab for which you want to modify the browser action.
+ * @return The `enable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function enable(tabId?: number): Promise;
+ /**
+ * Since Chrome 22.
+ * Enables the browser action for a tab. By default, browser actions are enabled.
+ * @param tabId The id of the tab for which you want to modify the browser action.
+ * @param callback Supported since Chrome 67
+ */
+ export function enable(tabId?: number, callback?: () => void): void;
+ /**
+ * Sets the background color for the badge.
+ * @return The `setBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function setBadgeBackgroundColor(details: BadgeBackgroundColorDetails): Promise;
+ /**
+ * Sets the background color for the badge.
+ * @param callback Supported since Chrome 67
+ */
+ export function setBadgeBackgroundColor(details: BadgeBackgroundColorDetails, callback?: () => void): void;
+ /**
+ * Sets the badge text for the browser action. The badge is displayed on top of the icon.
+ * @return The `setBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function setBadgeText(details: BadgeTextDetails): Promise;
+ /**
+ * Sets the badge text for the browser action. The badge is displayed on top of the icon.
+ * @param callback Supported since Chrome 67
+ */
+ export function setBadgeText(details: BadgeTextDetails, callback?: () => void): void;
+ /**
+ * Sets the title of the browser action. This shows up in the tooltip.
+ * @return The `setTitle` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function setTitle(details: TitleDetails): Promise;
+ /**
+ * Sets the title of the browser action. This shows up in the tooltip.
+ * @param callback Supported since Chrome 67
+ */
+ export function setTitle(details: TitleDetails, callback?: () => void): void;
+ /**
+ * Since Chrome 19.
+ * Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned.
+ * @param callback Supported since Chrome 67
+ */
+ export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
+ /**
+ * Since Chrome 19.
+ * Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned.
+ * @return The `getBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getBadgeText(details: TabDetails): Promise;
+ /**
+ * Sets the html document to be opened as a popup when the user clicks on the browser action's icon.
+ * @return The `setPopup` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function setPopup(details: PopupDetails): Promise;
+ /**
+ * Sets the html document to be opened as a popup when the user clicks on the browser action's icon.
+ * @param callback Supported since Chrome 67
+ */
+ export function setPopup(details: PopupDetails, callback?: () => void): void;
+ /**
+ * Since Chrome 22.
+ * Disables the browser action for a tab.
+ * @param tabId The id of the tab for which you want to modify the browser action.
+ * @return The `disable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function disable(tabId?: number): Promise;
+ /**
+ * Since Chrome 22.
+ * Disables the browser action for a tab.
+ * @param tabId The id of the tab for which you want to modify the browser action.
+ * @param callback Supported since Chrome 67
+ */
+ export function disable(tabId?: number, callback?: () => void): void;
+ /**
+ * Since Chrome 19.
+ * Gets the title of the browser action.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(string result) {...};
+ */
+ export function getTitle(details: TabDetails, callback: (result: string) => void): void;
+ /**
+ * Since Chrome 19.
+ * Gets the title of the browser action.
+ * @return The `getTitle` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getTitle(details: TabDetails): Promise;
+ /**
+ * Since Chrome 19.
+ * Gets the background color of the browser action.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function( ColorArray result) {...};
+ */
+ export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
+ /**
+ * Since Chrome 19.
+ * Gets the background color of the browser action.
+ * @return The `getBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getBadgeBackgroundColor(details: TabDetails): Promise;
+ /**
+ * Since Chrome 19.
+ * Gets the html document set as the popup for this browser action.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(string result) {...};
+ */
+ export function getPopup(details: TabDetails, callback: (result: string) => void): void;
+ /**
+ * Since Chrome 19.
+ * Gets the html document set as the popup for this browser action.
+ * @return The `getPopup` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getPopup(details: TabDetails): Promise;
+ /**
+ * Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function setIcon(details: TabIconDetails, callback?: Function): void;
+
+ /** Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup. */
+ export var onClicked: BrowserClickedEvent;
+}
+
+////////////////////
+// Browsing Data
+////////////////////
+/**
+ * Use the chrome.browsingData API to remove browsing data from a user's local profile.
+ * Availability: Since Chrome 19.
+ * Permissions: "browsingData"
+ */
+declare namespace chrome.browsingData {
+ export interface OriginTypes {
+ /** Optional. Extensions and packaged applications a user has installed (be _really_ careful!). */
+ extension?: boolean | undefined;
+ /** Optional. Websites that have been installed as hosted applications (be careful!). */
+ protectedWeb?: boolean | undefined;
+ /** Optional. Normal websites. */
+ unprotectedWeb?: boolean | undefined;
+ }
+
+ /** Options that determine exactly what data will be removed. */
+ export interface RemovalOptions {
+ /**
+ * Optional.
+ * Since Chrome 74.
+ * When present, data for origins in this list is excluded from deletion. Can't be used together with origins. Only supported for cookies, storage and cache. Cookies are excluded for the whole registrable domain.
+ */
+ excludeOrigins?: string[] | undefined;
+ /**
+ * Optional.
+ * An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only "unprotected" origins. Please ensure that you _really_ want to remove application data before adding 'protectedWeb' or 'extensions'.
+ */
+ originTypes?: OriginTypes | undefined;
+ /**
+ * Optional.
+ * Since Chrome 74.
+ * When present, only data for origins in this list is deleted. Only supported for cookies, storage and cache. Cookies are cleared for the whole registrable domain.
+ */
+ origins?: string[] | undefined;
+ /**
+ * Optional.
+ * Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the {@link Date.getTime} method). If absent, defaults to 0 (which would remove all browsing data).
+ */
+ since?: number | undefined;
+ }
+
+ /**
+ * Since Chrome 27.
+ * A set of data types. Missing data types are interpreted as false.
+ */
+ export interface DataTypeSet {
+ /** Optional. Websites' WebSQL data. */
+ webSQL?: boolean | undefined;
+ /** Optional. Websites' IndexedDB data. */
+ indexedDB?: boolean | undefined;
+ /** Optional. The browser's cookies. */
+ cookies?: boolean | undefined;
+ /** Optional. Stored passwords. */
+ passwords?: boolean | undefined;
+ /**
+ * @deprecated Deprecated since Chrome 76.
+ * Support for server-bound certificates has been removed. This data type will be ignored.
+ *
+ * Optional. Server-bound certificates.
+ */
+ serverBoundCertificates?: boolean | undefined;
+ /** Optional. The browser's download list. */
+ downloads?: boolean | undefined;
+ /** Optional. The browser's cache. Note: when removing data, this clears the entire cache: it is not limited to the range you specify. */
+ cache?: boolean | undefined;
+ /** Optional. Websites' appcaches. */
+ appcache?: boolean | undefined;
+ /** Optional. Websites' file systems. */
+ fileSystems?: boolean | undefined;
+ /**
+ * @deprecated Deprecated since Chrome 88.
+ * Support for Flash has been removed. This data type will be ignored.
+ *
+ * Optional. Plugins' data.
+ */
+ pluginData?: boolean | undefined;
+ /** Optional. Websites' local storage data. */
+ localStorage?: boolean | undefined;
+ /** Optional. The browser's stored form data. */
+ formData?: boolean | undefined;
+ /** Optional. The browser's history. */
+ history?: boolean | undefined;
+ /**
+ * Optional.
+ * Since Chrome 39.
+ * Service Workers.
+ */
+ serviceWorkers?: boolean | undefined;
+ }
+
+ export interface SettingsResult {
+ options: RemovalOptions;
+ /** All of the types will be present in the result, with values of true if they are both selected to be removed and permitted to be removed, otherwise false. */
+ dataToRemove: DataTypeSet;
+ /** All of the types will be present in the result, with values of true if they are permitted to be removed (e.g., by enterprise policy) and false if not. */
+ dataRemovalPermitted: DataTypeSet;
+ }
+
+ /**
+ * Since Chrome 26.
+ * Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.
+ * @return The `settings` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function settings(): Promise;
+ /**
+ * Since Chrome 26.
+ * Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(object result) {...};
+ */
+ export function settings(callback: (result: SettingsResult) => void): void;
+ /**
+ * @deprecated Deprecated since Chrome 88.
+ * Support for Flash has been removed. This function has no effect.
+ *
+ * Clears plugins' data.
+ * @return The `removePluginData` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removePluginData(options: RemovalOptions): Promise;
+ /**
+ * @deprecated Deprecated since Chrome 88.
+ * Support for Flash has been removed. This function has no effect.
+ *
+ * Clears plugins' data.
+ * @param callback Called when plugins' data has been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removePluginData(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Since Chrome 72.
+ * Clears websites' service workers.
+ * @return The `removeServiceWorkers` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeServiceWorkers(options: RemovalOptions): Promise;
+ /**
+ * Since Chrome 72.
+ * Clears websites' service workers.
+ * @param callback Called when the browser's service workers have been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeServiceWorkers(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Clears the browser's stored form data (autofill).
+ * @return The `removeFormData` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeFormData(options: RemovalOptions): Promise;
+ /**
+ * Clears the browser's stored form data (autofill).
+ * @param callback Called when the browser's form data has been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeFormData(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Clears websites' file system data.
+ * @return The `removeFileSystems` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeFileSystems(options: RemovalOptions): Promise;
+ /**
+ * Clears websites' file system data.
+ * @param callback Called when websites' file systems have been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeFileSystems(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Clears various types of browsing data stored in a user's profile.
+ * @param dataToRemove The set of data types to remove.
+ * @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function remove(options: RemovalOptions, dataToRemove: DataTypeSet): Promise;
+ /**
+ * Clears various types of browsing data stored in a user's profile.
+ * @param dataToRemove The set of data types to remove.
+ * @param callback Called when deletion has completed.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function remove(options: RemovalOptions, dataToRemove: DataTypeSet, callback?: () => void): void;
+ /**
+ * Clears the browser's stored passwords.
+ * @return The `removePasswords` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removePasswords(options: RemovalOptions): Promise;
+ /**
+ * Clears the browser's stored passwords.
+ * @param callback Called when the browser's passwords have been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removePasswords(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Clears the browser's cookies and server-bound certificates modified within a particular timeframe.
+ * @return The `removeCookies` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeCookies(options: RemovalOptions, callback?: () => void): Promise;
+ /**
+ * Clears the browser's cookies and server-bound certificates modified within a particular timeframe.
+ * @param callback Called when the browser's cookies and server-bound certificates have been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeCookies(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Clears websites' WebSQL data.
+ * @return The `removeWebSQL` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeWebSQL(options: RemovalOptions): Promise;
+ /**
+ * Clears websites' WebSQL data.
+ * @param callback Called when websites' WebSQL databases have been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeWebSQL(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Clears websites' appcache data.
+ * @return The `removeAppcache` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeAppcache(options: RemovalOptions): Promise;
+ /**
+ * Clears websites' appcache data.
+ * @param callback Called when websites' appcache data has been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeAppcache(options: RemovalOptions, callback?: () => void): void;
+ /** Clears websites' cache storage data.
+ * @return The `removeCacheStorage` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeCacheStorage(options: RemovalOptions): Promise
+ /** Clears websites' cache storage data.
+ * @param callback Called when websites' appcache data has been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeCacheStorage(options: RemovalOptions, callback?: () => void): void
+ /**
+ * Clears the browser's list of downloaded files (not the downloaded files themselves).
+ * @return The `removeDownloads` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeDownloads(options: RemovalOptions): Promise
+ /**
+ * Clears the browser's list of downloaded files (not the downloaded files themselves).
+ * @param callback Called when the browser's list of downloaded files has been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeDownloads(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Clears websites' local storage data.
+ * @return The `removeLocalStorage` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeLocalStorage(options: RemovalOptions): Promise;
+ /**
+ * Clears websites' local storage data.
+ * @param callback Called when websites' local storage has been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeLocalStorage(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Clears the browser's cache.
+ * @return The `removeCache` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeCache(options: RemovalOptions): Promise;
+ /**
+ * Clears the browser's cache.
+ * @param callback Called when the browser's cache has been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeCache(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Clears the browser's history.
+ * @return The `removeHistory` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeHistory(options: RemovalOptions): Promise;
+ /**
+ * Clears the browser's history.
+ * @param callback Called when the browser's history has cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeHistory(options: RemovalOptions, callback?: () => void): void;
+ /**
+ * Clears websites' IndexedDB data.
+ * @return The `removeIndexedDB` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function removeIndexedDB(options: RemovalOptions): Promise;
+ /**
+ * Clears websites' IndexedDB data.
+ * @param callback Called when websites' IndexedDB data has been cleared.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeIndexedDB(options: RemovalOptions, callback?: () => void): void;
+}
+
+////////////////////
+// Commands
+////////////////////
+/**
+ * Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the extension.
+ * Availability: Since Chrome 25.
+ * Manifest: "commands": {...}
+ */
+declare namespace chrome.commands {
+ export interface Command {
+ /** Optional. The name of the Extension Command */
+ name?: string | undefined;
+ /** Optional. The Extension Command description */
+ description?: string | undefined;
+ /** Optional. The shortcut active for this command, or blank if not active. */
+ shortcut?: string | undefined;
+ }
+
+ export interface CommandEvent extends chrome.events.Event<(command: string, tab: chrome.tabs.Tab) => void> { }
+
+ /**
+ * Returns all the registered extension commands for this extension and their shortcut (if active).
+ * @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getAll(): Promise;
+ /**
+ * Returns all the registered extension commands for this extension and their shortcut (if active).
+ * @param callback Called to return the registered commands.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function(array of Command commands) {...};
+ */
+ export function getAll(callback: (commands: Command[]) => void): void;
+
+ /** Fired when a registered command is activated using a keyboard shortcut. */
+ export var onCommand: CommandEvent;
+}
+
+////////////////////
+// Content Settings
+////////////////////
+/**
+ * Use the chrome.contentSettings API to change settings that control whether websites can use features such as cookies, JavaScript, and plugins. More generally speaking, content settings allow you to customize Chrome's behavior on a per-site basis instead of globally.
+ * Availability: Since Chrome 16.
+ * Permissions: "contentSettings"
+ */
+declare namespace chrome.contentSettings {
+ type ScopeEnum = 'regular' | 'incognito_session_only';
+
+ export interface ClearDetails {
+ /**
+ * Optional.
+ * Where to clear the setting (default: regular).
+ * The scope of the ContentSetting. One of
+ * * 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?: ScopeEnum | undefined;
+ }
+
+ type DefaultContentSettingDetails = 'allow' | 'ask' | 'block' | 'detect_important_content' | 'session_only';
+
+ export interface SetDetails {
+ /** Optional. The resource identifier for the content type. */
+ resourceIdentifier?: ResourceIdentifier | undefined;
+ /** The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values. */
+ setting: DefaultContentSettingDetails;
+ /** 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 | undefined;
+ /** Optional. Where to set the setting (default: regular). */
+ scope?: ScopeEnum | undefined;
+ /** 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 | undefined;
+ /** Optional. A more specific identifier of the type of content for which the settings should be retrieved. */
+ resourceIdentifier?: ResourceIdentifier | undefined;
+ /** Optional. Whether to check the content settings for an incognito session. (default false) */
+ incognito?: boolean | undefined;
+ /** The primary URL for which the content setting should be retrieved. Note that the meaning of a primary URL depends on the content type. */
+ primaryUrl: string;
+ }
+
+ export interface ReturnedDetails {
+ /** The content setting. See the description of the individual ContentSetting objects for the possible values. */
+ setting: DefaultContentSettingDetails;
+ }
+
+ export interface ContentSetting {
+ /**
+ * Clear all content setting rules set by this extension.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ clear(details: ClearDetails, callback?: () => void): void;
+ /**
+ * Applies a new content setting rule.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ set(details: SetDetails, callback?: () => void): void;
+ /**
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of ResourceIdentifier resourceIdentifiers) {...};
+ * Parameter resourceIdentifiers: A list of resource identifiers for this content type, or undefined if this content type does not use resource identifiers.
+ */
+ getResourceIdentifiers(callback: (resourceIdentifiers?: ResourceIdentifier[]) => void): void;
+ /**
+ * Gets the current content setting for a given pair of URLs.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(object details) {...};
+ */
+ get(details: GetDetails, callback: (details: ReturnedDetails) => void): void;
+ }
+
+ export interface CookieContentSetting extends ContentSetting {
+ set(details: CookieSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: CookieSetDetails) => void): void;
+ }
+
+ export interface PopupsContentSetting extends ContentSetting {
+ set(details: PopupsSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: PopupsSetDetails) => void): void;
+ }
+
+ export interface JavascriptContentSetting extends ContentSetting {
+ set(details: JavascriptSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: JavascriptSetDetails) => void): void;
+ }
+
+ export interface NotificationsContentSetting extends ContentSetting {
+ set(details: NotificationsSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: NotificationsSetDetails) => void): void;
+ }
+
+ export interface PluginsContentSetting extends ContentSetting {
+ set(details: PluginsSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: PluginsSetDetails) => void): void;
+ }
+
+ export interface ImagesContentSetting extends ContentSetting {
+ set(details: ImagesSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: ImagesSetDetails) => void): void;
+ }
+
+ export interface LocationContentSetting extends ContentSetting {
+ set(details: LocationSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: LocationSetDetails) => void): void;
+ }
+
+ export interface FullscreenContentSetting extends ContentSetting {
+ set(details: FullscreenSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: FullscreenSetDetails) => void): void;
+ }
+
+ export interface MouselockContentSetting extends ContentSetting {
+ set(details: MouselockSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: MouselockSetDetails) => void): void;
+ }
+
+ export interface MicrophoneContentSetting extends ContentSetting {
+ set(details: MicrophoneSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: MicrophoneSetDetails) => void): void;
+ }
+
+ export interface CameraContentSetting extends ContentSetting {
+ set(details: CameraSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: CameraSetDetails) => void): void;
+ }
+
+ export interface PpapiBrokerContentSetting extends ContentSetting {
+ set(details: PpapiBrokerSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: PpapiBrokerSetDetails) => void): void;
+ }
+
+ export interface MultipleAutomaticDownloadsContentSetting extends ContentSetting {
+ set(details: MultipleAutomaticDownloadsSetDetails, callback?: () => void): void;
+ get(details: GetDetails, callback: (details: MultipleAutomaticDownloadsSetDetails) => 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. */
+ id: string;
+ /** Optional. A human readable description of the resource. */
+ description?: string | undefined;
+ }
+
+ /**
+ * Whether to allow cookies and other local data to be set by websites. One of
+ * allow: Accept cookies,
+ * block: Block cookies,
+ * session_only: Accept cookies only for the current session.
+ * 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: CookieContentSetting;
+ /**
+ * Whether to allow sites to show pop-ups. One of
+ * allow: Allow sites to show pop-ups,
+ * block: Don't allow sites to show pop-ups.
+ * Default is block.
+ * The primary URL is the URL of the top-level frame. The secondary URL is not used.
+ */
+ export var popups: PopupsContentSetting;
+ /**
+ * Whether to run JavaScript. One of
+ * allow: Run JavaScript,
+ * block: Don't run JavaScript.
+ * Default is allow.
+ * The primary URL is the URL of the top-level frame. The secondary URL is not used.
+ */
+ export var javascript: JavascriptContentSetting;
+ /**
+ * Whether to allow sites to show desktop notifications. One of
+ * allow: Allow sites to show desktop notifications,
+ * block: Don't allow sites to show desktop notifications,
+ * ask: Ask when a site wants to show desktop notifications.
+ * 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: NotificationsContentSetting;
+ /**
+ * Whether to run plugins. One of
+ * allow: Run plugins automatically,
+ * block: Don't run plugins automatically,
+ * detect_important_content: Only run automatically those plugins that are detected as the website's main content.
+ * Default is allow.
+ * The primary URL is the URL of the top-level frame. The secondary URL is not used.
+ */
+ export var plugins: PluginsContentSetting;
+ /**
+ * Whether to show images. One of
+ * allow: Show images,
+ * block: Don't show images.
+ * 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: ImagesContentSetting;
+ /**
+ * Since Chrome 42.
+ * Whether to allow Geolocation. One of
+ * allow: Allow sites to track your physical location,
+ * block: Don't allow sites to track your physical location,
+ * ask: Ask before allowing sites to track your physical location.
+ * 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: LocationContentSetting;
+ /**
+ * Since Chrome 42.
+ * Whether to allow sites to toggle the fullscreen mode. One of
+ * allow: Allow sites to toggle the fullscreen mode,
+ * ask: Ask when a site wants to toggle the fullscreen mode.
+ * 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: FullscreenContentSetting;
+ /**
+ * Since Chrome 42.
+ * Whether to allow sites to disable the mouse cursor. One of
+ * allow: Allow sites to disable the mouse cursor,
+ * block: Don't allow sites to disable the mouse cursor,
+ * ask: Ask when a site wants to disable the mouse cursor.
+ * Default is ask.
+ * The primary URL is the URL of the top-level frame. The secondary URL is not used.
+ */
+ 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
+ * allow: Allow sites to run plugins unsandboxed,
+ * block: Don't allow sites to run plugins unsandboxed,
+ * ask: Ask when a site wants to run a plugin unsandboxed.
+ * Default is ask.
+ * The primary URL is the URL of the top-level frame. The secondary URL is not used.
+ */
+ export var unsandboxedPlugins: PpapiBrokerContentSetting;
+ /**
+ * Since Chrome 42.
+ * Whether to allow sites to download multiple files automatically. One of
+ * allow: Allow sites to download multiple files automatically,
+ * block: Don't allow sites to download multiple files automatically,
+ * ask: Ask when a site wants to download files automatically after the first file.
+ * Default is ask.
+ * The primary URL is the URL of the top-level frame. The secondary URL is not used.
+ */
+ export var automaticDownloads: MultipleAutomaticDownloadsContentSetting;
+}
+
+////////////////////
+// Context Menus
+////////////////////
+/**
+ * Use the chrome.contextMenus API to add items to Google Chrome's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.
+ * Availability: Since Chrome 6.
+ * Permissions: "contextMenus"
+ */
+declare namespace chrome.contextMenus {
+ export interface OnClickData {
+ /**
+ * Optional.
+ * Since Chrome 35.
+ * The text for the context selection, if any.
+ */
+ selectionText?: string | undefined;
+ /**
+ * Optional.
+ * Since Chrome 35.
+ * A flag indicating the state of a checkbox or radio item after it is clicked.
+ */
+ checked?: boolean | undefined;
+ /**
+ * Since Chrome 35.
+ * The ID of the menu item that was clicked.
+ */
+ menuItemId: number | string;
+ /**
+ * Optional.
+ * Since Chrome 35.
+ * The ID of the frame of the element where the context menu was
+ * clicked, if it was in a frame.
+ */
+ frameId?: number | undefined;
+ /**
+ * Optional.
+ * Since Chrome 35.
+ * The URL of the frame of the element where the context menu was clicked, if it was in a frame.
+ */
+ frameUrl?: string | undefined;
+ /**
+ * Since Chrome 35.
+ * A flag indicating whether the element is editable (text input, textarea, etc.).
+ */
+ editable: boolean;
+ /**
+ * Optional.
+ * Since Chrome 35.
+ * One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements.
+ */
+ mediaType?: 'image' | 'video' | 'audio' | undefined;
+ /**
+ * Optional.
+ * Since Chrome 35.
+ * A flag indicating the state of a checkbox or radio item before it was clicked.
+ */
+ wasChecked?: boolean | undefined;
+ /**
+ * Since Chrome 35.
+ * The URL of the page where the menu item was clicked. This property is not set if the click occurred in a context where there is no current page, such as in a launcher context menu.
+ */
+ pageUrl: string;
+ /**
+ * Optional.
+ * Since Chrome 35.
+ * If the element is a link, the URL it points to.
+ */
+ linkUrl?: string | undefined;
+ /**
+ * Optional.
+ * Since Chrome 35.
+ * The parent ID, if any, for the item clicked.
+ */
+ parentMenuItemId?: number | string;
+ /**
+ * Optional.
+ * Since Chrome 35.
+ * Will be present for elements with a 'src' URL.
+ */
+ srcUrl?: string | undefined;
+ }
+
+ type ContextType = "all" | "page" | "frame" | "selection" | "link" | "editable" | "image" | "video" | "audio" | "launcher" | "browser_action" | "page_action" | "action";
+
+ type ContextItemType = "normal" | "checkbox" | "radio" | "separator";
+
+ export interface CreateProperties {
+ /** Optional. Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see Match Patterns. */
+ documentUrlPatterns?: string[] | undefined;
+ /** Optional. The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items. */
+ checked?: boolean | undefined;
+ /** Optional. The text to be displayed in the item; this is required unless type is 'separator'. When the context is 'selection', you can use %s within the string to show the selected text. For example, if this parameter's value is "Translate '%s' to Pig Latin" and the user selects the word "cool", the context menu item for the selection is "Translate 'cool' to Pig Latin". */
+ title?: string | undefined;
+ /** Optional. List of contexts this menu item will appear in. Defaults to ['page'] if not specified. */
+ contexts?: ContextType | ContextType[] | undefined;
+ /**
+ * Optional.
+ * Since Chrome 20.
+ * Whether this context menu item is enabled or disabled. Defaults to true.
+ */
+ enabled?: boolean | undefined;
+ /** Optional. Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags. */
+ targetUrlPatterns?: string[] | undefined;
+ /**
+ * Optional.
+ * A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for chrome.contextMenus.onClicked.
+ * @param info Information sent when a context menu item is clicked.
+ * @param tab The details of the tab where the click took place. Note: this parameter only present for extensions.
+ */
+ onclick?: ((info: OnClickData, tab: chrome.tabs.Tab) => void) | undefined;
+ /** Optional. The ID of a parent menu item; this makes the item a child of a previously added item. */
+ parentId?: number | string | undefined;
+ /** Optional. The type of menu item. Defaults to 'normal' if not specified. */
+ type?: ContextItemType | undefined;
+ /**
+ * Optional.
+ * Since Chrome 21.
+ * The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension.
+ */
+ id?: string | undefined;
+ /**
+ * Optional.
+ * Since Chrome 62.
+ * Whether the item is visible in the menu.
+ */
+ visible?: boolean | undefined;
+ }
+
+ export interface UpdateProperties {
+ documentUrlPatterns?: string[] | undefined;
+ checked?: boolean | undefined;
+ title?: string | undefined;
+ contexts?: ContextType[] | undefined;
+ /** Optional. Since Chrome 20. */
+ enabled?: boolean | undefined;
+ targetUrlPatterns?: string[] | undefined;
+ onclick?: Function | undefined;
+ /** Optional. Note: You cannot change an item to be a child of one of its own descendants. */
+ parentId?: number | string;
+ type?: ContextItemType | undefined;
+ /**
+ * Optional.
+ * @since Chrome 62.
+ * Whether the item is visible in the menu.
+ */
+ visible?: boolean | undefined;
+ }
+
+ export interface MenuClickedEvent extends chrome.events.Event<(info: OnClickData, tab?: chrome.tabs.Tab) => void> { }
+
+ /**
+ * Since Chrome 38.
+ * The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored.
+ */
+ export var ACTION_MENU_TOP_LEVEL_LIMIT: number;
+
+ /**
+ * Removes all context menu items added by this extension.
+ * @param callback Called when removal is complete.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function removeAll(callback?: () => void): void;
+ /**
+ * Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in chrome.runtime.lastError).
+ * @param callback Called when the item has been created in the browser. If there were any problems creating the item, details will be available in chrome.runtime.lastError.
+ * @returns The ID of the newly created item.
+ */
+ export function create(createProperties: CreateProperties, callback?: () => void): number | string;
+ /**
+ * Updates a previously created context menu item.
+ * @param id The ID of the item to update.
+ * @param updateProperties The properties to update. Accepts the same values as the create function.
+ * @param callback Called when the context menu has been updated.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function update(id: string, updateProperties: UpdateProperties, callback?: () => void): void;
+ /**
+ * Updates a previously created context menu item.
+ * @param id The ID of the item to update.
+ * @param updateProperties The properties to update. Accepts the same values as the create function.
+ * @param callback Called when the context menu has been updated.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function update(id: number, updateProperties: UpdateProperties, callback?: () => void): void;
+ /**
+ * Removes a context menu item.
+ * @param menuItemId The ID of the context menu item to remove.
+ * @param callback Called when the context menu has been removed.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function remove(menuItemId: string, callback?: () => void): void;
+ /**
+ * Removes a context menu item.
+ * @param menuItemId The ID of the context menu item to remove.
+ * @param callback Called when the context menu has been removed.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function remove(menuItemId: number, callback?: () => void): void;
+
+ /**
+ * Since Chrome 21.
+ * Fired when a context menu item is clicked.
+ */
+ export var onClicked: MenuClickedEvent;
+}
+
+////////////////////
+// Cookies
+////////////////////
+/**
+ * Use the chrome.cookies API to query and modify cookies, and to be notified when they change.
+ * Availability: Since Chrome 6.
+ * Permissions: "cookies", host permissions
+ */
+declare namespace chrome.cookies {
+ /** A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set with 'SameSite=None', 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'. 'unspecified' corresponds to a cookie set without the SameSite attribute. **/
+ export type SameSiteStatus = 'unspecified' | 'no_restriction' | 'lax' | 'strict';
+
+ /** Represents information about an HTTP cookie. */
+ export interface Cookie {
+ /** The domain of the cookie (e.g. "www.google.com", "example.com"). */
+ domain: string;
+ /** The name of the cookie. */
+ name: string;
+ /** The ID of the cookie store containing this cookie, as provided in getAllCookieStores(). */
+ storeId: string;
+ /** The value of the cookie. */
+ value: string;
+ /** True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date. */
+ session: boolean;
+ /** True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie). */
+ hostOnly: boolean;
+ /** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. */
+ expirationDate?: number | undefined;
+ /** The path of the cookie. */
+ path: string;
+ /** True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts). */
+ httpOnly: boolean;
+ /** True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS). */
+ secure: boolean;
+ /**
+ * The cookie's same-site status (i.e. whether the cookie is sent with cross-site requests).
+ * @since Chrome 51.
+ */
+ sameSite: SameSiteStatus;
+ }
+
+ /** Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window. */
+ export interface CookieStore {
+ /** The unique identifier for the cookie store. */
+ id: string;
+ /** Identifiers of all the browser tabs that share this cookie store. */
+ tabIds: number[];
+ }
+
+ export interface GetAllDetails {
+ /** Optional. Restricts the retrieved cookies to those whose domains match or are subdomains of this one. */
+ domain?: string | undefined;
+ /** Optional. Filters the cookies by name. */
+ name?: string | undefined;
+ /** Optional. Restricts the retrieved cookies to those that would match the given URL. */
+ url?: string | undefined;
+ /** Optional. The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used. */
+ storeId?: string | undefined;
+ /** Optional. Filters out session vs. persistent cookies. */
+ session?: boolean | undefined;
+ /** Optional. Restricts the retrieved cookies to those whose path exactly matches this string. */
+ path?: string | undefined;
+ /** Optional. Filters the cookies by their Secure property. */
+ secure?: boolean | undefined;
+ }
+
+ export interface SetDetails {
+ /** Optional. The domain of the cookie. If omitted, the cookie becomes a host-only cookie. */
+ domain?: string | undefined;
+ /** Optional. The name of the cookie. Empty by default if omitted. */
+ name?: string | undefined;
+ /** The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail. */
+ url: string;
+ /** Optional. The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store. */
+ storeId?: string | undefined;
+ /** Optional. The value of the cookie. Empty by default if omitted. */
+ value?: string | undefined;
+ /** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie. */
+ expirationDate?: number | undefined;
+ /** Optional. The path of the cookie. Defaults to the path portion of the url parameter. */
+ path?: string | undefined;
+ /** Optional. Whether the cookie should be marked as HttpOnly. Defaults to false. */
+ httpOnly?: boolean | undefined;
+ /** Optional. Whether the cookie should be marked as Secure. Defaults to false. */
+ secure?: boolean | undefined;
+ /**
+ * Optional. The cookie's same-site status. Defaults to "unspecified", i.e., if omitted, the cookie is set without specifying a SameSite attribute.
+ * @since Chrome 51.
+ */
+ sameSite?: SameSiteStatus | undefined;
+ }
+
+ export interface Details {
+ name: string;
+ url: string;
+ storeId?: string | undefined;
+ }
+
+ export interface CookieChangeInfo {
+ /** Information about the cookie that was set or removed. */
+ cookie: Cookie;
+ /** True if a cookie was removed. */
+ removed: boolean;
+ /**
+ * Since Chrome 12.
+ * The underlying reason behind the cookie's change.
+ */
+ cause: string;
+ }
+
+ export interface CookieChangedEvent extends chrome.events.Event<(changeInfo: CookieChangeInfo) => void> { }
+
+ /**
+ * Lists all existing cookie stores.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of CookieStore cookieStores) {...};
+ * Parameter cookieStores: All the existing cookie stores.
+ */
+ export function getAllCookieStores(callback: (cookieStores: CookieStore[]) => void): void;
+ /**
+ * Lists all existing cookie stores.
+ * @return The `getAllCookieStores` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getAllCookieStores(): Promise;
+ /**
+ * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first.
+ * @param details Information to filter the cookies being retrieved.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function(array of Cookie cookies) {...};
+ * Parameter cookies: All the existing, unexpired cookies that match the given cookie info.
+ */
+ export function getAll(details: GetAllDetails, callback: (cookies: Cookie[]) => void): void;
+ /**
+ * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first.
+ * @param details Information to filter the cookies being retrieved.
+ * @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function getAll(details: GetAllDetails): Promise;
+ /**
+ * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
+ * @param details Details about the cookie being set.
+ * @return The `set` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function set(details: SetDetails): Promise;
+ /**
+ * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
+ * @param details Details about the cookie being set.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function( Cookie cookie) {...};
+ * Optional parameter cookie: Contains details about the cookie that's been set. If setting failed for any reason, this will be "null", and "chrome.runtime.lastError" will be set.
+ */
+ export function set(details: SetDetails, callback?: (cookie: Cookie | null) => void): void;
+ /**
+ * Deletes a cookie by name.
+ * @param details Information to identify the cookie to remove.
+ * @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function remove(details: Details): Promise;
+ /**
+ * Deletes a cookie by name.
+ * @param details Information to identify the cookie to remove.
+ * @param callback If you specify the callback parameter, it should be a function that looks like this:
+ * function(object details) {...};
+ */
+ export function remove(details: Details, callback?: (details: Details) => void): void;
+ /**
+ * Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned.
+ * @param details Details to identify the cookie being retrieved.
+ * @param callback The callback parameter should be a function that looks like this:
+ * function( Cookie cookie) {...};
+ * Parameter cookie: Contains details about the cookie. This parameter is null if no such cookie was found.
+ */
+ export function get(details: Details, callback: (cookie: Cookie | null) => void): void;
+ /**
+ * Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned.
+ * @param details Details to identify the cookie being retrieved.
+ * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function get(details: Details): Promise;
+
+ /** Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of "overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with "cause" "explicit". */
+ export var onChanged: CookieChangedEvent;
+}
+
+////////////////////
+// Debugger
+////////////////////
+/**
+ * The chrome.debugger API serves as an alternate transport for Chrome's remote debugging protocol. Use chrome.debugger to attach to one or more tabs to instrument network interaction, debug JavaScript, mutate the DOM and CSS, etc. Use the Debuggee tabId to target tabs with sendCommand and route events by tabId from onEvent callbacks.
+ * Availability: Since Chrome 18.
+ * Permissions: "debugger"
+ */
+declare module chrome {
+ namespace _debugger {
+ /** Debuggee identifier. Either tabId or extensionId must be specified */
+ export interface Debuggee {
+ /** Optional. The id of the tab which you intend to debug. */
+ tabId?: number | undefined;
+ /**
+ * Optional.
+ * Since Chrome 27.
+ * The id of the extension which you intend to debug. Attaching to an extension background page is only possible when 'silent-debugger-extension-api' flag is enabled on the target browser.
+ */
+ extensionId?: string | undefined;
+ /**
+ * Optional.
+ * Since Chrome 28.
+ * The opaque id of the debug target.
+ */
+ targetId?: string | undefined;
+ }
+
+ /**
+ * Since Chrome 28.
+ * Debug target information
+ */
+ export interface TargetInfo {
+ /** Target type. */
+ type: string;
+ /** Target id. */
+ id: string;
+ /**
+ * Optional.
+ * Since Chrome 30.
+ * The tab id, defined if type == 'page'.
+ */
+ tabId?: number | undefined;
+ /**
+ * Optional.
+ * Since Chrome 30.
+ * The extension id, defined if type = 'background_page'.
+ */
+ extensionId?: string | undefined;
+ /** True if debugger is already attached. */
+ attached: boolean;
+ /** Target page title. */
+ title: string;
+ /** Target URL. */
+ url: string;
+ /** Optional. Target favicon URL. */
+ faviconUrl?: string | undefined;
+ }
+
+ export interface DebuggerDetachedEvent
+ extends chrome.events.Event<(source: Debuggee, reason: string) => void> { }
+
+ export interface DebuggerEventEvent
+ extends chrome.events.Event<(source: Debuggee, method: string, params?: Object) => void> { }
+
+ /**
+ * Attaches debugger to the given target.
+ * @param target Debugging target to which you want to attach.
+ * @param requiredVersion Required debugging protocol version ("0.1"). One can only attach to the debuggee with matching major version and greater or equal minor version. List of the protocol versions can be obtained in the documentation pages.
+ * @return The `attach` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function attach(target: Debuggee, requiredVersion: string): Promise;
+ /**
+ * Attaches debugger to the given target.
+ * @param target Debugging target to which you want to attach.
+ * @param requiredVersion Required debugging protocol version ("0.1"). One can only attach to the debuggee with matching major version and greater or equal minor version. List of the protocol versions can be obtained in the documentation pages.
+ * @param callback Called once the attach operation succeeds or fails. Callback receives no arguments. If the attach fails, runtime.lastError will be set to the error message.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function attach(target: Debuggee, requiredVersion: string, callback?: () => void): void;
+ /**
+ * Detaches debugger from the given target.
+ * @param target Debugging target from which you want to detach.
+ * @return The `detach` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
+ */
+ export function detach(target: Debuggee): Promise;
+ /**
+ * Detaches debugger from the given target.
+ * @param target Debugging target from which you want to detach.
+ * @param callback Called once the detach operation succeeds or fails. Callback receives no arguments. If the detach fails, runtime.lastError will be set to the error message.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function() {...};
+ */
+ export function detach(target: Debuggee, callback?: () => void): void;
+ /**
+ * Sends given command to the debugging target.
+ * @param target Debugging target to which you want to send the command.
+ * @param method Method name. Should be one of the methods defined by the remote debugging protocol.
+ * @param commandParams Since Chrome 22.
+ * JSON object with request parameters. This object must conform to the remote debugging params scheme for given method.
+ * @return The `sendCommand` method provides its result via callback or returned as a `Promise` (MV3 only).
+ */
+ export function sendCommand(
+ target: Debuggee,
+ method: string,
+ commandParams?: Object,
+ ): Promise