├── .gitattributes ├── .gitignore ├── CONTRIBUTING.md ├── ChromeExtensionProjectTemplate.sln ├── ChromeExtensionProjectTemplate ├── ChromeExtensionProjectTemplate.csproj ├── Properties │ └── build │ │ ├── lib │ │ ├── Ionic.Zip.DLL │ │ └── MSBuild.ExtensionPack.dll │ │ └── ligershark.chrome.targets ├── app │ ├── img │ │ └── icon.png │ ├── manifest.json │ ├── popup.html │ └── popup.js ├── index.htm ├── screenshots │ ├── readme.txt │ └── screenshot.png └── scripts │ ├── _references.js │ └── chrome-api-vsdoc.js ├── ChromeExtensionVsix ├── ChromeExtensionVsix.csproj ├── Key.snk ├── License.txt ├── ProjectTemplates │ └── Google Chrome Extension.zip ├── Properties │ └── AssemblyInfo.cs ├── Resources │ └── Package.ico ├── logo.png └── source.extension.vsixmanifest └── MetaData └── logo.png /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | [Bb]in/ 50 | [Oo]bj/ 51 | 52 | # MSTest test Results 53 | [Tt]est[Rr]esult*/ 54 | [Bb]uild[Ll]og.* 55 | 56 | *_i.c 57 | *_p.c 58 | *.ilk 59 | *.meta 60 | *.obj 61 | *.pch 62 | *.pdb 63 | *.pgc 64 | *.pgd 65 | *.rsp 66 | *.sbr 67 | *.tlb 68 | *.tli 69 | *.tlh 70 | *.tmp 71 | *.tmp_proj 72 | *.log 73 | *.vspscc 74 | *.vssscc 75 | .builds 76 | *.pidb 77 | *.log 78 | *.scc 79 | 80 | # Visual C++ cache files 81 | ipch/ 82 | *.aps 83 | *.ncb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | 88 | # Visual Studio profiler 89 | *.psess 90 | *.vsp 91 | *.vspx 92 | 93 | # Guidance Automation Toolkit 94 | *.gpState 95 | 96 | # ReSharper is a .NET coding add-in 97 | _ReSharper*/ 98 | *.[Rr]e[Ss]harper 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | *.ncrunch* 108 | .*crunch*.local.xml 109 | 110 | # Installshield output folder 111 | [Ee]xpress/ 112 | 113 | # DocProject is a documentation generator add-in 114 | DocProject/buildhelp/ 115 | DocProject/Help/*.HxT 116 | DocProject/Help/*.HxC 117 | DocProject/Help/*.hhc 118 | DocProject/Help/*.hhk 119 | DocProject/Help/*.hhp 120 | DocProject/Help/Html2 121 | DocProject/Help/html 122 | 123 | # Click-Once directory 124 | publish/ 125 | 126 | # Publish Web Output 127 | *.Publish.xml 128 | *.pubxml 129 | 130 | # NuGet Packages Directory 131 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 132 | #packages/ 133 | 134 | # Windows Azure Build Output 135 | csx 136 | *.`.csdef 137 | 138 | # Windows Store app package directory 139 | AppPackages/ 140 | 141 | # Others 142 | sql/ 143 | *.Cache 144 | ClientBin/ 145 | [Ss]tyle[Cc]op.* 146 | ~$* 147 | *~ 148 | *.dbmdl 149 | *.[Pp]ublish.xml 150 | *.pfx 151 | *.publishsettings 152 | 153 | # RIA/Silverlight projects 154 | Generated_Code/ 155 | 156 | # Backup & report files from converting an old project file to a newer 157 | # Visual Studio version. Backup files are not needed, because we have git ;-) 158 | _UpgradeReport_Files/ 159 | Backup*/ 160 | UpgradeLog*.XML 161 | UpgradeLog*.htm 162 | 163 | # SQL Server files 164 | App_Data/*.mdf 165 | App_Data/*.ldf 166 | 167 | ############# 168 | ## Windows detritus 169 | ############# 170 | 171 | # Windows image file caches 172 | Thumbs.db 173 | ehthumbs.db 174 | 175 | # Folder config file 176 | Desktop.ini 177 | 178 | # Recycle Bin used on file shares 179 | $RECYCLE.BIN/ 180 | 181 | # Mac crap 182 | .DS_Store 183 | 184 | 185 | ############# 186 | ## Python 187 | ############# 188 | 189 | *.py[co] 190 | 191 | # Packages 192 | *.egg 193 | *.egg-info 194 | dist/ 195 | eggs/ 196 | parts/ 197 | var/ 198 | sdist/ 199 | develop-eggs/ 200 | .installed.cfg 201 | 202 | # Installer logs 203 | pip-log.txt 204 | 205 | # Unit test / coverage reports 206 | .coverage 207 | .tox 208 | 209 | #Translations 210 | *.mo 211 | 212 | #Mr Developer 213 | .mr.developer.cfg 214 | /.vs 215 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Looking to contribute something? **Here's how you can help.** 4 | 5 | Please take a moment to review this document in order to make the contribution 6 | process easy and effective for everyone involved. 7 | 8 | Following these guidelines helps to communicate that you respect the time of 9 | the developers managing and developing this open source project. In return, 10 | they should reciprocate that respect in addressing your issue or assessing 11 | patches and features. 12 | 13 | 14 | ## Using the issue tracker 15 | 16 | The issue tracker is the preferred channel for [bug reports](#bug-reports), 17 | [features requests](#feature-requests) and 18 | [submitting pull requests](#pull-requests), but please respect the 19 | following restrictions: 20 | 21 | * Please **do not** use the issue tracker for personal support requests. Stack 22 | Overflow is a better place to get help. 23 | 24 | * Please **do not** derail or troll issues. Keep the discussion on topic and 25 | respect the opinions of others. 26 | 27 | * Please **do not** open issues or pull requests which *belongs to* third party 28 | components. 29 | 30 | 31 | ## Bug reports 32 | 33 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 34 | Good bug reports are extremely helpful, so thanks! 35 | 36 | Guidelines for bug reports: 37 | 38 | 1. **Use the GitHub issue search** — check if the issue has already been 39 | reported. 40 | 41 | 2. **Check if the issue has been fixed** — try to reproduce it using the 42 | latest `master` or development branch in the repository. 43 | 44 | 3. **Isolate the problem** — ideally create an 45 | [SSCCE](http://www.sscce.org/) and a live example. 46 | Uploading the project on cloud storage (OneDrive, DropBox, et el.) 47 | or creating a sample GitHub repository is also helpful. 48 | 49 | 50 | A good bug report shouldn't leave others needing to chase you up for more 51 | information. Please try to be as detailed as possible in your report. What is 52 | your environment? What steps will reproduce the issue? What browser(s) and OS 53 | experience the problem? Do other browsers show the bug differently? What 54 | would you expect to be the outcome? All these details will help people to fix 55 | any potential bugs. 56 | 57 | Example: 58 | 59 | > Short and descriptive example bug report title 60 | > 61 | > A summary of the issue and the Visual Studio, browser, OS environments 62 | > in which it occurs. If suitable, include the steps required to reproduce the bug. 63 | > 64 | > 1. This is the first step 65 | > 2. This is the second step 66 | > 3. Further steps, etc. 67 | > 68 | > `` - a link to the project/file uploaded on cloud storage or other publicly accessible medium. 69 | > 70 | > Any other information you want to share that is relevant to the issue being 71 | > reported. This might include the lines of code that you have identified as 72 | > causing the bug, and potential solutions (and your opinions on their 73 | > merits). 74 | 75 | 76 | ## Feature requests 77 | 78 | Feature requests are welcome. But take a moment to find out whether your idea 79 | fits with the scope and aims of the project. It's up to *you* to make a strong 80 | case to convince the project's developers of the merits of this feature. Please 81 | provide as much detail and context as possible. 82 | 83 | 84 | ## Pull requests 85 | 86 | Good pull requests, patches, improvements and new features are a fantastic 87 | help. They should remain focused in scope and avoid containing unrelated 88 | commits. 89 | 90 | **Please ask first** before embarking on any significant pull request (e.g. 91 | implementing features, refactoring code, porting to a different language), 92 | otherwise you risk spending a lot of time working on something that the 93 | project's developers might not want to merge into the project. 94 | 95 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the 96 | project (indentation, accurate comments, etc.) and any other requirements 97 | (such as test coverage). 98 | 99 | Adhering to the following process is the best way to get your work 100 | included in the project: 101 | 102 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 103 | and configure the remotes: 104 | 105 | ```bash 106 | # Clone your fork of the repo into the current directory 107 | git clone https://github.com//.git 108 | # Navigate to the newly cloned directory 109 | cd 110 | # Assign the original repo to a remote called "upstream" 111 | git remote add upstream https://github.com/madskristensen/.git 112 | ``` 113 | 114 | 2. If you cloned a while ago, get the latest changes from upstream: 115 | 116 | ```bash 117 | git checkout master 118 | git pull upstream master 119 | ``` 120 | 121 | 3. Create a new topic branch (off the main project development branch) to 122 | contain your feature, change, or fix: 123 | 124 | ```bash 125 | git checkout -b 126 | ``` 127 | 128 | 4. Commit your changes in logical chunks. Please adhere to these [git commit 129 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 130 | or your code is unlikely be merged into the main project. Use Git's 131 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 132 | feature to tidy up your commits before making them public. Also, prepend name of the feature 133 | to the commit message. For instance: "SCSS: Fixes compiler results for IFileListener.\nFixes `#123`" 134 | 135 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 136 | 137 | ```bash 138 | git pull [--rebase] upstream master 139 | ``` 140 | 141 | 6. Push your topic branch up to your fork: 142 | 143 | ```bash 144 | git push origin 145 | ``` 146 | 147 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 148 | with a clear title and description against the `master` branch. 149 | 150 | 151 | ## Code guidelines 152 | 153 | - Always use proper indentation. 154 | - In Visual Studio under `Tools > Options > Text Editor > C# > Advanced`, make sure 155 | `Place 'System' directives first when sorting usings` option is enabled (checked). 156 | - Before committing, organize usings for each updated C# source file. Either you can 157 | right-click editor and select `Organize Usings > Remove and sort` OR use extension 158 | like [BatchFormat](http://visualstudiogallery.msdn.microsoft.com/a7f75c34-82b4-4357-9c66-c18e32b9393e). 159 | - Before committing, run Code Analysis in `Debug` configuration and follow the guidelines 160 | to fix CA issues. Code Analysis commits can be made separately. 161 | -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChromeExtensionProjectTemplate", "ChromeExtensionProjectTemplate\ChromeExtensionProjectTemplate.csproj", "{9D141603-1A9D-4EEC-82D8-C473EA436839}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChromeExtensionVsix", "ChromeExtensionVsix\ChromeExtensionVsix.csproj", "{BBBB9629-3C3D-4BE4-8E23-677F9159FF33}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {9D141603-1A9D-4EEC-82D8-C473EA436839}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {9D141603-1A9D-4EEC-82D8-C473EA436839}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {9D141603-1A9D-4EEC-82D8-C473EA436839}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {9D141603-1A9D-4EEC-82D8-C473EA436839}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {BBBB9629-3C3D-4BE4-8E23-677F9159FF33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {BBBB9629-3C3D-4BE4-8E23-677F9159FF33}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {BBBB9629-3C3D-4BE4-8E23-677F9159FF33}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {BBBB9629-3C3D-4BE4-8E23-677F9159FF33}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {8BF7AC2C-5C48-4F25-BE24-0AFC57DF0001} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/ChromeExtensionProjectTemplate.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 8 | 9 | 2.0 10 | {9D141603-1A9D-4EEC-82D8-C473EA436839} 11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 12 | Library 13 | Properties 14 | BestPracticesChromeExtension 15 | BestPracticesChromeExtension 16 | v4.5 17 | true 18 | 19 | 20 | 21 | 22 | 23 | 24 | true 25 | full 26 | false 27 | bin\ 28 | DEBUG;TRACE 29 | prompt 30 | 4 31 | 32 | 33 | pdbonly 34 | true 35 | bin\ 36 | TRACE 37 | prompt 38 | 4 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 10.0 59 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | True 70 | True 71 | 1530 72 | / 73 | http://localhost:46950/ 74 | False 75 | False 76 | 77 | 78 | False 79 | 80 | 81 | 82 | 83 | 84 | app\ 85 | $(AssemblyName).zip 86 | $(MSBuildProjectDirectory)\properties\build\ 87 | $(BuildFolder)Lib\ 88 | 89 | 90 | 91 | 92 | 93 | 94 | $(BuildFolder)\ligershark.chrome.targets 95 | 96 | 97 | -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/Properties/build/lib/Ionic.Zip.DLL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ligershark/ChromeExtensionProjectTemplate/d2138a8e9c475d728b31740651cf545378f8230a/ChromeExtensionProjectTemplate/Properties/build/lib/Ionic.Zip.DLL -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/Properties/build/lib/MSBuild.ExtensionPack.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ligershark/ChromeExtensionProjectTemplate/d2138a8e9c475d728b31740651cf545378f8230a/ChromeExtensionProjectTemplate/Properties/build/lib/MSBuild.ExtensionPack.dll -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/Properties/build/ligershark.chrome.targets: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | false 5 | 6 | 7 | 8 | false 9 | 10 | 11 | false 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | <_AppCandidateFilesToZip Remove="@(_AppCandidateFilesToZip)" /> 22 | <_AppCandidateFilesToZip Include="@(Content);@(None)" /> 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | <_AppFolderFullPath>%(AppFolderItem.FullPath) 32 | 33 | 34 | 35 | 41 | 42 | 43 | 44 | 45 | Clean; 46 | Build; 47 | 48 | 49 | 50 | 51 | 52 | 53 | <_FilesToDelete Remove="@(_FilesToDelete)" /> 54 | <_FilesToDelete Include="$(OutputPath)**\*" /> 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/app/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ligershark/ChromeExtensionProjectTemplate/d2138a8e9c475d728b31740651cf545378f8230a/ChromeExtensionProjectTemplate/app/img/icon.png -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/app/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | 4 | "name": "One-click Kittens", 5 | "description": "This extension demonstrates a browser action with kittens.", 6 | "version": "1.0", 7 | 8 | "permissions": [ 9 | "https://secure.flickr.com/" 10 | ], 11 | "browser_action": { 12 | "default_icon": "img/icon.png", 13 | "default_popup": "popup.html" 14 | } 15 | } -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/app/popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Getting Started Extension's Popup 5 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/app/popup.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /** 6 | * Global variable containing the query we'd like to pass to Flickr. In this 7 | * case, kittens! 8 | * 9 | * @type {string} 10 | */ 11 | var QUERY = 'kittens'; 12 | 13 | var kittenGenerator = { 14 | /** 15 | * Flickr URL that will give us lots and lots of whatever we're looking for. 16 | * 17 | * See http://www.flickr.com/services/api/flickr.photos.search.html for 18 | * details about the construction of this URL. 19 | * 20 | * @type {string} 21 | * @private 22 | */ 23 | searchOnFlickr_: 'https://secure.flickr.com/services/rest/?' + 24 | 'method=flickr.photos.search&' + 25 | 'api_key=90485e931f687a9b9c2a66bf58a3861a&' + 26 | 'text=' + encodeURIComponent(QUERY) + '&' + 27 | 'safe_search=1&' + 28 | 'content_type=1&' + 29 | 'sort=interestingness-desc&' + 30 | 'per_page=20', 31 | 32 | /** 33 | * Sends an XHR GET request to grab photos of lots and lots of kittens. The 34 | * XHR's 'onload' event is hooks up to the 'showPhotos_' method. 35 | * 36 | * @public 37 | */ 38 | requestKittens: function() { 39 | var req = new XMLHttpRequest(); 40 | req.open("GET", this.searchOnFlickr_, true); 41 | req.onload = this.showPhotos_.bind(this); 42 | req.send(null); 43 | }, 44 | 45 | /** 46 | * Handle the 'onload' event of our kitten XHR request, generated in 47 | * 'requestKittens', by generating 'img' elements, and stuffing them into 48 | * the document for display. 49 | * 50 | * @param {ProgressEvent} e The XHR ProgressEvent. 51 | * @private 52 | */ 53 | showPhotos_: function (e) { 54 | var kittens = e.target.responseXML.querySelectorAll('photo'); 55 | for (var i = 0; i < kittens.length; i++) { 56 | var img = document.createElement('img'); 57 | img.src = this.constructKittenURL_(kittens[i]); 58 | img.setAttribute('alt', kittens[i].getAttribute('title')); 59 | document.body.appendChild(img); 60 | } 61 | }, 62 | 63 | /** 64 | * Given a photo, construct a URL using the method outlined at 65 | * http://www.flickr.com/services/api/misc.urlKittenl 66 | * 67 | * @param {DOMElement} A kitten. 68 | * @return {string} The kitten's URL. 69 | * @private 70 | */ 71 | constructKittenURL_: function (photo) { 72 | return "http://farm" + photo.getAttribute("farm") + 73 | ".static.flickr.com/" + photo.getAttribute("server") + 74 | "/" + photo.getAttribute("id") + 75 | "_" + photo.getAttribute("secret") + 76 | "_s.jpg"; 77 | } 78 | }; 79 | 80 | // Run our kitten generation script as soon as the document's DOM is ready. 81 | document.addEventListener('DOMContentLoaded', function () { 82 | kittenGenerator.requestKittens(); 83 | }); 84 | -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/index.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ligershark/ChromeExtensionProjectTemplate/d2138a8e9c475d728b31740651cf545378f8230a/ChromeExtensionProjectTemplate/index.htm -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/screenshots/readme.txt: -------------------------------------------------------------------------------- 1 | When uploading your extension to the Chrome Web Store, you can add screenshots 2 | that will be presented on the download page at the store. Use this folder for your 3 | screenshots. 4 | 5 | The Web Store is located here: https://chrome.google.com/webstore/category/extensions -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/screenshots/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ligershark/ChromeExtensionProjectTemplate/d2138a8e9c475d728b31740651cf545378f8230a/ChromeExtensionProjectTemplate/screenshots/screenshot.png -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/scripts/_references.js: -------------------------------------------------------------------------------- 1 | /// -------------------------------------------------------------------------------- /ChromeExtensionProjectTemplate/scripts/chrome-api-vsdoc.js: -------------------------------------------------------------------------------- 1 | // 2 | // This source is licensed under The GNU General Public License (GPL) Version 2 3 | // 4 | 5 | // This file contains documented stubs to support Visual Studio intellisense 6 | // when working with Google's chrome extension APIs. 7 | // You should not reference this file in a page at design time or runtime. 8 | // To enable intellisense when authoring chrome extensions, place a commented 9 | // reference to this file in your extension's JavaScript files like so: /// 10 | 11 | chrome = { 12 | alarms: { 13 | clear: function (name) { 14 | ///Clears the alarm with the given name. 15 | /// (optional) The name of the alarm to clear. Defaults to the empty string. 16 | }, 17 | clearAll: function () { }, 18 | create: function (name, alarmInfo) { 19 | ///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. 20 | /// (optional) Optional name to identify this alarm. Defaults to the empty string. 21 | ///None{delayInMinutes: (optional double), periodInMinutes: (optional double), when: (optional double)} 22 | }, 23 | get: function (name, callback) { 24 | ///Retrieves details about the specified alarm. 25 | /// (optional) The name of the alarm to get. Defaults to the empty string. 26 | ///function( Alarm alarm) {...} ; 27 | }, 28 | getAll: function (callback) { 29 | ///Gets an array of all the alarms. 30 | ///function(array of Alarm alarms) {...} ; 31 | }, 32 | onAlarm: { 33 | addListener: function (callback) { 34 | ///Fired when an alarm has elapsed. Useful for event pages. 35 | ///function( Alarm alarm) {...} ; 36 | } 37 | } 38 | }, 39 | bookmarks: { 40 | create: function (bookmark, callback) { 41 | ///Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder. 42 | ///{url: (optional string), index: (optional integer), title: (optional string), parentId: (optional string)} 43 | /// (optional) function( BookmarkTreeNode result) {...} ; 44 | }, 45 | get: function (idOrIdList, callback) { 46 | ///Retrieves the specified BookmarkTreeNode(s). 47 | ///A single string-valued id, or an array of string-valued ids 48 | ///function(array of BookmarkTreeNode results) {...} ; 49 | }, 50 | getChildren: function (id, callback) { 51 | ///Retrieves the children of the specified BookmarkTreeNode id. 52 | /// 53 | ///function(array of BookmarkTreeNode results) {...} ; 54 | }, 55 | getRecent: function (numberOfItems, callback) { 56 | ///Retrieves the recently added bookmarks. 57 | ///The maximum number of items to return. 58 | ///function(array of BookmarkTreeNode results) {...} ; 59 | }, 60 | getSubTree: function (id, callback) { 61 | ///Retrieves part of the Bookmarks hierarchy, starting at the specified node. 62 | ///The ID of the root of the subtree to retrieve. 63 | ///function(array of BookmarkTreeNode results) {...} ; 64 | }, 65 | getTree: function (callback) { 66 | ///Retrieves the entire Bookmarks hierarchy. 67 | ///function(array of BookmarkTreeNode results) {...} ; 68 | }, 69 | move: function (id, destination, callback) { 70 | ///Moves the specified BookmarkTreeNode to the provided location. 71 | /// 72 | ///{index: (optional integer), parentId: (optional string)} 73 | /// (optional) function( BookmarkTreeNode result) {...} ; 74 | }, 75 | onChanged: { 76 | addListener: function (callback) { 77 | ///Fired when a bookmark or folder changes. Note: Currently, only title and url changes trigger this. 78 | ///function(string id, object changeInfo) {...} ; 79 | } 80 | }, 81 | onChildrenReordered: { 82 | addListener: function (callback) { 83 | ///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(). 84 | ///function(string id, object reorderInfo) {...} ; 85 | } 86 | }, 87 | onCreated: { 88 | addListener: function (callback) { 89 | ///Fired when a bookmark or folder is created. 90 | ///function(string id, BookmarkTreeNode bookmark) {...} ; 91 | } 92 | }, 93 | onImportBegan: { 94 | addListener: function (callback) { 95 | ///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. 96 | ///function() {...} ; 97 | } 98 | }, 99 | onImportEnded: { 100 | addListener: function (callback) { 101 | ///Fired when a bookmark import session is ended. 102 | ///function() {...} ; 103 | } 104 | }, 105 | onMoved: { 106 | addListener: function (callback) { 107 | ///Fired when a bookmark or folder is moved to a different parent folder. 108 | ///function(string id, object moveInfo) {...} ; 109 | } 110 | }, 111 | onRemoved: { 112 | addListener: function (callback) { 113 | ///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. 114 | ///function(string id, object removeInfo) {...} ; 115 | } 116 | }, 117 | remove: function (id, callback) { 118 | ///Removes a bookmark or an empty bookmark folder. 119 | /// 120 | /// (optional) function() {...} ; 121 | }, 122 | removeTree: function (id, callback) { 123 | ///Recursively removes a bookmark folder. 124 | /// 125 | /// (optional) function() {...} ; 126 | }, 127 | search: function (query, callback) { 128 | ///Searches for BookmarkTreeNodes matching the given query. 129 | /// 130 | ///function(array of BookmarkTreeNode results) {...} ; 131 | }, 132 | update: function (id, changes, callback) { 133 | ///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. 134 | /// 135 | ///{url: (optional string), title: (optional string)} 136 | /// (optional) function( BookmarkTreeNode result) {...} ; 137 | } 138 | }, 139 | browserAction: { 140 | disable: function (tabId) { 141 | ///Disables the browser action for a tab. 142 | /// (optional) The id of the tab for which you want to modify the browser action. 143 | }, 144 | enable: function (tabId) { 145 | ///Enables the browser action for a tab. By default, browser actions are enabled. 146 | /// (optional) The id of the tab for which you want to modify the browser action. 147 | }, 148 | getBadgeBackgroundColor: function (details, callback) { 149 | ///Gets the background color of the browser action. 150 | ///{tabId: (optional integer), imageData: (optional ImageDataType orobject), title: (string), color: (stringor ColorArray ), text: (string), popup: (string), path: (optional stringorobject)} 151 | ///function( ColorArray result) {...} ; 152 | }, 153 | getBadgeText: function (details, callback) { 154 | ///Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned. 155 | ///{tabId: (optional integer), imageData: (optional ImageDataType orobject), title: (string), color: (stringor ColorArray ), text: (string), popup: (string), path: (optional stringorobject)} 156 | ///function(string result) {...} ; 157 | }, 158 | getPopup: function (details, callback) { 159 | ///Gets the html document set as the popup for this browser action. 160 | ///{tabId: (optional integer), imageData: (optional ImageDataType orobject), title: (string), color: (stringor ColorArray ), text: (string), popup: (string), path: (optional stringorobject)} 161 | ///function(string result) {...} ; 162 | }, 163 | getTitle: function (details, callback) { 164 | ///Gets the title of the browser action. 165 | ///{tabId: (optional integer), imageData: (optional ImageDataType orobject), title: (string), color: (stringor ColorArray ), text: (string), popup: (string), path: (optional stringorobject)} 166 | ///function(string result) {...} ; 167 | }, 168 | onClicked: { 169 | addListener: function (callback) { 170 | ///Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup. 171 | ///function( tabs.Tab tab) {...} ; 172 | } 173 | }, 174 | setBadgeBackgroundColor: function (details) { 175 | ///Sets the background color for the badge. 176 | ///{tabId: (optional integer), imageData: (optional ImageDataType orobject), title: (string), color: (stringor ColorArray ), text: (string), popup: (string), path: (optional stringorobject)} 177 | }, 178 | setBadgeText: function (details) { 179 | ///Sets the badge text for the browser action. The badge is displayed on top of the icon. 180 | ///{tabId: (optional integer), imageData: (optional ImageDataType orobject), title: (string), color: (stringor ColorArray ), text: (string), popup: (string), path: (optional stringorobject)} 181 | }, 182 | setIcon: function (details, callback) { 183 | ///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. 184 | ///{tabId: (optional integer), imageData: (optional ImageDataType orobject), title: (string), color: (stringor ColorArray ), text: (string), popup: (string), path: (optional stringorobject)} 185 | /// (optional) function() {...} ; 186 | }, 187 | setPopup: function (details) { 188 | ///Sets the html document to be opened as a popup when the user clicks on the browser action's icon. 189 | ///{tabId: (optional integer), imageData: (optional ImageDataType orobject), title: (string), color: (stringor ColorArray ), text: (string), popup: (string), path: (optional stringorobject)} 190 | }, 191 | setTitle: function (details) { 192 | ///Sets the title of the browser action. This shows up in the tooltip. 193 | ///{tabId: (optional integer), imageData: (optional ImageDataType orobject), title: (string), color: (stringor ColorArray ), text: (string), popup: (string), path: (optional stringorobject)} 194 | } 195 | }, 196 | browsingData: { 197 | remove: function (options, dataToRemove, callback) { 198 | ///Clears various types of browsing data stored in a user's profile. 199 | /// 200 | ///The set of data types to remove. 201 | /// (optional) function() {...} ; 202 | }, 203 | removeAppcache: function (options, callback) { 204 | ///Clears websites' appcache data. 205 | /// 206 | /// (optional) function() {...} ; 207 | }, 208 | removeCache: function (options, callback) { 209 | ///Clears the browser's cache. 210 | /// 211 | /// (optional) function() {...} ; 212 | }, 213 | removeCookies: function (options, callback) { 214 | ///Clears the browser's cookies and server-bound certificates modified within a particular timeframe. 215 | /// 216 | /// (optional) function() {...} ; 217 | }, 218 | removeDownloads: function (options, callback) { 219 | ///Clears the browser's list of downloaded files ( not the downloaded files themselves). 220 | /// 221 | /// (optional) function() {...} ; 222 | }, 223 | removeFileSystems: function (options, callback) { 224 | ///Clears websites' file system data. 225 | /// 226 | /// (optional) function() {...} ; 227 | }, 228 | removeFormData: function (options, callback) { 229 | ///Clears the browser's stored form data (autofill). 230 | /// 231 | /// (optional) function() {...} ; 232 | }, 233 | removeHistory: function (options, callback) { 234 | ///Clears the browser's history. 235 | /// 236 | /// (optional) function() {...} ; 237 | }, 238 | removeIndexedDB: function (options, callback) { 239 | ///Clears websites' IndexedDB data. 240 | /// 241 | /// (optional) function() {...} ; 242 | }, 243 | removeLocalStorage: function (options, callback) { 244 | ///Clears websites' local storage data. 245 | /// 246 | /// (optional) function() {...} ; 247 | }, 248 | removePasswords: function (options, callback) { 249 | ///Clears the browser's stored passwords. 250 | /// 251 | /// (optional) function() {...} ; 252 | }, 253 | removePluginData: function (options, callback) { 254 | ///Clears plugins' data. 255 | /// 256 | /// (optional) function() {...} ; 257 | }, 258 | removeWebSQL: function (options, callback) { 259 | ///Clears websites' WebSQL data. 260 | /// 261 | /// (optional) function() {...} ; 262 | }, 263 | settings: function (callback) { 264 | ///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. 265 | ///function(object result) {...} ; 266 | } 267 | }, 268 | commands: { 269 | getAll: function (callback) { 270 | ///Returns all the registered extension commands for this extension and their shortcut (if active). 271 | /// (optional) function(array of Command commands) {...} ; 272 | }, 273 | onCommand: { 274 | addListener: function (callback) { 275 | ///Fired when a registered command is activated using a keyboard shortcut. 276 | ///function(string command) {...} ; 277 | } 278 | } 279 | }, 280 | contentSettings: { 281 | clear: function (details, callback) { 282 | ///Clear all content setting rules set by this extension. 283 | ///{scope: (optional enum of /regular/ or /icognito_session_only/)} 284 | /// (optional) function() {...}; 285 | }, 286 | get: function (details, callback) { 287 | ///Gets the current content setting for a given pair of URLs. 288 | ///{primaryUrl: (string), secondaryUrl: (optional string), resourceIdentifier: (optional ResourceIdentifier), icognito: (optional boolean)} 289 | ///function(object details) {...}; 290 | }, 291 | set: function (details, callback) { 292 | ///Gets the current content setting for a given pair of URLs. 293 | ///{primaryPattern: (string), secondaryPattern: (optional string), resourceIdentifier: (optional ResourceIdentifier), setting: (any), scope: (optional enum of /regular/ or /icognito_session_only/)} 294 | ///function() {...}; 295 | }, 296 | getResourceIdentifiers: function (callback) { 297 | /// 298 | ///function(array of ResourceIdentifier resourceIdentifiers) {...}; 299 | }, 300 | cookies: {}, 301 | images: {}, 302 | javascript: {}, 303 | plugins: {}, 304 | popups: {}, 305 | notifications: {} 306 | }, 307 | contextMenus: { 308 | create: function (createProperties, callback) { 309 | ///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). 310 | ///{documentUrlPatterns: (optional arrayofstring), checked: (optional boolean), title: (optional string), contexts: (optional arrayofenumof \\all\\ , \\page\\ , \\frame\\ , \\selection\\ , \\link\\ , \\editable\\ , \\image\\ , \\video\\ , \\audio\\ ,or \\launcher\\ ), enabled: (optional boolean), targetUrlPatterns: (optional arrayofstring), onclick: (optional function), parentId: (optional integerorstring), type: (optional enumof \\normal\\ , \\checkbox\\ , \\radio\\ ,or \\separator\\ ), id: (optional string)} 311 | /// (optional) function() {...} ; 312 | }, 313 | onClicked: { 314 | addListener: function (callback) { 315 | ///Fired when a context menu item is clicked. 316 | ///function( OnClickData info, tabs.Tab tab) {...} ; 317 | } 318 | }, 319 | remove: function (menuItemId, callback) { 320 | ///Removes a context menu item. 321 | ///The ID of the context menu item to remove. 322 | /// (optional) function() {...} ; 323 | }, 324 | removeAll: function (callback) { 325 | ///Removes all context menu items added by this extension. 326 | /// (optional) function() {...} ; 327 | }, 328 | update: function (id, updateProperties, callback) { 329 | ///Updates a previously created context menu item. 330 | ///The ID of the item to update. 331 | ///The properties to update. Accepts the same values as the create function.{documentUrlPatterns: (optional arrayofstring), checked: (optional boolean), title: (optional string), contexts: (optional arrayofenumof \\all\\ , \\page\\ , \\frame\\ , \\selection\\ , \\link\\ , \\editable\\ , \\image\\ , \\video\\ , \\audio\\ ,or \\launcher\\ ), enabled: (optional boolean), targetUrlPatterns: (optional arrayofstring), onclick: (optional function), parentId: (optional integerorstring), type: (optional enumof \\normal\\ , \\checkbox\\ , \\radio\\ ,or \\separator\\ )} 332 | /// (optional) function() {...} ; 333 | } 334 | }, 335 | cookies: { 336 | get: function (details, callback) { 337 | ///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. 338 | ///Details to identify the cookie being retrieved.{domain: (optional string), name: (string), url: (string), storeId: (string), value: (optional string), session: (optional boolean), expirationDate: (optional double), path: (optional string), httpOnly: (optional boolean), secure: (optional boolean)} 339 | ///function( Cookie cookie) {...} ; 340 | }, 341 | getAll: function (details, callback) { 342 | ///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. 343 | ///Information to filter the cookies being retrieved.{domain: (optional string), name: (string), url: (string), storeId: (string), value: (optional string), session: (optional boolean), expirationDate: (optional double), path: (optional string), httpOnly: (optional boolean), secure: (optional boolean)} 344 | ///function(array of Cookie cookies) {...} ; 345 | }, 346 | getAllCookieStores: function (callback) { 347 | ///Lists all existing cookie stores. 348 | ///function(array of CookieStore cookieStores) {...} ; 349 | }, 350 | onChanged: { 351 | addListener: function (callback) { 352 | ///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\. 353 | ///function(object changeInfo) {...} ; 354 | } 355 | }, 356 | remove: function (details, callback) { 357 | ///Deletes a cookie by name. 358 | ///Information to identify the cookie to remove.{domain: (optional string), name: (string), url: (string), storeId: (string), value: (optional string), session: (optional boolean), expirationDate: (optional double), path: (optional string), httpOnly: (optional boolean), secure: (optional boolean)} 359 | /// (optional) function(object details) {...} ; 360 | }, 361 | set: function (details, callback) { 362 | ///Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. 363 | ///Details about the cookie being set.{domain: (optional string), name: (string), url: (string), storeId: (string), value: (optional string), session: (optional boolean), expirationDate: (optional double), path: (optional string), httpOnly: (optional boolean), secure: (optional boolean)} 364 | /// (optional) function( Cookie cookie) {...} ; 365 | } 366 | }, 367 | debugger: { 368 | attach: function (target, requiredVersion, callback) { 369 | ///Attaches debugger to the given target. 370 | ///Debugging target to which you want to attach. 371 | ///None 372 | /// (optional) function() {...} ; 373 | }, 374 | detach: function (target, callback) { 375 | ///Detaches debugger from the given target. 376 | ///Debugging target from which you want to detach. 377 | /// (optional) function() {...} ; 378 | }, 379 | getTargets: function (callback) { 380 | ///Returns the list of available debug targets. 381 | ///function(array of TargetInfo result) {...} ; 382 | }, 383 | onDetach: { 384 | addListener: function (callback) { 385 | ///Fired when browser terminates debugging session for the tab. This happens when either the tab is being closed or Chrome DevTools is being invoked for the attached tab. 386 | ///function( Debuggee source, enum of \target_closed\ , \canceled_by_user\ , or \replaced_with_devtools\ reason) {...} ; 387 | } 388 | }, 389 | onEvent: { 390 | addListener: function (callback) { 391 | ///Fired whenever debugging target issues instrumentation event. 392 | ///function( Debuggee source, string method, object params) {...} ; 393 | } 394 | }, 395 | sendCommand: function (target, method, commandParams, callback) { 396 | ///Sends given command to the debugging target. 397 | ///Debugging target to which you want to send the command. 398 | ///None 399 | /// (optional) JSON object with request parameters. This object must conform to the remote debugging params scheme for given method. 400 | /// (optional) function(object result) {...} ; 401 | } 402 | }, 403 | devtools: { 404 | inspectedWindow: { 405 | eval: function (expression, callback) { 406 | ///Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. 407 | ///An expression to evaluate. 408 | /// (optional) function(object result, boolean isException) {...} ; 409 | }, 410 | getResources: function (callback) { 411 | ///Retrieves the list of resources from the inspected page. 412 | ///function(array of Resource resources) {...} ; 413 | }, 414 | onResourceAdded: { 415 | addListener: function (callback) { 416 | ///Fired when a new resource is added to the inspected page. 417 | ///function( Resource resource) {...} ; 418 | } 419 | }, 420 | onResourceContentCommitted: { 421 | addListener: function (callback) { 422 | ///Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools). 423 | ///function( Resource resource, string content) {...} ; 424 | } 425 | }, 426 | reload: function (reloadOptions) { 427 | ///Reloads the inspected page. 428 | /// (optional) {userAgent: (optional string), ignoreCache: (optional boolean), injectedScript: (optional string)} 429 | } 430 | }, 431 | network: { 432 | getHAR: function (callback) { 433 | ///Returns HAR log that contains all known network requests. 434 | ///function(object harLog) {...} ; 435 | }, 436 | onNavigated: { 437 | addListener: function (callback) { 438 | ///Fired when the inspected window navigates to a new page. 439 | ///function(string url) {...} ; 440 | } 441 | }, 442 | onRequestFinished: { 443 | addListener: function (callback) { 444 | ///Fired when a network request is finished and all request data are available. 445 | ///function( Request request) {...} ; 446 | } 447 | } 448 | }, 449 | panels: { 450 | create: function (title, iconPath, pagePath, callback) { 451 | ///Creates an extension panel. 452 | ///Title that is displayed next to the extension icon in the Developer Tools toolbar. 453 | ///Path of the panel's icon relative to the extension directory. 454 | ///Path of the panel's HTML page relative to the extension directory. 455 | /// (optional) function( ExtensionPanel panel) {...} ; 456 | }, 457 | setOpenResourceHandler: function (callback) { 458 | ///Specifies the function to be called when the user clicks a resource link in the Developer Tools window. To unset the handler, either call the method with no parameters or pass null as the parameter. 459 | /// (optional) function( devtools.inspectedWindow.Resource resource) {...} ; 460 | } 461 | } 462 | }, 463 | downloads: { 464 | acceptDanger: function (downloadId, callback) { 465 | ///Prompt the user to accept a dangerous download. Does not automatically accept dangerous downloads. If the download is accepted, then an onChanged event will fire, otherwise nothing will happen. When all the data is fetched into a temporary file and either the download is not dangerous or the danger has been accepted, then the temporary file is renamed to the target filename, the |state| changes to 'complete', and onChanged fires. 466 | ///None 467 | /// (optional) function() {...} ; 468 | }, 469 | cancel: function (downloadId, callback) { 470 | ///Cancel a download. When callback is run, the download is cancelled, completed, interrupted or doesn't exist anymore. 471 | ///The id of the download to cancel. 472 | /// (optional) function() {...} ; 473 | }, 474 | download: function (options, callback) { 475 | ///Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the specified filename . If the download started successfully, callback will be called with the new DownloadItem 's downloadId . If there was an error starting the download, then callback will be called with downloadId=undefined and runtime.lastError will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. Extensions must not parse it. 476 | ///What to download and how.{body: (optional string), saveAs: (optional boolean), url: (string), filename: (optional string), headers: (optional arrayofobject), method: (optional enumof \\GET\\ ,or \\POST\\ ), conflictAction: (optional FilenameConflictAction ), size: (optional integer)} 477 | /// (optional) function(integer downloadId) {...} ; 478 | }, 479 | drag: function (downloadId) { 480 | ///Initiate dragging the downloaded file to another application. Call in a javascript ondragstart handler. 481 | /// 482 | }, 483 | erase: function (query, callback) { 484 | ///Erase matching DownloadItem from history without deleting the downloaded file. An onErased event will fire for each DownloadItem that matches query , then callback will be called. 485 | ///{orderBy: (optional arrayofstring), urlRegex: (optional string), endedBefore: (optional string), totalBytesGreater: (optional integer), danger: (optional DangerType ), totalBytes: (optional integer), paused: (optional boolean), filenameRegex: (optional string), query: (optional arrayofstring), totalBytesLess: (optional integer), id: (optional integer), bytesReceived: (optional integer), exists: (optional boolean), endedAfter: (optional string), filename: (optional string), state: (optional State ), startedAfter: (optional string), mime: (optional string), fileSize: (optional integer), startTime: (optional string), url: (optional string), startedBefore: (optional string), limit: (optional integer), error: (optional InterruptReason ), endTime: (optional string)} 486 | /// (optional) function(array of integer erasedIds) {...} ; 487 | }, 488 | getFileIcon: function (downloadId, options, callback) { 489 | ///Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message. 490 | ///The identifier for the download. 491 | /// (optional) {body: (optional string), saveAs: (optional boolean), url: (string), filename: (optional string), headers: (optional arrayofobject), method: (optional enumof \\GET\\ ,or \\POST\\ ), conflictAction: (optional FilenameConflictAction ), size: (optional integer)} 492 | ///function(string iconURL) {...} ; 493 | }, 494 | onChanged: { 495 | addListener: function (callback) { 496 | ///When any of a DownloadItem 's properties except bytesReceived and estimatedEndTime changes, this event fires with the downloadId and an object containing the properties that changed. 497 | ///function(object downloadDelta) {...} ; 498 | } 499 | }, 500 | onCreated: { 501 | addListener: function (callback) { 502 | ///This event fires with the DownloadItem object when a download begins. 503 | ///function( DownloadItem downloadItem) {...} ; 504 | } 505 | }, 506 | onDeterminingFilename: { 507 | addListener: function (callback) { 508 | ///During the filename determination process, extensions will be given the opportunity to override the target DownloadItem.filename . Each extension may not register more than one listener for this event. Each listener must call suggest exactly once, either synchronously or asynchronously. If the listener calls suggest asynchronously, then it must return true . If the listener neither calls suggest synchronously nor returns true , then suggest will be called automatically. The DownloadItem will not complete until all listeners have called suggest . Listeners may call suggest without any arguments in order to allow the download to use downloadItem.filename for its filename, or pass a suggestion object to suggest in order to override the target filename. If more than one extension overrides the filename, then the last extension installed whose listener passes a suggestion object to suggest wins. In order to avoid confusion regarding which extension will win, users should not install extensions that may conflict. If the download is initiated by download and the target filename is known before the MIME type and tentative filename have been determined, pass filename to download instead. 509 | ///function( DownloadItem downloadItem, function suggest) {...} ; 510 | } 511 | }, 512 | onErased: { 513 | addListener: function (callback) { 514 | ///Fires with the downloadId when a download is erased from history. 515 | ///function(integer downloadId) {...} ; 516 | } 517 | }, 518 | open: function (downloadId) { 519 | ///Open the downloaded file now if the DownloadItem is complete; otherwise returns an error through runtime.lastError . Requires the \downloads.open\ permission in addition to the \downloads\ permission. An onChanged event will fire when the item is opened for the first time. 520 | ///The identifier for the downloaded file. 521 | }, 522 | pause: function (downloadId, callback) { 523 | ///Pause the download. If the request was successful the download is in a paused state. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active. 524 | ///The id of the download to pause. 525 | /// (optional) function() {...} ; 526 | }, 527 | removeFile: function (downloadId, callback) { 528 | ///Remove the downloaded file if it exists and the DownloadItem is complete; otherwise return an error through runtime.lastError . 529 | /// 530 | /// (optional) function() {...} ; 531 | }, 532 | resume: function (downloadId, callback) { 533 | ///Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active. 534 | ///The id of the download to resume. 535 | /// (optional) function() {...} ; 536 | }, 537 | search: function (query, callback) { 538 | ///Find DownloadItem . Set query to the empty object to get all DownloadItem . To get a specific DownloadItem , set only the id field. To page through a large number of items, set orderBy: ['-startTime'] , set limit to the number of items per page, and set startedAfter to the startTime of the last item from the last page. 539 | ///{orderBy: (optional arrayofstring), urlRegex: (optional string), endedBefore: (optional string), totalBytesGreater: (optional integer), danger: (optional DangerType ), totalBytes: (optional integer), paused: (optional boolean), filenameRegex: (optional string), query: (optional arrayofstring), totalBytesLess: (optional integer), id: (optional integer), bytesReceived: (optional integer), exists: (optional boolean), endedAfter: (optional string), filename: (optional string), state: (optional State ), startedAfter: (optional string), mime: (optional string), fileSize: (optional integer), startTime: (optional string), url: (optional string), startedBefore: (optional string), limit: (optional integer), error: (optional InterruptReason ), endTime: (optional string)} 540 | ///function(array of DownloadItem results) {...} ; 541 | }, 542 | setShelfEnabled: function (enabled) { 543 | ///Enable or disable the gray shelf at the bottom of every window associated with the current browser profile. The shelf will be disabled as long as at least one extension has disabled it. Enabling the shelf while at least one other extension has disabled it will return an error through runtime.lastError . Requires the \downloads.shelf\ permission in addition to the \downloads\ permission. 544 | /// 545 | }, 546 | show: function (downloadId) { 547 | ///Show the downloaded file in its folder in a file manager. 548 | ///The identifier for the downloaded file. 549 | }, 550 | showDefaultFolder: function () { } 551 | }, 552 | events: { 553 | addListener: function (callback) { 554 | ///Registers an event listener callback to an event. 555 | ///function() {...} 556 | }, 557 | removeListener: function (callback) { 558 | ///Deregisters an event listener callback from an event. 559 | ///function() {...} 560 | }, 561 | hasListener: function (callback) { 562 | ///Tests that a specific event listener callback is registered. 563 | ///function() {...} 564 | }, 565 | hasListeners: function () { 566 | ///Tests that an event listener callback is registered. 567 | }, 568 | addRules: function (rules, callback) { 569 | ///Registers rules to handle events. 570 | ///Rules to be registered. These do not replace previously registered rules. 571 | ///function(array of Rule rules) {...} 572 | }, 573 | getRules: function (ruleIdentifiers, callback) { 574 | ///Returns currently registered rules. 575 | /// (optional) If an array is passed, only rules with identifiers contained in this array are returned. 576 | ///function(array of Rule rules) {...} 577 | }, 578 | removeRules: function (ruleIdentifiers, callback) { 579 | ///Unregisters currently registered rules. 580 | ///(optional) Rules to be registered. These do not replace previously registered rules. 581 | ///function() {...} 582 | } 583 | }, 584 | extension: { 585 | getBackgroundPage: function () { }, 586 | getExtensionTabs: function (windowId) { 587 | ///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. 588 | /// (optional) 589 | }, 590 | getURL: function (path) { 591 | ///Converts a relative path within an extension install directory to a fully-qualified URL. 592 | ///A path to a resource within an extension expressed relative to its install directory. 593 | }, 594 | getViews: function (fetchProperties) { 595 | ///Returns an array of the JavaScript 'window' objects for each of the pages running inside the current extension. 596 | /// (optional) {windowId: (optional integer), type: (optional enumof \\tab\\ , \\infobar\\ , \\notification\\ ,or \\popup\\ )} 597 | }, 598 | isAllowedFileSchemeAccess: function (callback) { 599 | ///Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow access to File URLs' checkbox. 600 | ///function(boolean isAllowedAccess) {...} ; 601 | }, 602 | isAllowedIncognitoAccess: function (callback) { 603 | ///Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox. 604 | ///function(boolean isAllowedAccess) {...} ; 605 | }, 606 | onRequest: { 607 | addListener: function (callback) { 608 | /// 609 | ///function(any request, runtime.MessageSender sender, function sendResponse) {...} ; 610 | } 611 | }, 612 | onRequestExternal: { 613 | addListener: function (callback) { 614 | /// 615 | ///function(any request, runtime.MessageSender sender, function sendResponse) {...} ; 616 | } 617 | }, 618 | sendRequest: function (extensionId, request, responseCallback) { 619 | ///Sends a single request to other listeners within the extension. Similar to runtime.connect , but only sends a single request with an optional response. The onRequest event is fired in each page of the extension. 620 | /// (optional) The extension ID of the extension you want to connect to. If omitted, default is your own extension. 621 | /// 622 | /// (optional) 623 | }, 624 | setUpdateUrlData: function (data) { 625 | ///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. 626 | /// 627 | } 628 | }, 629 | fileBrowserHandler: { 630 | onExecute: { 631 | addListener: function (callback) { 632 | ///Fired when file system action is executed from ChromeOS file browser. 633 | ///function(string id, FileHandlerExecuteEventDetails details) {...} ; 634 | } 635 | }, 636 | selectFile: function (selectionParams, callback) { 637 | ///Prompts user to select file path under which file should be saved. When the file is selected, file access permission required to use the file (read, write and create) are granted to the caller. The file will not actually get created during the function call, so function caller must ensure its existence before using it. The function has to be invoked with a user gesture. 638 | ///Parameters that will be used while selecting the file.{allowedFileExtensions: (optional arrayofstring), suggestedName: (string)} 639 | ///function(object result) {...} ; 640 | } 641 | }, 642 | fontSettings: { 643 | clearDefaultFixedFontSize: function (details, callback) { 644 | ///Clears the default fixed font size set by this extension, if any. 645 | /// (optional) This parameter is currently unused.{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 646 | /// (optional) function() {...} ; 647 | }, 648 | clearDefaultFontSize: function (details, callback) { 649 | ///Clears the default font size set by this extension, if any. 650 | /// (optional) This parameter is currently unused.{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 651 | /// (optional) function() {...} ; 652 | }, 653 | clearFont: function (details, callback) { 654 | ///Clears the font set by this extension, if any. 655 | ///{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 656 | /// (optional) function() {...} ; 657 | }, 658 | clearMinimumFontSize: function (details, callback) { 659 | ///Clears the minimum font size set by this extension, if any. 660 | /// (optional) This parameter is currently unused.{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 661 | /// (optional) function() {...} ; 662 | }, 663 | getDefaultFixedFontSize: function (details, callback) { 664 | ///Gets the default size for fixed width fonts. 665 | /// (optional) This parameter is currently unused.{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 666 | /// (optional) function(object details) {...} ; 667 | }, 668 | getDefaultFontSize: function (details, callback) { 669 | ///Gets the default font size. 670 | /// (optional) This parameter is currently unused.{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 671 | /// (optional) function(object details) {...} ; 672 | }, 673 | getFont: function (details, callback) { 674 | ///Gets the font for a given script and generic font family. 675 | ///{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 676 | /// (optional) function(object details) {...} ; 677 | }, 678 | getFontList: function (callback) { 679 | ///Gets a list of fonts on the system. 680 | ///function(array of FontName results) {...} ; 681 | }, 682 | getMinimumFontSize: function (details, callback) { 683 | ///Gets the minimum font size. 684 | /// (optional) This parameter is currently unused.{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 685 | /// (optional) function(object details) {...} ; 686 | }, 687 | onDefaultFixedFontSizeChanged: { 688 | addListener: function (callback) { 689 | ///Fired when the default fixed font size setting changes. 690 | ///function(object details) {...} ; 691 | } 692 | }, 693 | onDefaultFontSizeChanged: { 694 | addListener: function (callback) { 695 | ///Fired when the default font size setting changes. 696 | ///function(object details) {...} ; 697 | } 698 | }, 699 | onFontChanged: { 700 | addListener: function (callback) { 701 | ///Fired when a font setting changes. 702 | ///function(object details) {...} ; 703 | } 704 | }, 705 | onMinimumFontSizeChanged: { 706 | addListener: function (callback) { 707 | ///Fired when the minimum font size setting changes. 708 | ///function(object details) {...} ; 709 | } 710 | }, 711 | setDefaultFixedFontSize: function (details, callback) { 712 | ///Sets the default size for fixed width fonts. 713 | ///{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 714 | /// (optional) function() {...} ; 715 | }, 716 | setDefaultFontSize: function (details, callback) { 717 | ///Sets the default font size. 718 | ///{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 719 | /// (optional) function() {...} ; 720 | }, 721 | setFont: function (details, callback) { 722 | ///Sets the font for a given script and generic font family. 723 | ///{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 724 | /// (optional) function() {...} ; 725 | }, 726 | setMinimumFontSize: function (details, callback) { 727 | ///Sets the minimum font size. 728 | ///{levelOfControl: ( LevelOfControl ), pixelSize: (integer), fontId: (string), genericFamily: ( GenericFamily ), script: (optional ScriptCode )} 729 | /// (optional) function() {...} ; 730 | } 731 | }, 732 | history: { 733 | addUrl: function (details, callback) { 734 | ///Adds a URL to the history at the current time with a transition type of \link\. 735 | ///{url: (string)} 736 | /// (optional) function() {...} ; 737 | }, 738 | deleteAll: function (callback) { 739 | ///Deletes all items from the history. 740 | ///function() {...} ; 741 | }, 742 | deleteRange: function (range, callback) { 743 | ///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. 744 | ///{endTime: (double), startTime: (double)} 745 | ///function() {...} ; 746 | }, 747 | deleteUrl: function (details, callback) { 748 | ///Removes all occurrences of the given URL from the history. 749 | ///{url: (string)} 750 | /// (optional) function() {...} ; 751 | }, 752 | getVisits: function (details, callback) { 753 | ///Retrieves information about visits to a URL. 754 | ///{url: (string)} 755 | ///function(array of VisitItem results) {...} ; 756 | }, 757 | onVisitRemoved: { 758 | addListener: function (callback) { 759 | ///Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history. 760 | ///function(object removed) {...} ; 761 | } 762 | }, 763 | onVisited: { 764 | addListener: function (callback) { 765 | ///Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded. 766 | ///function( HistoryItem result) {...} ; 767 | } 768 | }, 769 | search: function (query, callback) { 770 | ///Searches the history for the last visit time of each page matching the query. 771 | ///{text: (string), endTime: (optional double), maxResults: (optional integer), startTime: (optional double)} 772 | ///function(array of HistoryItem results) {...} ; 773 | } 774 | }, 775 | i18n: { 776 | getAcceptLanguages: function (callback) { 777 | ///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 . 778 | ///function(array of string languages) {...} ; 779 | }, 780 | getMessage: function (messageName, substitutions) { 781 | ///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 \u2014 for example, messageName is not a string or the substitutions array has more than 9 elements \u2014 this method returns undefined . 782 | ///None 783 | /// (optional) Up to 9 substitution strings, if the message requires any. 784 | } 785 | }, 786 | identity: { 787 | getAuthToken: function (details, callback) { 788 | ///Gets an OAuth2 access token using the client ID and scopes specified in the oauth2 section of manifest.json . The Identity API caches access tokens in memory, so it's ok to call getAuthToken any time a token is required. The token cache automatically handles expiration. 789 | /// (optional) Token options.{url: (string), token: (string), interactive: (optional boolean)} 790 | ///function(string token) {...} ; 791 | }, 792 | getRedirectURL: function (path) { 793 | ///Generates a redirect URL to be used in |launchWebAuthFlow|. The generated URLs match the pattern https://.chromiumapp.org/* . 794 | /// (optional) The path appended to the end of the generated URL. 795 | }, 796 | launchWebAuthFlow: function (details, callback) { 797 | ///Starts an auth flow at the specified URL. This method enables auth flows with non-Google identity providers by launching a web view and navigating it to the first URL in the provider's auth flow. When the provider redirects to a URL matching the pattern https://.chromiumapp.org/* , the window will close, and the final redirect URL will be passed to the callback function. 798 | ///WebAuth flow options.{url: (string), token: (string), interactive: (optional boolean)} 799 | ///function(string responseUrl) {...} ; 800 | }, 801 | onSignInChanged: { 802 | addListener: function (callback) { 803 | ///Fired when signin state changes for an account on the user's profile. 804 | ///function(object account, boolean signedIn) {...} ; 805 | } 806 | }, 807 | removeCachedAuthToken: function (details, callback) { 808 | ///Removes an OAuth2 access token from the Identity API's token cache. If an access token is discovered to be invalid, it should be passed to removeCachedAuthToken to remove it from the cache. The app may then retrieve a fresh token with getAuthToken . 809 | ///Token information.{url: (string), token: (string), interactive: (optional boolean)} 810 | ///function() {...} ; 811 | } 812 | }, 813 | idle: { 814 | onStateChanged: { 815 | addListener: function (callback) { 816 | ///Fired when the system changes to an active, idle or locked state. The event fires with \locked\ if the screen is locked or the screensaver activates, \idle\ if the system is unlocked and the user has not generated any input for a specified number of seconds, and \active\ when the user generates input on an idle system. 817 | ///function(enum of \active\ , \idle\ , or \locked\ newState) {...} ; 818 | } 819 | }, 820 | queryState: function (detectionIntervalInSeconds, callback) { 821 | ///Returns \locked\ if the system is locked, \idle\ if the user has not generated any input for a specified number of seconds, or \active\ otherwise. 822 | ///The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected. 823 | ///function(enum of \active\ , \idle\ , or \locked\ newState) {...} ; 824 | }, 825 | setDetectionInterval: function (intervalInSeconds) { 826 | ///Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds. 827 | ///Threshold, in seconds, used to determine when the system is in an idle state. 828 | } 829 | }, 830 | input: { 831 | ime: { 832 | clearComposition: function (parameters, callback) { 833 | ///Clear the current composition. If this extension does not own the active IME, this fails. 834 | ///{contextID: (integer), text: (string), segments: (optional arrayofobject), offset: (integer), properties: (object), cursor: (integer), length: (integer), candidateID: (integer), selectionStart: (optional integer), selectionEnd: (optional integer), items: (arrayof MenuItem ), candidates: (arrayofobject), engineID: (string)} 835 | /// (optional) function(boolean success) {...} ; 836 | }, 837 | commitText: function (parameters, callback) { 838 | ///Commits the provided text to the current input. 839 | ///{contextID: (integer), text: (string), segments: (optional arrayofobject), offset: (integer), properties: (object), cursor: (integer), length: (integer), candidateID: (integer), selectionStart: (optional integer), selectionEnd: (optional integer), items: (arrayof MenuItem ), candidates: (arrayofobject), engineID: (string)} 840 | /// (optional) function(boolean success) {...} ; 841 | }, 842 | deleteSurroundingText: function (parameters, callback) { 843 | ///Deletes the text around the caret. 844 | ///{contextID: (integer), text: (string), segments: (optional arrayofobject), offset: (integer), properties: (object), cursor: (integer), length: (integer), candidateID: (integer), selectionStart: (optional integer), selectionEnd: (optional integer), items: (arrayof MenuItem ), candidates: (arrayofobject), engineID: (string)} 845 | /// (optional) function() {...} ; 846 | }, 847 | keyEventHandled: function (requestId, response) { 848 | ///Indicates that the key event received by onKeyEvent is handled. This should only be called if the onKeyEvent listener is asynchronous. 849 | ///Request id of the event that was handled. This should come from keyEvent.requestId 850 | ///True if the keystroke was handled, false if not 851 | }, 852 | onActivate: { 853 | addListener: function (callback) { 854 | ///This event is sent when an IME is activated. It signals that the IME will be receiving onKeyPress events. 855 | ///function(string engineID) {...} ; 856 | } 857 | }, 858 | onBlur: { 859 | addListener: function (callback) { 860 | ///This event is sent when focus leaves a text box. It is sent to all extensions that are listening to this event, and enabled by the user. 861 | ///function(integer contextID) {...} ; 862 | } 863 | }, 864 | onCandidateClicked: { 865 | addListener: function (callback) { 866 | ///This event is sent if this extension owns the active IME. 867 | ///function(string engineID, integer candidateID, enum of \left\ , \middle\ , or \right\ button) {...} ; 868 | } 869 | }, 870 | onDeactivated: { 871 | addListener: function (callback) { 872 | ///This event is sent when an IME is deactivated. It signals that the IME will no longer be receiving onKeyPress events. 873 | ///function(string engineID) {...} ; 874 | } 875 | }, 876 | onFocus: { 877 | addListener: function (callback) { 878 | ///This event is sent when focus enters a text box. It is sent to all extensions that are listening to this event, and enabled by the user. 879 | ///function( InputContext context) {...} ; 880 | } 881 | }, 882 | onInputContextUpdate: { 883 | addListener: function (callback) { 884 | ///This event is sent when the properties of the current InputContext change, such as the the type. It is sent to all extensions that are listening to this event, and enabled by the user. 885 | ///function( InputContext context) {...} ; 886 | } 887 | }, 888 | onKeyEvent: { 889 | addListener: function (callback) { 890 | ///This event is sent if this extension owns the active IME. 891 | ///function(string engineID, KeyboardEvent keyData) {...} ; 892 | } 893 | }, 894 | onMenuItemActivated: { 895 | addListener: function (callback) { 896 | ///Called when the user selects a menu item 897 | ///function(string engineID, string name) {...} ; 898 | } 899 | }, 900 | onReset: { 901 | addListener: function (callback) { 902 | ///This event is sent when chrome terminates ongoing text input session. 903 | ///function(string engineID) {...} ; 904 | } 905 | }, 906 | onSurroundingTextChanged: { 907 | addListener: function (callback) { 908 | ///Called when the editable string around caret is changed or when the caret position is moved. The text length is limited to 100 characters for each back and forth direction. 909 | ///function(string engineID, object surroundingInfo) {...} ; 910 | } 911 | }, 912 | setCandidateWindowProperties: function (parameters, callback) { 913 | ///Sets the properties of the candidate window. This fails if the extension doesn\u2019t own the active IME 914 | ///{contextID: (integer), text: (string), segments: (optional arrayofobject), offset: (integer), properties: (object), cursor: (integer), length: (integer), candidateID: (integer), selectionStart: (optional integer), selectionEnd: (optional integer), items: (arrayof MenuItem ), candidates: (arrayofobject), engineID: (string)} 915 | /// (optional) function(boolean success) {...} ; 916 | }, 917 | setCandidates: function (parameters, callback) { 918 | ///Sets the current candidate list. This fails if this extension doesn\u2019t own the active IME 919 | ///{contextID: (integer), text: (string), segments: (optional arrayofobject), offset: (integer), properties: (object), cursor: (integer), length: (integer), candidateID: (integer), selectionStart: (optional integer), selectionEnd: (optional integer), items: (arrayof MenuItem ), candidates: (arrayofobject), engineID: (string)} 920 | /// (optional) function(boolean success) {...} ; 921 | }, 922 | setComposition: function (parameters, callback) { 923 | ///Set the current composition. If this extension does not own the active IME, this fails. 924 | ///{contextID: (integer), text: (string), segments: (optional arrayofobject), offset: (integer), properties: (object), cursor: (integer), length: (integer), candidateID: (integer), selectionStart: (optional integer), selectionEnd: (optional integer), items: (arrayof MenuItem ), candidates: (arrayofobject), engineID: (string)} 925 | /// (optional) function(boolean success) {...} ; 926 | }, 927 | setCursorPosition: function (parameters, callback) { 928 | ///Set the position of the cursor in the candidate window. This is a no-op if this extension does not own the active IME. 929 | ///{contextID: (integer), text: (string), segments: (optional arrayofobject), offset: (integer), properties: (object), cursor: (integer), length: (integer), candidateID: (integer), selectionStart: (optional integer), selectionEnd: (optional integer), items: (arrayof MenuItem ), candidates: (arrayofobject), engineID: (string)} 930 | /// (optional) function(boolean success) {...} ; 931 | }, 932 | setMenuItems: function (parameters, callback) { 933 | ///Adds the provided menu items to the language menu when this IME is active. 934 | ///{contextID: (integer), text: (string), segments: (optional arrayofobject), offset: (integer), properties: (object), cursor: (integer), length: (integer), candidateID: (integer), selectionStart: (optional integer), selectionEnd: (optional integer), items: (arrayof MenuItem ), candidates: (arrayofobject), engineID: (string)} 935 | /// (optional) function() {...} ; 936 | }, 937 | updateMenuItems: function (parameters, callback) { 938 | ///Updates the state of the MenuItems specified 939 | ///{contextID: (integer), text: (string), segments: (optional arrayofobject), offset: (integer), properties: (object), cursor: (integer), length: (integer), candidateID: (integer), selectionStart: (optional integer), selectionEnd: (optional integer), items: (arrayof MenuItem ), candidates: (arrayofobject), engineID: (string)} 940 | /// (optional) function() {...} ; 941 | } 942 | } 943 | }, 944 | management: { 945 | get: function (id, callback) { 946 | ///Returns information about the installed extension, app, or theme that has the given ID. 947 | ///None 948 | /// (optional) function( ExtensionInfo result) {...} ; 949 | }, 950 | getAll: function (callback) { 951 | ///Returns a list of information about installed extensions and apps. 952 | /// (optional) function(array of ExtensionInfo result) {...} ; 953 | }, 954 | getPermissionWarningsById: function (id, callback) { 955 | ///Returns a list of permission warnings for the given extension id. 956 | ///The ID of an already installed extension. 957 | /// (optional) function(array of string permissionWarnings) {...} ; 958 | }, 959 | getPermissionWarningsByManifest: function (manifestStr, callback) { 960 | ///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. 961 | ///Extension manifest JSON string. 962 | /// (optional) function(array of string permissionWarnings) {...} ; 963 | }, 964 | launchApp: function (id, callback) { 965 | ///Launches an application. 966 | ///The extension id of the application. 967 | /// (optional) function() {...} ; 968 | }, 969 | onDisabled: { 970 | addListener: function (callback) { 971 | ///Fired when an app or extension has been disabled. 972 | ///function( ExtensionInfo info) {...} ; 973 | } 974 | }, 975 | onEnabled: { 976 | addListener: function (callback) { 977 | ///Fired when an app or extension has been enabled. 978 | ///function( ExtensionInfo info) {...} ; 979 | } 980 | }, 981 | onInstalled: { 982 | addListener: function (callback) { 983 | ///Fired when an app or extension has been installed. 984 | ///function( ExtensionInfo info) {...} ; 985 | } 986 | }, 987 | onUninstalled: { 988 | addListener: function (callback) { 989 | ///Fired when an app or extension has been uninstalled. 990 | ///function(string id) {...} ; 991 | } 992 | }, 993 | setEnabled: function (id, enabled, callback) { 994 | ///Enables or disables an app or extension. 995 | ///None 996 | ///Whether this item should be enabled or disabled. 997 | /// (optional) function() {...} ; 998 | }, 999 | uninstall: function (id, options, callback) { 1000 | ///Uninstalls a currently installed app or extension. 1001 | ///None 1002 | /// (optional) {showConfirmDialog: (optional boolean)} 1003 | /// (optional) function() {...} ; 1004 | }, 1005 | uninstallSelf: function (options, callback) { 1006 | ///Uninstalls the calling extension. Note: This function can be used without requesting the 'management' permission in the manifest. 1007 | /// (optional) {showConfirmDialog: (optional boolean)} 1008 | /// (optional) function() {...} ; 1009 | } 1010 | }, 1011 | notifications: { 1012 | clear: function (notificationId, callback) { 1013 | ///Clears the specified notification. 1014 | ///None 1015 | ///function(boolean wasCleared) {...} ; 1016 | }, 1017 | create: function (notificationId, options, callback) { 1018 | ///Creates and displays a notification. 1019 | ///Identifier of the notification. If it is empty, this method generates an id. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. 1020 | ///Contents of the notification. 1021 | ///function(string notificationId) {...} ; 1022 | }, 1023 | getAll: function (callback) { 1024 | ///Retrieves all the notifications. 1025 | ///function(object notifications) {...} ; 1026 | }, 1027 | getPermissionLevel: function (callback) { 1028 | ///Retrieves whether the user has enabled notifications from this app or extension. 1029 | ///function( PermissionLevel level) {...} ; 1030 | }, 1031 | onButtonClicked: { 1032 | addListener: function (callback) { 1033 | ///The user pressed a button in the notification. 1034 | ///function(string notificationId, integer buttonIndex) {...} ; 1035 | } 1036 | }, 1037 | onClicked: { 1038 | addListener: function (callback) { 1039 | ///The user clicked in a non-button area of the notification. 1040 | ///function(string notificationId) {...} ; 1041 | } 1042 | }, 1043 | onClosed: { 1044 | addListener: function (callback) { 1045 | ///The notification closed, either by the system or by user action. 1046 | ///function(string notificationId, boolean byUser) {...} ; 1047 | } 1048 | }, 1049 | onPermissionLevelChanged: { 1050 | addListener: function (callback) { 1051 | ///The user changes the permission level. 1052 | ///function( PermissionLevel level) {...} ; 1053 | } 1054 | }, 1055 | onShowSettings: { 1056 | addListener: function (callback) { 1057 | ///The user clicked on a link for the app's notification settings. 1058 | ///function() {...} ; 1059 | } 1060 | }, 1061 | update: function (notificationId, options, callback) { 1062 | ///Updates an existing notification. 1063 | ///None 1064 | ///Contents of the notification to update to. 1065 | ///function(boolean wasUpdated) {...} ; 1066 | } 1067 | }, 1068 | omnibox: { 1069 | onInputCancelled: { 1070 | addListener: function (callback) { 1071 | ///User has ended the keyword input session without accepting the input. 1072 | ///function() {...} ; 1073 | } 1074 | }, 1075 | onInputChanged: { 1076 | addListener: function (callback) { 1077 | ///User has changed what is typed into the omnibox. 1078 | ///function(string text, function suggest) {...} ; 1079 | } 1080 | }, 1081 | onInputEntered: { 1082 | addListener: function (callback) { 1083 | ///User has accepted what is typed into the omnibox. 1084 | ///function(string text, enum of \currentTab\ , \newForegroundTab\ , or \newBackgroundTab\ disposition) {...} ; 1085 | } 1086 | }, 1087 | onInputStarted: { 1088 | addListener: function (callback) { 1089 | ///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. 1090 | ///function() {...} ; 1091 | } 1092 | }, 1093 | setDefaultSuggestion: function (suggestion) { 1094 | ///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. 1095 | ///A partial SuggestResult object, without the 'content' parameter.{description: (string)} 1096 | } 1097 | }, 1098 | pageAction: { 1099 | getPopup: function (details, callback) { 1100 | ///Gets the html document set as the popup for this page action. 1101 | ///{popup: (string), iconIndex: (optional integer), imageData: (optional ImageDataType orobject), title: (string), tabId: (integer), path: (optional stringorobject)} 1102 | ///function(string result) {...} ; 1103 | }, 1104 | getTitle: function (details, callback) { 1105 | ///Gets the title of the page action. 1106 | ///{popup: (string), iconIndex: (optional integer), imageData: (optional ImageDataType orobject), title: (string), tabId: (integer), path: (optional stringorobject)} 1107 | ///function(string result) {...} ; 1108 | }, 1109 | hide: function (tabId) { 1110 | ///Hides the page action. 1111 | ///The id of the tab for which you want to modify the page action. 1112 | }, 1113 | onClicked: { 1114 | addListener: function (callback) { 1115 | ///Fired when a page action icon is clicked. This event will not fire if the page action has a popup. 1116 | ///function( tabs.Tab tab) {...} ; 1117 | } 1118 | }, 1119 | setIcon: function (details, callback) { 1120 | ///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, or as dictionary of either one of those. Either the path or the imageData property must be specified. 1121 | ///{popup: (string), iconIndex: (optional integer), imageData: (optional ImageDataType orobject), title: (string), tabId: (integer), path: (optional stringorobject)} 1122 | /// (optional) function() {...} ; 1123 | }, 1124 | setPopup: function (details) { 1125 | ///Sets the html document to be opened as a popup when the user clicks on the page action's icon. 1126 | ///{popup: (string), iconIndex: (optional integer), imageData: (optional ImageDataType orobject), title: (string), tabId: (integer), path: (optional stringorobject)} 1127 | }, 1128 | setTitle: function (details) { 1129 | ///Sets the title of the page action. This is displayed in a tooltip over the page action. 1130 | ///{popup: (string), iconIndex: (optional integer), imageData: (optional ImageDataType orobject), title: (string), tabId: (integer), path: (optional stringorobject)} 1131 | }, 1132 | show: function (tabId) { 1133 | ///Shows the page action. The page action is shown whenever the tab is selected. 1134 | ///The id of the tab for which you want to modify the page action. 1135 | } 1136 | }, 1137 | pageCapture: { 1138 | saveAsMHTML: function (details, callback) { 1139 | ///Saves the content of the tab with given id as MHTML. 1140 | ///{tabId: (integer)} 1141 | ///function(binary mhtmlData) {...} ; 1142 | } 1143 | }, 1144 | permissions: { 1145 | contains: function (permissions, callback) { 1146 | ///Checks if the extension has the specified permissions. 1147 | /// 1148 | ///function(boolean result) {...} ; 1149 | }, 1150 | getAll: function (callback) { 1151 | ///Gets the extension's current set of permissions. 1152 | ///function( Permissions permissions) {...} ; 1153 | }, 1154 | onAdded: { 1155 | addListener: function (callback) { 1156 | ///Fired when the extension acquires new permissions. 1157 | ///function( Permissions permissions) {...} ; 1158 | } 1159 | }, 1160 | onRemoved: { 1161 | addListener: function (callback) { 1162 | ///Fired when access to permissions has been removed from the extension. 1163 | ///function( Permissions permissions) {...} ; 1164 | } 1165 | }, 1166 | remove: function (permissions, callback) { 1167 | ///Removes access to the specified permissions. If there are any problems removing the permissions, runtime.lastError will be set. 1168 | /// 1169 | /// (optional) function(boolean removed) {...} ; 1170 | }, 1171 | request: function (permissions, callback) { 1172 | ///Requests access to the specified permissions. These permissions must be defined in the optional_permissions field of the manifest. If there are any problems requesting the permissions, runtime.lastError will be set. 1173 | /// 1174 | /// (optional) function(boolean granted) {...} ; 1175 | } 1176 | }, 1177 | power: { 1178 | releaseKeepAwake: function () { }, 1179 | requestKeepAwake: function (level) { 1180 | ///Requests that power management be temporarily disabled. |level| describes the degree to which power management should be disabled. If a request previously made by the same app is still active, it will be replaced by the new request. 1181 | /// 1182 | } 1183 | }, 1184 | privacy: { 1185 | network: {}, 1186 | services: {}, 1187 | websites: {} 1188 | }, 1189 | proxy: { 1190 | settings: {}, 1191 | onProxyError: { 1192 | addListener: function (callback) { 1193 | ///Notifies about proxy errors. 1194 | ///function(object details) {...} ; 1195 | } 1196 | } 1197 | }, 1198 | pushMessaging: { 1199 | getChannelId: function (interactive, callback) { 1200 | ///Retrieves the channel ID associated with this app or extension. Typically an app or extension will want to send this value to its application server so the server can use it to trigger push messages back to the app or extension. If the interactive flag is set, we will ask the user to log in when they are not already logged in. 1201 | /// (optional) 1202 | ///function(object channelId) {...} ; 1203 | }, 1204 | onMessage: { 1205 | addListener: function (callback) { 1206 | ///Fired when a push message has been received. 1207 | ///function(object message) {...} ; 1208 | } 1209 | } 1210 | }, 1211 | runtime: { 1212 | connect: function (extensionId, connectInfo) { 1213 | ///Attempts to connect to other listeners within the extension/app (such as the background page), or other extensions/apps. This is useful for content scripts connecting to their extension processes. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via tabs.connect . 1214 | /// (optional) The ID of the extension/app you want to connect to. If omitted, default is your own extension. 1215 | /// (optional) {includeTlsChannelId: (optional boolean), name: (optional string)} 1216 | }, 1217 | connectNative: function (application) { 1218 | ///Connects to a native application in the host machine. 1219 | ///The name of the registered application to connect to. 1220 | }, 1221 | getBackgroundPage: function (callback) { 1222 | ///Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set. 1223 | ///function(window backgroundPage) {...} ; 1224 | }, 1225 | getManifest: function () { }, 1226 | getPackageDirectoryEntry: function (callback) { 1227 | ///Returns a DirectoryEntry for the package directory. 1228 | ///function(directoryentry directoryEntry) {...} ; 1229 | }, 1230 | getPlatformInfo: function (callback) { 1231 | ///Returns information about the current platform. 1232 | ///function(object platformInfo) {...} ; 1233 | }, 1234 | getURL: function (path) { 1235 | ///Converts a relative path within an app/extension install directory to a fully-qualified URL. 1236 | ///A path to a resource within an app/extension expressed relative to its install directory. 1237 | }, 1238 | onBrowserUpdateAvailable: { 1239 | addListener: function (callback) { 1240 | /// 1241 | ///function() {...} ; 1242 | } 1243 | }, 1244 | onConnect: { 1245 | addListener: function (callback) { 1246 | ///Fired when a connection is made from either an extension process or a content script. 1247 | ///function( Port port) {...} ; 1248 | } 1249 | }, 1250 | onConnectExternal: { 1251 | addListener: function (callback) { 1252 | ///Fired when a connection is made from another extension. 1253 | ///function( Port port) {...} ; 1254 | } 1255 | }, 1256 | onInstalled: { 1257 | addListener: function (callback) { 1258 | ///Fired when the extension is first installed, when the extension is updated to a new version, and when Chrome is updated to a new version. 1259 | ///function(object details) {...} ; 1260 | } 1261 | }, 1262 | onMessage: { 1263 | addListener: function (callback) { 1264 | ///Fired when a message is sent from either an extension process or a content script. 1265 | ///function(any message, MessageSender sender, function sendResponse) {...} ; 1266 | } 1267 | }, 1268 | onMessageExternal: { 1269 | addListener: function (callback) { 1270 | ///Fired when a message is sent from another extension/app. Cannot be used in a content script. 1271 | ///function(any message, MessageSender sender, function sendResponse) {...} ; 1272 | } 1273 | }, 1274 | onRestartRequired: { 1275 | addListener: function (callback) { 1276 | ///Fired when an app or the device that it runs on needs to be restarted. The app should close all its windows at its earliest convenient time to let the restart to happen. If the app does nothing, a restart will be enforced after a 24-hour grace period has passed. Currently, this event is only fired for Chrome OS kiosk apps. 1277 | ///function(enum of \app_update\ , \os_update\ , or \periodic\ reason) {...} ; 1278 | } 1279 | }, 1280 | onStartup: { 1281 | addListener: function (callback) { 1282 | ///Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started, even if this extension is operating in 'split' incognito mode. 1283 | ///function() {...} ; 1284 | } 1285 | }, 1286 | onSuspend: { 1287 | addListener: function (callback) { 1288 | ///Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. 1289 | ///function() {...} ; 1290 | } 1291 | }, 1292 | onSuspendCanceled: { 1293 | addListener: function (callback) { 1294 | ///Sent after onSuspend to indicate that the app won't be unloaded after all. 1295 | ///function() {...} ; 1296 | } 1297 | }, 1298 | onUpdateAvailable: { 1299 | addListener: function (callback) { 1300 | ///Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call chrome.runtime.reload(). 1301 | ///function(object details) {...} ; 1302 | } 1303 | }, 1304 | reload: function () { }, 1305 | requestUpdateCheck: function (callback) { 1306 | ///Requests an update check for this app/extension. 1307 | ///function(enum of \throttled\ , \no_update\ , or \update_available\ status, object details) {...} ; 1308 | }, 1309 | restart: function () { }, 1310 | sendMessage: function (extensionId, message, options, responseCallback) { 1311 | ///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 . 1312 | /// (optional) The extension ID of the extension you want to connect to. If omitted, default is your own extension. 1313 | /// 1314 | /// (optional) {includeTlsChannelId: (optional boolean)} 1315 | /// (optional) 1316 | }, 1317 | sendNativeMessage: function (application, message, responseCallback) { 1318 | ///Send a single message to a native application. 1319 | ///The name of the native messaging host. 1320 | ///The message that will be passed to the native messaging host. 1321 | /// (optional) 1322 | }, 1323 | setUninstallUrl: function (url) { 1324 | ///Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 255 characters. 1325 | /// 1326 | } 1327 | }, 1328 | storage: { 1329 | onChanged: { 1330 | addListener: function (callback) { 1331 | ///Fired when one or more items change. 1332 | ///function(object changes, string areaName) {...} ; 1333 | } 1334 | } 1335 | }, 1336 | system: { 1337 | storage: { 1338 | ejectDevice: function (id, callback) { 1339 | ///Ejects a removable storage device. 1340 | /// 1341 | ///function(enum of \success\ , \in_use\ , \no_such_device\ , or \failure\ result) {...} ; 1342 | }, 1343 | getAvailableCapacity: function (id, callback) { 1344 | ///Get the available capacity of a specified |id| storage device. The |id| is the transient device ID from StorageUnitInfo. 1345 | /// 1346 | ///function(object info) {...} ; 1347 | }, 1348 | getInfo: function (callback) { 1349 | ///Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects. 1350 | ///function(array of StorageUnitInfo info) {...} ; 1351 | }, 1352 | onAttached: { 1353 | addListener: function (callback) { 1354 | ///Fired when a new removable storage is attached to the system. 1355 | ///function( StorageUnitInfo info) {...} ; 1356 | } 1357 | }, 1358 | onDetached: { 1359 | addListener: function (callback) { 1360 | ///Fired when a removable storage is detached from the system. 1361 | ///function(string id) {...} ; 1362 | } 1363 | } 1364 | } 1365 | }, 1366 | tabCapture: { 1367 | capture: function (options, callback) { 1368 | ///Captures the visible area of the currently active tab. This method can only be used on the currently active page after the extension has been invoked , similar to the way that activeTab works. 1369 | ///Configures the returned media stream.{audioConstraints: (optional MediaStreamConstraint ), audio: (optional boolean), video: (optional boolean), videoConstraints: (optional MediaStreamConstraint )} 1370 | ///function(localmediastream stream) {...} ; 1371 | }, 1372 | getCapturedTabs: function (callback) { 1373 | ///Returns a list of tabs that have requested capture or are being captured, i.e. status != stopped and status != error. This allows extensions to inform the user that there is an existing tab capture that would prevent a new tab capture from succeeding (or to prevent redundant requests for the same tab). 1374 | ///function(array of CaptureInfo result) {...} ; 1375 | }, 1376 | onStatusChanged: { 1377 | addListener: function (callback) { 1378 | ///Event fired when the capture status of a tab changes. This allows extension authors to keep track of the capture status of tabs to keep UI elements like page actions and infobars in sync. 1379 | ///function( CaptureInfo info) {...} ; 1380 | } 1381 | } 1382 | }, 1383 | tabs: { 1384 | captureVisibleTab: function (windowId, options, callback) { 1385 | ///Captures the visible area of the currently active tab in the specified window. You must have host permission for the URL displayed by the tab. 1386 | /// (optional) None 1387 | /// (optional) Set parameters of image capture, such as the format of the resulting image.{quality: (optional integer), format: (optional enumof \\jpeg\\ ,or \\png\\ )} 1388 | ///function(string dataUrl) {...} ; 1389 | }, 1390 | connect: function (tabId, connectInfo) { 1391 | ///Connects to the content script(s) in the specified tab. The runtime.onConnect event is fired in each content script running in the specified tab for the current extension. For more details, see Content Script Messaging . 1392 | /// 1393 | /// (optional) {name: (optional string)} 1394 | }, 1395 | create: function (createProperties, callback) { 1396 | ///Creates a new tab. 1397 | ///{index: (optional integer), openerTabId: (optional integer), url: (optional string), selected: (optional boolean), pinned: (optional boolean), windowId: (optional integer), active: (optional boolean)} 1398 | /// (optional) function( Tab tab) {...} ; 1399 | }, 1400 | detectLanguage: function (tabId, callback) { 1401 | ///Detects the primary language of the content in a tab. 1402 | /// (optional) None 1403 | ///function(string language) {...} ; 1404 | }, 1405 | duplicate: function (tabId, callback) { 1406 | ///Duplicates a tab. 1407 | ///The ID of the tab which is to be duplicated. 1408 | /// (optional) function( Tab tab) {...} ; 1409 | }, 1410 | executeScript: function (tabId, details, callback) { 1411 | ///Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc. 1412 | /// (optional) The ID of the tab in which to run the script; defaults to the active tab of the current window. 1413 | ///Details of the script to run. 1414 | /// (optional) function(array of any result) {...} ; 1415 | }, 1416 | get: function (tabId, callback) { 1417 | ///Retrieves details about the specified tab. 1418 | /// 1419 | ///function( Tab tab) {...} ; 1420 | }, 1421 | getAllInWindow: function (windowId, callback) { 1422 | ///Gets details about all tabs in the specified window. 1423 | /// (optional) None 1424 | ///function(array of Tab tabs) {...} ; 1425 | }, 1426 | getCurrent: function (callback) { 1427 | ///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). 1428 | ///function( Tab tab) {...} ; 1429 | }, 1430 | getSelected: function (windowId, callback) { 1431 | ///Gets the tab that is selected in the specified window. 1432 | /// (optional) None 1433 | ///function( Tab tab) {...} ; 1434 | }, 1435 | highlight: function (highlightInfo, callback) { 1436 | ///Highlights the given tabs. 1437 | ///{tabs: (arrayofintegerorinteger), windowId: (integer), tabIds: (arrayofinteger)} 1438 | ///function( windows.Window window) {...} ; 1439 | }, 1440 | insertCSS: function (tabId, details, callback) { 1441 | ///Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc. 1442 | /// (optional) The ID of the tab in which to insert the CSS; defaults to the active tab of the current window. 1443 | ///Details of the CSS text to insert. 1444 | /// (optional) function() {...} ; 1445 | }, 1446 | move: function (tabIds, moveProperties, callback) { 1447 | ///Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === \normal\) windows. 1448 | ///The tab or list of tabs to move. 1449 | ///{index: (integer), windowId: (optional integer)} 1450 | /// (optional) function( Tab or array of Tab tabs) {...} ; 1451 | }, 1452 | onActivated: { 1453 | addListener: function (callback) { 1454 | ///Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set. 1455 | ///function(object activeInfo) {...} ; 1456 | } 1457 | }, 1458 | onActiveChanged: { 1459 | addListener: function (callback) { 1460 | /// 1461 | ///function(integer tabId, object selectInfo) {...} ; 1462 | } 1463 | }, 1464 | onAttached: { 1465 | addListener: function (callback) { 1466 | ///Fired when a tab is attached to a window, for example because it was moved between windows. 1467 | ///function(integer tabId, object attachInfo) {...} ; 1468 | } 1469 | }, 1470 | onCreated: { 1471 | addListener: function (callback) { 1472 | ///Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set. 1473 | ///function( Tab tab) {...} ; 1474 | } 1475 | }, 1476 | onDetached: { 1477 | addListener: function (callback) { 1478 | ///Fired when a tab is detached from a window, for example because it is being moved between windows. 1479 | ///function(integer tabId, object detachInfo) {...} ; 1480 | } 1481 | }, 1482 | onHighlightChanged: { 1483 | addListener: function (callback) { 1484 | /// 1485 | ///function(object selectInfo) {...} ; 1486 | } 1487 | }, 1488 | onHighlighted: { 1489 | addListener: function (callback) { 1490 | ///Fired when the highlighted or selected tabs in a window changes. 1491 | ///function(object highlightInfo) {...} ; 1492 | } 1493 | }, 1494 | onMoved: { 1495 | addListener: function (callback) { 1496 | ///Fired 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 . 1497 | ///function(integer tabId, object moveInfo) {...} ; 1498 | } 1499 | }, 1500 | onRemoved: { 1501 | addListener: function (callback) { 1502 | ///Fired when a tab is closed. 1503 | ///function(integer tabId, object removeInfo) {...} ; 1504 | } 1505 | }, 1506 | onReplaced: { 1507 | addListener: function (callback) { 1508 | ///Fired when a tab is replaced with another tab due to prerendering or instant. 1509 | ///function(integer addedTabId, integer removedTabId) {...} ; 1510 | } 1511 | }, 1512 | onSelectionChanged: { 1513 | addListener: function (callback) { 1514 | /// 1515 | ///function(integer tabId, object selectInfo) {...} ; 1516 | } 1517 | }, 1518 | onUpdated: { 1519 | addListener: function (callback) { 1520 | ///Fired when a tab is updated. 1521 | ///function(integer tabId, object changeInfo, Tab tab) {...} ; 1522 | } 1523 | }, 1524 | query: function (queryInfo, callback) { 1525 | ///Gets all tabs that have the specified properties, or all tabs if no properties are specified. 1526 | ///{status: (optional enumof \\loading\\ ,or \\complete\\ ), highlighted: (optional boolean), title: (optional string), url: (optional string), index: (optional integer), lastFocusedWindow: (optional boolean), pinned: (optional boolean), currentWindow: (optional boolean), windowId: (optional integer), windowType: (optional enumof \\normal\\ , \\popup\\ , \\panel\\ ,or \\app\\ ), active: (optional boolean)} 1527 | ///function(array of Tab result) {...} ; 1528 | }, 1529 | reload: function (tabId, reloadProperties, callback) { 1530 | ///Reload a tab. 1531 | /// (optional) The ID of the tab to reload; defaults to the selected tab of the current window. 1532 | /// (optional) {bypassCache: (optional boolean)} 1533 | /// (optional) function() {...} ; 1534 | }, 1535 | remove: function (tabIds, callback) { 1536 | ///Closes one or more tabs. 1537 | ///The tab or list of tabs to close. 1538 | /// (optional) function() {...} ; 1539 | }, 1540 | sendMessage: function (tabId, message, responseCallback) { 1541 | ///Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension. 1542 | /// 1543 | /// 1544 | /// (optional) 1545 | }, 1546 | sendRequest: function (tabId, request, responseCallback) { 1547 | ///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 extension.onRequest event is fired in each content script running in the specified tab for the current extension. 1548 | /// 1549 | /// 1550 | /// (optional) 1551 | }, 1552 | update: function (tabId, updateProperties, callback) { 1553 | ///Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified. 1554 | /// (optional) None 1555 | ///{pinned: (optional boolean), openerTabId: (optional integer), url: (optional string), selected: (optional boolean), highlighted: (optional boolean), active: (optional boolean)} 1556 | /// (optional) function( Tab tab) {...} ; 1557 | } 1558 | }, 1559 | topSites: { 1560 | get: function (callback) { 1561 | ///Gets a list of top sites. 1562 | ///function(array of MostVisitedURL data) {...} ; 1563 | } 1564 | }, 1565 | tts: { 1566 | getVoices: function (callback) { 1567 | ///Gets an array of all available voices. 1568 | /// (optional) function(array of TtsVoice voices) {...} ; 1569 | }, 1570 | isSpeaking: function (callback) { 1571 | ///Checks whether the engine is currently speaking. On Mac OS X, the result is true whenever the system speech engine is speaking, even if the speech wasn't initiated by Chrome. 1572 | /// (optional) function(boolean speaking) {...} ; 1573 | }, 1574 | pause: function () { }, 1575 | resume: function () { }, 1576 | speak: function (utterance, options, callback) { 1577 | ///Speaks text using a text-to-speech engine. 1578 | ///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. 1579 | /// (optional) The speech options.{lang: (optional string), voiceName: (optional string), extensionId: (optional string), gender: (optional enumof \\male\\ ,or \\female\\ ), requiredEventTypes: (optional arrayofstring), volume: (optional double), enqueue: (optional boolean), rate: (optional double), onEvent: (optional function), pitch: (optional double), desiredEventTypes: (optional arrayofstring)} 1580 | /// (optional) function() {...} ; 1581 | }, 1582 | stop: function () { } 1583 | }, 1584 | ttsEngine: { 1585 | onPause: { 1586 | addListener: function (callback) { 1587 | ///Optional: if an engine supports the pause event, it should pause the current utterance being spoken, if any, until it receives a resume event or stop event. Note that a stop event should also clear the paused state. 1588 | ///function() {...} ; 1589 | } 1590 | }, 1591 | onResume: { 1592 | addListener: function (callback) { 1593 | ///Optional: if an engine supports the pause event, it should also support the resume event, to continue speaking the current utterance, if any. Note that a stop event should also clear the paused state. 1594 | ///function() {...} ; 1595 | } 1596 | }, 1597 | onSpeak: { 1598 | addListener: function (callback) { 1599 | ///Called when the user makes a call to tts.speak() and one of the voices from this extension's manifest is the first to match the options object. 1600 | ///function(string utterance, object options, function sendTtsEvent) {...} ; 1601 | } 1602 | }, 1603 | onStop: { 1604 | addListener: function (callback) { 1605 | ///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). If speech is in the paused state, this should cancel the paused state. 1606 | ///function() {...} ; 1607 | } 1608 | } 1609 | }, 1610 | types: { 1611 | ChromeSetting: { 1612 | clear: function (details, callback) { 1613 | ///Clears the setting. This way default settings can become effective again. 1614 | ///{scope: (string)} 1615 | ///function() {...} 1616 | }, 1617 | get: function (details, callback) { 1618 | ///Gets the value of a setting. 1619 | ///{incognito: (boolean)} 1620 | ///function(object details) {...} 1621 | }, 1622 | set: function (details, callback) { 1623 | ///Sets the value of a setting. 1624 | ///{value: (any), scope: (string)} 1625 | ///function() {...} 1626 | }, 1627 | onChange: { 1628 | addListener: function (listener) { 1629 | ///Fired when the value of the setting changes. 1630 | ///function(object details) {...} 1631 | } 1632 | } 1633 | } 1634 | }, 1635 | webNavigation: { 1636 | getAllFrames: function (details, callback) { 1637 | ///Retrieves information about all frames of a given tab. 1638 | ///Information about the tab to retrieve all frames from.{processId: (integer), tabId: (integer), parentFrameId: (integer), transitionType: (enumof \\link\\ , \\typed\\ , \\auto_bookmark\\ , \\auto_subframe\\ , \\manual_subframe\\ , \\generated\\ , \\start_page\\ , \\form_submit\\ , \\reload\\ , \\keyword\\ ,or \\keyword_generated\\ ), url: (string), timeStamp: (double), replacedTabId: (integer), frameId: (integer), sourceTabId: (integer), sourceProcessId: (integer), sourceFrameId: (integer), transitionQualifiers: (arrayofenumof \\client_redirect\\ , \\server_redirect\\ , \\forward_back\\ ,or \\from_address_bar\\ ), error: (string), errorOccurred: (boolean)} 1639 | ///function(array of object details) {...} ; 1640 | }, 1641 | getFrame: function (details, callback) { 1642 | ///Retrieves information about the given frame. A frame refers to an