// // This source is licensed under The GNU General Public License (GPL) Version 2 // // This file containts documented stubs to support Visual Studio Intellisense // when working with Google's chrome extension apis. // You should not reference this file in a page at design time or runtme. // To enable intellisense when authroing chrome extensions, place a commented // reference to this file in your extension's JavaScript files like so: /// chrome = { bookmarks: { create: function (bookmark, callback) { ///Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder. ///{parentId: (integer), index: (optional integer), title: (optional string), url: (optional string)} /// (optional) function(BookmarkTreeNode result) {...} }, get: function (idOrIdList, callback) { ///Retrieves the specified BookmarkTreeNode(s). ///A single string-valued id, or an array of string-valued ids. ///function(BookmarkTreeNode result) {...} }, getChildren: function (id, callback) { ///Retrieves the children of the specified BookmarkTreeNode id. /// ///function(BookmarkTreeNode result) {...} }, getRecent: function (numberOfItems, callback) { ///Retrieves the children of the specified BookmarkTreeNode id. ///The maximum number of items to return. ///function(BookmarkTreeNode result) {...} }, getSubTree: function (id, callback) { ///Retrieves part of the Bookmarks hierarchy, starting at the specified node. ///The ID of the root of the subtree to retrieve ///function(BookmarkTreeNode result) {...} }, getTree: function (callback) { ///Retrieves the entire Bookmarks hierarchy. ///function(BookmarkTreeNode result) {...} }, move: function (id, destination, callback) { ///Moves the specified BookmarkTreeNode to the provided location. /// ///{parentId: (string), index: (optional integer)} /// (optional) function(BookmarkTreeNode result) {...} }, remove: function (id, callback) { ///Removes a bookmark or an empty bookmark folder. /// /// (optional) function() {...} }, removeTree: function (id, callback) { ///Recursively removes a bookmark folder. /// /// (optional) function() {...} }, search: function (query, callback) { ///Searches for BookmarkTreeNodes matching the given query. /// ///function(BookmarkTreeNode result) {...} }, update: function (id, changes, callback) { ///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. /// ///{title: (optional string), url: (optional string)} /// (optional) function(BookmarkTreeNode result) {...} }, onChanged: { addListener: function (listener) { ///Fired when a bookmark or folder changes. Note: Currently, only title and url changes trigger this. ///function(string id, object changeInfo {title: (string), url: (string)}) {...} } }, onChildrenReordered: { addListener: function (listener) { ///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(). ///function(string id, object reorderInfo {childIds: (array of string)}) {...} } }, onCreated: { addListener: function (listener) { ///Fired when a bookmark or folder is created. ///function(string id, BookmarkTreeNode bookmark) {...} } }, onImportBegan: { addListener: function (listener) { ///Fired when a bookmark import session is begun. Expensive observers should ignore handleCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately. /// } }, onImportEnded: { addListener: function (listener) { ///Fired when a bookmark import session is ended. /// } }, onMoved: { addListener: function (listener) { ///Fired when a bookmark or folder is moved to a different parent folder. ///function(string id, object moveInfo {parentId: (string), index: (integer), oldParentId: (string), oldIndex: (integer)}) {...} } }, onRemoved: { addListener: function (listener) { ///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. ///function(string id, object removeInfo {parentId: (string), index: (integer)}) {...} } } }, browserAction: { setBadgeBackgroundColor: function (details) { ///Sets the background color for the badge. ///{color: (array of integer), tabId: (optional integer)} }, setBadgeText: function (details) { ///Sets the badge text for the browser action. The badge is displayed on top of the icon. ///{text: (string), tabId: (optional integer)} }, setIcon: function (details) { ///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. Either the path or the imageData property must be specified. ///{imageData: (optional ImageData), path: (optional string), tabId: (optional integer)} }, setPopup: function (details) { ///Sets the html document to be opened as a popup when the user clicks on the browser action's icon. ///{popup: (string), tabId: (optional integer)} }, setTitle: function (details) { ///Sets the title of the browser action. This shows up in the tooltip. ///{title: (string), tabId: (optional integer)} }, onClicked: { addListener: function (listener) { ///Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup. ///function(Tab tab) {...} } } }, contextMenus: { create: function (createProperties, callback) { ///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.extension.lastError) ///( integer ) ///{type: (optional string), title: (optional string), checked: (optional boolean), contexts: (optional array of string), onclick: (optional function(info, tab) {...}), parentId: (optional integer), documentUrlPatterns: (optional array of string), targetUrlPatterns: (optional array of string) } /// (optional) function() {...} }, remove: function (menuItemId, callback) { ///Removes a context menu item. ///The id of the context menu item to remove. /// (optional) function() {...} }, removeAll: function (callback) { ///Remove all context menu items added by this extension. /// (optional) function() {...} }, update: function (id, updateProperties, callback) { ///Update a previously created context menu item. ///The id of the item to update. ///{type: (optional string), title: (optional string), checked: (optional boolean), contexts: (optional array of string), onclick: (optional function(info, tab) {...}), parentId: (optional integer), documentUrlPatterns: (optional array of string), targetUrlPatterns: (optional array of string) } /// (optional) function() {...} } }, cookies: { get: function (details, callback) { ///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. ///{ url: (string), name: (string), storeId: (optional string) } ///function(Cookie cookie) {...} }, getAll: function (details, callback) { ///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. ///{ url: (optional string), name: (optional string), domain: (optional string), path: (optional string), secure: (optional boolean), session: (optional boolean), storeId: (optional string) } ///function(array of Cookie cookies) {...} }, getAllCookieStores: function (callback) { ///Lists all existing cookie stores. ///function(array of CookieStore cookieStores) {...} }, remove: function (details) { ///Deletes a cookie by name. ///{ url: (string), name: (string), storeId: (optional string) } }, set: function (details) { ///Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. ///{ url: (string), name: (optional string), value: (optional string), domain: (optional string), path: (optional string), secure: (optional boolean), httpOnly: (optional boolean), expirationDate: (optional number), storeId: (optional string) } }, onChanged: { addListener: function (listener) { ///Fired when a cookie is set or removed. ///function(object changeInfo) {...} } } }, extension: { lastError: { message: "" }, inIncognitoContext: { message: false }, connect: function (extensionId, connectInfo) { ///Attempts to connect to other listeners within the extension (such as the extension's background page). This is primarily useful for content scripts connecting to their extension processes. Extensions may connect to content scripts embedded in tabs via chrome.tabs.connect(). /// (optional) The extension ID of the extension you want to connect to. If omitted, default is your own extension. /// (optional) {name: (optional string)} ///( Port ) Port through which messages can be sent and received with the extension. }, getBackgroundPage: function () { ///Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no backround page. ///( DOMWindow ) }, getExtensionTabs: function (windowId) { ///Returns an array of the JavaScript 'window' objects for each of the tabs running inside the current extension. If windowId is specified, returns only the 'window' objects of tabs attached to the specified window. /// (optional) The window ID of the window you want to retrieve the tabs from. ///( array of DOMWindow ) Array of global window objects }, getURL: function (path) { ///Converts a relative path within an extension install directory to a fully-qualified URL. ///A path to a resource within an extension expressed relative to it's install directory. ///( string ) The fully-qualified URL to the resource. }, getViews: function () { ///Returns an array of the JavaScript 'window' objects for each of the pages running inside the current extension. This includes background pages and tabs. ///( array of DOMWindow ) Array of global window objects }, isAllowedFileSchemeAccess: function (callback) { ///Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow access to File URLs' checkbox. ///function(boolean isAllowedAccess) {...} }, isAllowedIncognitoAccess: function (callback) { ///Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox. ///function(boolean isAllowedAccess) {...} }, sendRequest: function (extensionId, request, responseCallback) { ///Sends a single request to other listeners within the extension. Similar to chrome.extension.connect, but only sends a single request with an optional response. /// (optional) The extension ID of the extension you want to connect to. If omitted, default is your own extension. /// /// (optional) function(any response){...} }, setUpdateUrlData: function (data) { ///Sets the value of the ap CGI parameter used in the extension's update URL. This value is ignored for extensions that are hosted in the Chrome Extension Gallery. /// }, onConnect: { addListener: function (listener) { ///Fired when a connection is made from either an extension process or a content script. ///function(Port port) {...} } }, onConnectExternal: { addListener: function (listener) { ///Fired when a connection is made from another extension. ///function(Port port) {...} } }, onRequest: { addListener: function (listener) { ///Fired when a request is sent from either an extension process or a content script. ///function(any request, MessageSender sender, function sendResponse) {...} } }, onRequestExternal: { addListener: function (listener) { ///Fired when a request is sent from another extension. ///function(any request, MessageSender sender, function sendResponse) {...} } } }, fileBrowserHandler: { onExecute: { addListener: function (listener) { ///Fired when file system action is executed from ChromeOS file browser. ///function(string id, FileHandlerExecuteEventDetails details) {...} } } }, history: { addUrl: function (details) { ///Adds a URL to the history at the current time with a transition type of "link". ///{url: (string)} }, deleteAll: function (callback) { ///Deletes all items from the history. ///function(){...} }, deleteRange: function (range, callback) { ///Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range. ///{startTime: (number), endTime: (number)} ///function(){...} }, deleteUrl: function (details) { ///Removes all occurrences of the given URL from the history. ///{url: (string)} }, getVisits: function (details, callback) { ///Retrieve information about visits to a URL. ///{url: (string)} ///function(array of VisitItem results){...} }, search: function (query, callback) { ///Search the history for the last visit time of each page matching the query. ///{text: (string), startTime: (number), endTime: (number), maxResults: (integer)} ///function(array of HistoryItem results){...} }, onVisitRemoved: { addListener: function (listener) { ///Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history. ///function(Object removed) {...} } }, onVisited: { addListener: function (listener) { ///Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history. ///function(HistoryItem result) {...} } } }, i18n: { getAcceptLanguages: function (callback) { ///Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use window.navigator.language. ///function(array of string languages) {...} }, getMessage: function (messageName, substitutions) { ///Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). If the format of the getMessage() call is wrong — for example, messageName is not a string or the substitutions array is empty or has more than 9 elements — this method returns undefined. ///The name of the message, as specified in the messages.json file. ///1 - 9 substitution strings, if the message requires any. } }, idle: { queryState: function (thresholdSeconds, callback) { ///Returns the current state of the browser. ///Threshold, in seconds, used to determine when a machine is in the idle state. ///(string newState) {...} }, onStateChanged: { addListener: function (listener) { ///Fired when the browser changes to an active state. Currently only reports the transition from idle to active. ///function(string newState) {...} } } }, management: { get: function (id, callback) { ///Returns information about the installed extension or app that has the given ID. ///The ID from an item of ExtensionInfo. ///function(ExtensionInfo result) {...} }, getAll: function (callback) { ///Returns a list of information about installed extensions and apps. ///function(array of ExtensionInfo result) {...} }, getPermissionWarningsById: function (id, callback) { ///Returns a list of permission warnings for the given extension id. ///The ID of an already installed extension. ///function(array of string permissionWarnings) {...} }, getPermissionWarningsByManifest: function (id, callback) { ///Returns a list of permission warnings for the given extension manifest string. Note: This function can be used without requesting the 'management' permission in the manifest. ///Extension manifest JSON string. ///function(array of string permissionWarnings) {...} }, launchApp: function (id, callback) { ///Launches an application. ///The extension id of the application. /// (optional) function() {...} }, setEnabled: function (id, enabled, callback) { ///Enable or disable an app or extension. ///This should be the id from an item of ExtensionInfo. ///Whether this item should enabled or disabled. /// (optional) function() {...} }, uninstall: function (id, callback) { ///Uninstall a currently installed app or extension. ///This should be the id from an item of ExtensionInfo. /// (optional) function() {...} }, onDisabled: { addListener: function (listener) { ///Fired when an app or extension has been disabled. ///function(ExtensionInfo info) {...} } }, onEnabled: { addListener: function (listener) { ///Fired when an app or extension has been enabled. ///function(ExtensionInfo info) {...} } }, onInstalled: { addListener: function (listener) { ///Fired when an app or extension has been installed. ///function(ExtensionInfo info) {...} } }, onUninstalled: { addListener: function (listener) { ///Fired when an app or extension has been uninstalled. ///function(string id) {...} } } }, omniBox: { setDefaultSuggestion: function (suggestion) { ///Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the first suggestion row underneath the URL bar. ///{description: (string)} }, onInputCancelled: { addListener: function (listener) { ///User has ended the keyword input session without accepting the input. ///function() {...} } }, onInputChanged: { addListener: function (listener) { ///User has changed what is typed into the omnibox. ///function(string text, Function suggest) {...} } }, onInputEntered: { addListener: function (listener) { ///User has accepted what is typed into the omnibox. ///function(string text) {...} } }, onInputStarted: { addListener: function (listener) { ///User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events. ///function() {...} } } }, pageAction: { hide: function (tabId) { ///Hides the page action. ///The id of the tab for which you want to modify the page action. }, setIcon: function (details) { ///Sets the icon for the page action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element. Either the path or the imageData property must be specified. ///{tabId: (integer), imageData: (optional ImageData), path: (optional string), iconIndex : (optional integer - DEPRECATED)} }, setPopup: function (details) { ///Sets the html document to be opened as a popup when the user clicks on the page action's icon. ///{popup: (string), tabId: (integer)} }, setTitle: function (details) { ///Sets the title of the page action. This is displayed in a tooltip over the page action. ///{title: (string), tabId: (integer)} }, show: function (tabId) { ///Shows the page action. The page action is shown whenever the tab is selected. ///The id of the tab for which you want to modify the page action. }, onClicked: { addListener: function (listener) { ///Fired when a page action icon is clicked. This event will not fire if the page action has a popup. ///function(Tab tab) {...} } } }, proxy: { settings: {}, onProxyError: { addListener: function (listener) { ///Notifies about proxy errors. ///function(object details) {...} } } }, tabs: { captureVisibleTab: function (windowId, callback) { ///Captures the visible area of the currently selected tab in the specified window. /// (optional) Defaults to the current window. ///function(string dataUrl) {...} }, connect: function (tabId, connectInfo) { ///Attempts to connect to other listeners within the extension (such as the extension's background page). This is primarily useful for content scripts connecting to their extension processes. Extensions may connect to content scripts embedded in tabs via chrome.tabs.connect(). ///The tab ID of the tab you want to connect to. /// (optional) {name: (optional string)} }, create: function (createProperties, callback) { ///Creates a new tab. ///{windowId: (optional integer), index: (optional interger), url: (optional string), selected: (optional boolean)} /// (optional) function(Tab tab) {...} }, detectLanguage: function (tabId, callback) { ///Detects the primary language of the content in a tab. /// (optional) Defaults to the selected tab of current window. ///function(string language) {...} }, executeScript: function (tabId, details, callback) { ///Executes scripts against a tab's content. /// (optional) Defaults to the selected tab of current window. ///{code: (optional string), file: (optional string), allFrames: (optional boolean)} NOTE: Either the code or file property must be set, but both may not be set at the same time. /// (optional) function(string language) {...} }, get: function (tabId, callback) { ///Retrieves details about the specified tab. /// ///function(Tab tab) {...} }, getAllInWindow: function (windowId, callback) { ///Gets details about all tabs in the specified window. /// (optional) Defaults to the current window. ///function(array of Tab tabs) {...} }, getCurrent: function (callback) { ///Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view). ///function(Tab tab) {...} }, getSelected: function (windowId, callback) { ///Gets the tab that is selected in the specified window. /// (optional) Defaults to the current window. ///function(Tab tab) {...} }, insertCSS: function (tabId, details, callback) { ///Retrieves details about the specified tab. /// (optional) Defaults to the selected tab of current window. ///{code: (optional string), file: (optional string), allFrame: (optional boolean)} NOTE: Either the code or file property must be set, but both may not be set at the same time. /// (optional) function() {...} }, move: function (tabId, moveProperties, callback) { ///Moves a tab to a new position within its window, or to a new window. /// ///{windowId: (optional integer), index: (integer)} /// (optional) function(Tab tab) {...} }, remove: function (tabId, callback) { ///Closes a tab. /// /// (optional) function() {...} }, sendRequest: function (tabId, request, responseCallback) { ///Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The chrome.extension.onRequest event is fired in each content script running in the specified tab for the current extension. /// /// /// (optional) function(any response) {...} }, update: function (tabId, updateProperties, callback) { ///Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified. /// ///{url: (optional string), selected: (optional boolean)} /// (optional) function(Tab tab) {...} }, onAttached: { addListener: function (listener) { ///Fired when a tab is attached to a window, for example because it was moved between windows. ///function(integer TabId, object attachInfo) {...} } }, onCreated: { addListener: function (listener) { ///Fires when a tab is created. /// (optional) function(Tab tab) {...} } }, onDetached: { addListener: function (listener) { ///Fired when a tab is detached from a window, for example because it is being moved between windows. ///function(integer TabId, object detachInfo) {...} } }, onMoved: { addListener: function (listener) { ///Fires when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see onDetached. ///function(integer TabId, object moveInfo) {...} } }, onRemoved: { addListener: function (listener) { ///Fires when a tab is closed. ///function(integer TabId) {...} } }, onSelectionChanged: { addListener: function (listener) { ///Fires when the selected tab in a window changes. ///function(integer TabId, object selectInfo) {...} } }, onUpdated: { addListener: function (listener) { ///Fires when a tab is updated. ///function(integer TabId, object changeInfo, Tab tab) {...} } } }, tts: { getVoices: function (callback) { ///Gets an array of all available voices. ///function(array of TtsVoice voices) {...} }, isSpeaking: function (callback) { ///Checks if the engine is currently speaking. ///function(boolean speaking) {...} }, speak: function (utterance, options, callback) { ///Speaks text using a text-to-speech engine. ///The text to speak, either plain text or a complete, well-formed SSML document. Speech engines that do not support SSML will strip away the tags and speak the text. The maximum length of the text is 32,768 characters. /// (optional) {enqueue: (optional boolean), voiceName: (optional string), extensionId: (optional string), lang: (optional string), gender: (optional string), rate" (option number), pitch: (optional number), volume: (optional number), requriedEventTypes: (optional array of string), desiredEventTypes: (optional array of string), onEvent: (option function)} /// (optional) function() {...} }, stop: function () { ///Stops any current speech. } }, ttsEngine: { onSpeak: { addListener: function (listener) { /// ///function(string utterance, object options, Function sendTtsEvent) {...} } }, onStop: { addListener: function (listener) { ///Fired when a call is made to tts.stop and this extension may be in the middle of speaking. If an extension receives a call to onStop and speech is already stopped, it should do nothing (not raise an error). } } }, types: { ChromeSetting: { clear: function (details, callback) { ///Clears the setting. This way default settings can become effective again. ///{scope: (string)} ///function() {...} }, get: function (details, callback) { ///Gets the value of a setting. ///{incognito: (boolean)} ///function(object details) {...} }, set: function (details, callback) { ///Sets the value of a setting. ///{value: (any), scope: (string)} ///function() {...} }, onChange: { addListener: function (listener) { ///Fired when the value of the setting changes. ///function(object details) {...} } } } }, windows: { WINDOW_ID_NONE: 0, create: function (createData, callback) { ///Creates (opens) a new browser with any optional sizing, position or default URL provided. /// (optional) {url: (optional string), left: (optional integer), top: (optional integer), width: (optional integer), height: (optional integer)} /// (optional) function(Window window) {...} }, get: function (windowId, callback) { ///Gets details about a window. /// ///function(Window window) {...} }, getAll: function (getInfo, callback) { ///Gets all windows. /// (optional) {popuplate: (optional boolean)} ///function(array of Window windows) {...} }, getCurrent: function (callback) { ///Gets the current window. ///function(Window window) {...} }, getLastFocused: function (callback) { ///Gets the window that was most recently focused — typically the window 'on top'. ///function(Window window) {...} }, remove: function (windowId, callback) { ///Removes (closes) a window, and all the tabs inside it. /// /// (optional) function() {...} }, update: function (windowId, updateInfo, callback) { ///Updates the properties of a window. Specify only the properties that you want to change; unspecified properties will be left unchanged. /// ///{left: (optional integer), top: (optional integer), width: (optional integer), height: (optional integer)} /// (optional) function(Window window) {...} }, onCreated: { addListener: function (listener) { ///Fired when a window is created. /// (optional) function(Window window) {...} } }, onFocusChanged: { addListener: function (listener) { ///Fired when the currently focused window changes. Will be chrome.windows.WINDOW_ID_NONE if all chrome windows have lost focus. Note: On some Linux window managers, WINDOW_ID_NONE will always be sent immediately preceding a switch from one chrome window to another. ///function(integer windowId) {...} } }, onRemoved: { addListener: function (listener) { ///Fired when a window is removed (closed). ///function(integer windowId) {...} } } }, runtime: { sendMessage: function (extensionId, message, options, responseCallback) { /// Sends a single message to onMessage event listeners within the extension (or another extension/app). Similar to chrome.runtime.connect, but only sends a single message with an optional response. The onMessage event is fired in each extension page of the extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage. }, onMessage: { addListener: function (message, sender, response) { /// Fired when a message is sent from either an extension process or a content script. /// Description /// Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one onMessage listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until sendResponse is called). } } } }; chrome.webRequest = { onBeforeRequest: { addListener: function (callback, filter, opt_extraInfoSpec) { /// Fires when a request is about to occur. This event is sent before any TCP connection is made and can be used to cancel or redirect requests. } }, onBeforeSendHeaders: { addListener: function (callback, filter, opt_extraInfoSpec) { /// Fires when a request is about to occur and the initial headers have been prepared. The event is intended to allow extensions to add, modify, and delete request headers (*). The onBeforeSendHeaders event is passed to all subscribers, so different subscribers may attempt to modify the request; see the Implementation details section for how this is handled. This event can be used to cancel the request. } }, onSendHeaders: { addListener: function (callback, filter, opt_extraInfoSpec) { /// Fires after all extensions have had a chance to modify the request headers, and presents the final (*) version. The event is triggered before the headers are sent to the network. This event is informational and handled asynchronously. It does not allow modifying or cancelling the request. } }, onHeadersReceived: { addListener: function (callback, filter, opt_extraInfoSpec) { /// Fires each time that an HTTP(S) response header is received. Due to redirects and authentication requests this can happen multiple times per request. This event is intended to allow extensions to add, modify, and delete response headers, such as incoming Set-Cookie headers. } }, onAuthRequired: { addListener: function (callback, filter, opt_extraInfoSpec) { /// Fires when a request requires authentication of the user. This event can be handled synchronously to provide authentication credentials. Note that extensions may provide invalid credentials. Take care not to enter an infinite loop by repeatedly providing invalid credentials. } }, onBeforeRedirect: { addListener: function (callback, filter, opt_extraInfoSpec) { /// Fires when a redirect is about to be executed. A redirection can be triggered by an HTTP response code or by an extension. This event is informational and handled asynchronously. It does not allow you to modify or cancel the request. } }, onResponseStarted: { addListener: function (callback, filter, opt_extraInfoSpec) { /// Fires when the first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available. This event is informational and handled asynchronously. It does not allow modifying or cancelling the request. } }, onCompleted: { addListener: function (callback, filter, opt_extraInfoSpec) { /// Fires when a request has been processed successfully. } }, onErrorOccurred: { addListener: function (callback, filter, opt_extraInfoSpec) { /// Fires when a request could not be processed successfully. The web request API guarantees that for each request either onCompleted or onErrorOccurred is fired as the final event with one exception: If a request is redirected to a data:// URL, onBeforeRedirect is the last reported event. } }, }; //#region Chrome Notification chrome.notifications = (function () { var fun = function () { this.onClosed = { addListener: function (callback) { /// 添加句柄。当通知关闭时触发这个事件 /// 函数回调,接收两个参数: 通知ID,是否由用户关闭 }, removeListener:function(callback) { /// 移除事件监听 /// 函数回调,接收两个参数: 通知ID,是否由用户关闭 } }; this.onClicked = { addListener: function (callback) { /// 添加句柄。当通知关闭时触发这个事件 /// 函数回调,接收两个参数: 通知ID,是否由用户关闭 }, removeListener: function (callback) { /// 移除事件监听 /// 函数回调,接收两个参数: 通知ID,是否由用户关闭 } }; this.onButtonClicked = { addListener: function (callback) { /// 添加句柄。当通知关闭时触发这个事件 /// 函数回调,接收两个参数: 通知ID,是否由用户关闭 }, removeListener: function (callback) { /// 移除事件监听 /// 函数回调,接收两个参数: 通知ID,是否由用户关闭 } }; this.onPermissionLevelChanged = { addListener: function (callback) { /// 添加句柄。当通知关闭时触发这个事件 /// 函数回调,接收两个参数: 通知ID,是否由用户关闭 }, removeListener: function (callback) { /// 移除事件监听 /// 函数回调,接收两个参数: 通知ID,是否由用户关闭 } }; this.onShowSettings = { addListener: function (callback) { /// 添加句柄。当通知关闭时触发这个事件 /// 函数回调,接收两个参数: 通知ID,是否由用户关闭 }, removeListener: function (callback) { /// 移除事件监听 /// 函数回调,接收两个参数: 通知ID,是否由用户关闭 } }; }; return new fun(); })(); //#endregion function BookmarkTreeNode() { this.id = ""; this.parentId = ""; this.index = 0; this.url = ""; this.title = ""; this.dateAdded = 1.0; this.dateGroupModified = 1.0; this.children = []; return true; } function ContextMenuProperties() { this.type = ""; this.title = ""; this.checked = false; this.contexts = []; this.onclick = function (info, tab) { }; this.parentId = 0; this.documentUrlPatterns = []; this.targetUrlPatterns = []; } function Event() { this.addListener = function (listener) { }; this.removeListener = function (listener) { }; this.hasListener = function (listener) { }; this.hasListeners = function (listener) { }; } function HistoryItem() { this.id = ""; this.url = ""; this.title = ""; this.lastVisitTime = 1.0; this.visitCount = 0; this.typedCount = 0; } function VisitItem() { this.id = ""; this.visitId = ""; this.visitTime = 1.0; this.referringVisitId = ""; this.transition = ""; } function Port() { this.name = ""; this.onDissconnect = new Event(); this.onMessage = new Event(); this.postMessage = function () { }; this.sender = new MessageSender(); } function MessageSender() { this.tab = new Tab(); this.id = ""; } function Tab() { this.id = 0; this.index = 0; this.windowId = 0; this.selected = false; this.pinned = false; this.url = ""; this.title = ""; this.faviconUrl = ""; this.status = ""; this.icognito = false; } function Window() { this.id = 0; this.focused = false; this.top = 0; this.left = 0; this.width = 0; this.height = 0; this.tabs = [new Tab()]; this.icognito = false; this.type = ""; } function IconInfo() { this.size = 0; this.url = ""; } function ExtensionInfo() { this.id = ""; this.name = ""; this.description = ""; this.version = ""; this.mayDisable = false; this.enabled = false; this.isApp = false; this.appLaunchUrl = ""; this.homepageUrl = ""; this.offlineEnabled = false; this.optionsUrl = ""; this.icons = [new IconInfo()]; this.permissions = [""]; this.hostPermissions = [""]; } function Cookie() { this.name = ""; this.value = ""; this.domain = ""; this.hostOnly = false; this.path = ""; this.secure = false; this.httpOnly = false; this.session = false; this.expirationDate = 1.0; this.storeId = ""; } function CookieStore() { this.id = ""; this.tabIds = [0, 1]; } function OnClickData() { this.menuItemID = 0; this.parentMenuItemId = 0; this.mediaType = ""; this.linkUrl = ""; this.srcUrl = ""; this.pageUrl = ""; this.frameUrl = ""; this.selectionText = ""; this.editable = ""; } function FileHandlerExecuteEventDetails() { this.entries = []; this.tab_id = 0; } function SuggestResult() { this.content = ""; this.description = ""; } function ProxyServer() { this.scheme = ["http", "https", "socks4", "socks5"]; this.host = ""; this.port = 0; } function ProxyRules() { this.singleProxy = new ProxyServer(); this.proxyForHttp = new ProxyServer(); this.proxyForHttps = new ProxyServer(); this.proxyForFtp = new ProxyServer(); this.fallbackProxy = new ProxyServer(); this.bypassList = [""]; } function PacScript() { this.url = ""; this.data - ""; this.mandatory = false; } function ProxyConfig() { this.rules = new ProxyRules(); this.pacScript = new PacScript(); this.mode = ["direct", "auto_detect", "pac_script", "fixed_servers", "system"]; } function TtsEvent() { this.type = ["start", "end", "word", "sentence", "marker", "interrupted", "cancelled", "error"]; this.charIndex = 0.0; this.errorMessage = ""; } function TtsVoice() { this.voiceName = ""; this.lang = ""; this.gender = ["male", "female"]; this.extensionId = ""; this.eventTypes = [""]; }