Chrome extension
Browser extension for Chrome
chrome://extensions/
アプリや拡張機能によりリクエストされる権限 - Chrome ウェブストア ヘルプ
公開
Register as a Chrome Web Store developer - Chrome Developers
Group publisher という機能もあるので会社でやるときには下調べしたほうが良さそう
Getting started - Chrome Developers
manifest.json が必須
Architecture overview - Chrome Developers
Event 駆動で、service worker で event を handle する
これが Background script
background script は Chrome API にアクセスすることができる
したがってEvent のハンドリングが可能
Manage events with service workers - Chrome Developers
code:manifest.json
{
"background": {
"service_worker": "background.js"
}
}
ES module が使えるっぽい
実際の処理は Content script として書かれることが多い
action は extention ボタンの制御など
browser actoin と呼ばれている?
page action もある
chrome.pageAction - Chrome Developers
chrome.browserAction - Chrome Developers
chrome.action - Chrome Developers
UI の中でロードする js で処理を書くこともできる
Content scripts
Content scripts - Chrome Developers
Content scripts - Chrome Developers
Manage events with service workers - Chrome Developers
Permissions
Declare permissions - Chrome Developers
https://github.com/bromne/wired-normalizer
Security
Worst case scenario, what can a Chrome extension do with "Your data on all websites" and "Your tabs and browsing activity"? - Information Security Stack Exchange
plugins - Why do Chrome extensions need access to 'all my data' and 'browsing activity'? - Information Security Stack Exchange
Chromium Blog: Security in Depth: The Extension System