3. What are extensions?
●
Applications running inside Chrome browser
●
Provide additional functionality or customize browser experience
●
Written using HTML, Javascript and CSS
●
Integrated using simple chrome.* API
9. Manifest
●
Every extension, installable web app, and
theme has a JSON-formatted manifest file,
named manifest.json, that provides important
information.
developer.chrome.com/extensions/manifest.html
10. manifest.json
{
"name": "Read it later!",
"version": "0.9.0",
"manifest_version": 2,
"description": "Enables save websites for later, no ads, no logins",
"browser_action": {
"default_icon": "img/icon48.png",
"default_popup": "popup.html"
},
"default_locale": "en",
"icons": {
"128": "img/icon128.png"
},
"offline_enabled": true,
"permissions": [
"contextMenus",
"storage",
"tabs"
],
"background": {
"scripts": [
"background.js"
]
}
15. Content script
●
●
●
Javascript which runs on page specified in
manifest (can be regexp)
Content script has access to the DOM of HTML
page, but runs on its isolated container
Can pass messages with the background page
17. Background page
●
●
background page is an HTML page that runs in
the extension process
It exists for the lifetime of your extension, and
only one instance of it at a time is active*
*Exception if extension uses incognito „split mode“
19. chrome.* APIs
●
●
chrome is the top-level object and exposes
many interesting APIs
common:
–
chrome.browserAction.*
–
chrome.contextMenus.*
–
chrome.debugger.*
–
chrome.notifications.*
–
chrome.omnibox.*
–
chrome.storage.*
–
chrome.tabs.*
- local/sync
20. chrome.* APIs
●
Less common APIs
–
chrome.i18n.*
- translations
–
chrome.power.* - system's power management
–
chrome.events.*
–
chrome.downloads.*
–
chrome.devtools.*
–
chrome.commands.*
–
chrome.alarms.*
- schedule code to run
developer.chrome.com/extensions/api_index.html
21. Permissions
●
●
Extension or app must declare its intent in the
"permissions" field (manifest)
Each permission can be either one of a list of
known strings (such as "downloads") or a
match pattern