87 Commits

Author SHA1 Message Date
Michael Lip
e85e798a37 feat: add chrome.commands API sample (#1629)
Add a new MV3 sample demonstrating the chrome.commands API.

The sample registers custom keyboard shortcuts in the manifest,
handles command events in the service worker with notifications
and badge text feedback, and uses chrome.commands.getAll() in the
popup to display all registered shortcuts.

Closes #1126
2026-03-04 11:18:27 +01:00
Oliver Dunk
36f42978b8 Update Puppeteer tutorial to open popup with openPopup() (#1613)
Updates the Puppeteer tutorial to use the `action.openPopup()`
method to open the popup, and then `asPage()` to access the popup
as a page target.

A basic service worker has been added to the history sample to
give us a context to call `action.openPopup()` in.
2026-01-20 12:29:34 +01:00
Rin
43a7939928 security: update rollup plugins and fix potential XSS in idle sample (#1607)
* chore: update outdated rollup plugins in functional samples

* security: fix potential XSS by replacing innerHTML with safe DOM manipulation

* chore: revert package updates (let dependabot handle them)

* Add missing newline
2026-01-08 14:31:28 +00:00
Rin
5e666b9b6b security: replace insecure innerHTML with textContent and replaceChildren (#1609) 2026-01-08 13:09:07 +00:00
Oliver Dunk
bce4254d71 Fix typo in devtools sample (#1593) 2025-12-08 17:08:43 +00:00
Oliver Dunk
11898ee8eb Fix issue in advanced fontSettings sample (#1523)
We were using the wrong key when importing settings from a file.
Additionally, added a reload to fix an issue where the UI was not
updated when new settings were imported.

Fixes #1519
2025-08-05 18:33:39 +01:00
Oliver Dunk
aab4aa91fd Partial fixes for sample list generator (#1464)
* Partial fixes for sample list generator

A number of fixes for the sample list generator:

- Removes a comment from one of our manifest files, as we don't
  currently support JSONC.
- Ignores the `node_modules` folder since we have recently added some AI
  samples with a build step.
- Adds the `aiOriginTrial` API to the list of recognised APIs.
- Updates `extension-apis.json` with the latest data from the
  `chrome-types` package.

Updating recognised extension APIs still requires access to a
non-existent storage bucket, so this does not fully fix the process.

* Fix linter issue
2025-04-30 17:14:32 +01:00
ljjlee
1cf9c53d4b Add getProfileUserInfo example to sample identity extension (#1454)
* Add getProfileUserInfo example to sample identity extension

* Clarify UI

* Run prettier

---------

Co-authored-by: Oliver Dunk <oliverdunk@google.com>
2025-04-07 16:41:09 -07:00
Oliver Dunk
8cf0e9a827 Fix linter error and run on PRs (#1447)
Fixes a linter error in the `identity` API sample, and updates the
linter to run on all PRs going forward.
2025-03-31 15:17:58 +02:00
ljjlee
40456c76c1 Don't assume existence of hard-coded bookmark Ids (#1434)
Instead, use the default location on the create() call.
2025-03-31 12:30:15 +01:00
ljjlee
db2d231476 Add sample Identity API extension (#1432)
* Initial copy of _archive/apps/samples/identity

* Modify to run be an extension rather than a Chrome App.

* Update extension to manifest v3

* Update README

* Remove references to chrome://identity-internals

* Use Promises rather than callbacks

See https://developer.chrome.com/docs/extensions/develop/migrate/api-calls#replace-callbacks

* Apply code-review markups.

* Apply more code-review markups

* Format with prettier

* Use Promise.catch instead of runtime.lastError

* Update screenshot

---------

Co-authored-by: Oliver Dunk <oliverdunk@google.com>
2025-03-20 14:17:39 +00:00
minggeorgelei
692e9a990e fix: the extension page will refresh after clicking the button. We need to add preventDefault to prevent form default behavior. (#1378)
Co-authored-by: George <minggeorgelei@gmail.com>
2024-12-24 21:25:29 +00:00
Sebastian Benz
8dcd06dc20 Update web accessible resource samples to use dynamic URLs (#1317) 2024-10-08 15:47:52 +02:00
Yegor Zorin
5e5f028fd7 chore: Fix typo url redirect sample (#1252)
* chore: Fix typo url redirect sample

* chore: Trigger cla/google check
2024-08-12 11:57:09 +01:00
Atick Faisal
b03a0572b2 Fix time unit error (#1141) 2024-04-26 16:34:35 +01:00
Oliver Dunk
9f667d867a Upgrade to ESLint 9 (#1149)
* Upgrade to eslint 9

* Fix version numbers in package.json files
2024-04-26 15:00:33 +01:00
Oliver Dunk
72eb0a4a7d Update chrome.privacy API sample (#1086)
* Update chrome.privacy API sample

Updates the API sample for chrome.privacy to avoid using the
deprecated autofillEnabled property and to behave in a way which
is more useful. In particular, you can now easily toggle the
setting by clicking the extension icon.

See https://issuetracker.google.com/issues/311072505 for more
context.

* Update api-samples/privacy/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

---------

Co-authored-by: Joe Medley <jmedley@google.com>
2024-02-22 15:45:21 +00:00
Oliver Dunk
d2296fac85 Update dependencies (#1096)
Updates a nunber of dependencies in a single PR. These were
suggested by dependabot but updating them individually would
mean the reposistory would be in a broken state until everything
had merged.

I'm not personally a huge fan of lowercasing doctype, but
Prettier has taken an opinionated stance here and there is not a
way to disable it:

https://github.com/prettier/prettier/issues/15096
2024-02-20 12:53:23 +01:00
Yury V. Zaytsev
7a845d6af4 Fix broken "All Frames" option in api-samples/scripting (#1039)
Apparently a copy & paste error.
2024-02-20 10:33:24 +00:00
Joe Medley
73265836c4 Fix direction of the keys. (#1080) 2024-02-09 08:12:38 -08:00
Oliver Dunk
b5e36835a3 Fix eslint var usage error (#1077) 2024-01-31 15:57:02 +00:00
Shubham Rasal
1fb09e4e68 Update mv3 native messaging (#842)
* migrate to mv3

* migrated download links to mv3

* Revert "migrated download links to mv3"

This reverts commit 70e4512277.

* restored the old mv2 manifest

* Address feedback

* Update installation location on macOS

We need to use specific folders otherwise Chrome/Python doesn't
have permission to execute the file.

* Fix linting errors

* Rename app directory to extension

* Use updated README template

* Update uninstall script

---------

Co-authored-by: Oliver Dunk <oliverdunk@google.com>
2024-01-31 15:44:14 +00:00
patrick kettner
2a3e3d43f8 add chrome.power/keep awake as an api sample (#1060)
* add chrome.power/keep awake as an api sample
* support localized file info for extension samples

Co-authored-by: Oliver Dunk <oliverdunk@google.com>
2024-01-16 07:48:03 -05:00
Stephen Kao
77897c576d Fix: use let to prevent reassignment error for sandbox result (#1067)
In the sandbox/sandbox example, a variable `result` is created as a const, but it's attempted to be reassigned later in the code.  This changeset just changes the `result` variable to be a reassignable variable instead.
2024-01-10 14:30:22 +01:00
patrick kettner
dcd08adfe8 add settings import/export to fontSettings (#1037)
* add settings import/export to fontSettings

* feedback

* feedback
2023-11-30 11:10:34 -05:00
Oliver Dunk
21beba49c2 Fix formatting in printing sample (#1033) 2023-11-21 14:43:43 +00:00
Nathan Muggli
37b9846f69 Add roll printing sample (#1006)
* Add roll printing sample

* Copied heavily from existing printing sample

* Changed functionality from existing printing sample as follows:

* Only display printers that support roll printing
* In table, create a row for each unique width for each printer

* Fix wording in README

* Update readme to list a milestone for bug to get fixed

* Update api-samples/printing/roll-printing/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/printing/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Convert a function call to a promise.

* Clean up a few errors setting element IDs.

Remove the main cancel button that is no longer used.  Instead, the
cancel button that gets created in the print job table is the one that
should be used.

* Consolidate the roll-printing sample with the regular sample

There is now a checkbox on the main UI to select roll printers or all
printers.  For roll printing, this sample now demonstrates how to check
if the printer is capable of roll printing, if the printer is capable of
trimming the paper after printing, and how the media length can be a
variable value.

* Update api-samples/printing/README.md

Co-authored-by: Oliver Dunk <oliver@oliverdunk.com>

* Update api-samples/printing/printers.js

Co-authored-by: Oliver Dunk <oliver@oliverdunk.com>

* Simplify fuction to use find instead of filter

Update README to link to roll printing info.

* Use new page instead of popup

* Update api-samples/printing/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

---------

Co-authored-by: Joe Medley <jmedley@google.com>
Co-authored-by: Oliver Dunk <oliver@oliverdunk.com>
2023-11-21 13:22:52 +00:00
Joe Medley
0096d6778e Make the README and manifest consistent. (#1030) 2023-11-15 13:35:31 -08:00
Xuezhou Dai
bbcd025851 Migration tabs sample (#964)
* Add pin sample

* Add README.md

* Add screenshot sample

* Add README.md

* Add zoom sample

* Add README.md

* Add inspector sample

* Add README.md

* Fix typo

* Remove wrapper

* Remove inline style

* Update api-samples/tabs/pin/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/tabs/screenshot/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/tabs/zoom/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/tabs/zoom/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/tabs/zoom/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/tabs/zoom/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/tabs/inspector/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/tabs/zoom/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update README

* Update for loop

* Remove children select

* Change selected to active

* Fix event listener

* Set checkboxs to disabled

* Fix layout

* Fix wrong input data in create tab function

* Update api-samples/tabs/zoom/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update description

* Update description

* Update description

* Fix typo

* Update description

* Rename

* Fix file name

* Update active check box

* Update code style

* Update api-samples/tabs/zoom/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/tabs/pin/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/tabs/pin/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Apply suggestions from code review

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/tabs/inspector/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Fix case issues

* Update api-samples/tabs/inspector/manifest.json

---------

Co-authored-by: Joe Medley <jmedley@google.com>
Co-authored-by: Oliver Dunk <oliver@oliverdunk.com>
2023-11-13 13:35:41 +00:00
Oliver Dunk
31439d3b4e Add API sample for User Scripts API (#1023)
* Add API sample for User Scripts API

* Apply suggestions from code review

Co-authored-by: Joe Medley <jmedley@google.com>
Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>

* Use chrome.userScripts.update method

* Filter getScripts call

* Add minimum_chrome_version

* Apply suggestions from code review

Co-authored-by: Joe Medley <jmedley@google.com>

---------

Co-authored-by: Joe Medley <jmedley@google.com>
Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>
2023-11-01 14:02:18 -05:00
Oliver Dunk
f98ff8227c Add Reading List API sample (#1021)
* Add Reading List API sample

* Apply suggestions from code review

Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>

* Add minimum_chrome_version

---------

Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>
2023-11-01 14:13:45 +00:00
Oliver Dunk
b25a56bf8e Add Puppeteer testing tutorial (#1016)
* Add Puppeteer testing tutorial

* Use Jest as test runner

* Add comment on changing headless mode
2023-10-12 10:49:02 -05:00
Benjamin Lörincz
477973e48e removed unused variables, switched to async/await, cleanup (#906)
* removed unused variables, switched to async/await, cleanup

* leave decision to await promise to caller
2023-10-10 15:37:11 +02:00
Xuezhou Dai
f608c65e61 Add new omnibox sample (#988)
* Add new omnibox sample

* Update api-samples/omnibox/simple-example/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/omnibox/simple-example/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/omnibox/simple-example/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/omnibox/simple-example/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/omnibox/simple-example/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update description

* Update description

* Rename the global variable

---------

Co-authored-by: Joe Medley <jmedley@google.com>
2023-08-25 16:09:05 +01:00
Xuezhou Dai
3f07ceec66 Add storage sample (#947)
* Add storage sample `stylizr`

* Update description

* Update api-samples/storage/stylizr/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Clear previous timer if message called twice

* Remove innerHTML

* Update tips

* Remove IIFE

---------

Co-authored-by: Joe Medley <jmedley@google.com>
2023-08-21 11:34:27 +01:00
Xuezhou Dai
45bbd8d68d Update description fields for all samples (#994)
* Update `action` sample

* Update `alarms` sample

* Update `bookmarks` sample

* Update `browsingData` sample

* Update `contentSettings` sample

* Update `cookies/cookie-clearer` sample

* Update `debugger` sample

* Update wasm functional sample

* Update `functional/cookbook.geolocation-contentscript` sample

* Update `cookbook.geolocation-offscreen` sample

* Update `cookbook.geolocation-popup` sample

* Update `cookbook.offscreen-clipboard-write` sample

* Update `cookbook.offscreen-dom` sample

* Fix browsingData description

* Fix bookmarks description

* Update offscreen document descriptions

* Update descriptions

* Update browsingData description

* Update descriptions for all api samples

* Update descriptions for cookbook samples

* Update api-samples/browsingData/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/action/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/contextMenus/basic/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/cookies/cookie-clearer/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/debugger/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Update functional-samples/sample.favicon-cs/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Update functional-samples/cookbook.sidepanel-site-specific/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/omnibox/new-tab-search/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/devtools/inspectedWindow/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/override/blank_ntp/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Apply suggestions from code review

Co-authored-by: Joe Medley <jmedley@google.com>

* Update wasm samples description

* Update description

* Update functional-samples/sample.co2meter/manifest.json

Co-authored-by: Joe Medley <jmedley@google.com>

* Apply suggestions from code review

---------

Co-authored-by: Joe Medley <jmedley@google.com>
Co-authored-by: Oliver Dunk <oliver@oliverdunk.com>
2023-08-17 18:19:42 +01:00
Xuezhou Dai
a3966b4d92 Add readme files to existing samples & fix typos (#981)
* Add `Running this extension` section

* Change title

* Fix title typo

* Fix wrong operation

* Update `Running this extension` section

* Add `Running this extension` section
2023-07-17 10:05:43 -06:00
kyoyoung keum
b6b19104fc fix rename file in debugger example app (#985)
Co-authored-by: keumky2 <keumky2@woowahan.com>
2023-07-15 09:58:19 -04:00
Xuezhou Dai
50e377c44c Add idle sample (#961)
* Add idle sample

* Fix typo

* Fix onStateChanged threshold

* Add README.md

* Update file structure

* Remove tabs permission

* Update api-samples/idle/README.md

Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>

* Update api-samples/idle/service-worker.js

Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>

* Update api-samples/idle/README.md

Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>

* Update api-samples/idle/README.md

Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>

---------

Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>
2023-07-07 15:42:14 +01:00
Xuezhou Dai
b4a018418d historyOverride sample for mv3 (#945)
* Add historyOverride sample

* Remove action

* Add README.md

* Remove IIFE

* Update style

* Fix double click
2023-07-07 15:35:03 +01:00
Xuezhou Dai
0af7b5132d Add topsites/basic sample (#967)
* Update sample file structure.

* Update description

* Fix wrong favicon path

* Add basic sample

* Update README.md

* Fix comments
2023-07-06 11:19:56 +01:00
Abhi G
327718cc14 Resolved the broken links (#975) 2023-07-03 15:55:11 +01:00
IanStanion-google
05b8106ce5 Adds readme files for every mv3 sample (#973)
* Adds readme files for every mv3 sample

* Update api-samples/alarms/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/alarms/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/override/blank_ntp/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/omnibox/new-tab-search/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/omnibox/new-tab-search/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/contextMenus/global_context_search/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/cookies/cookie-clearer/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/default_command_override/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/il8n/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/il8n/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/default_command_override/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/favicon/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/favicon/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/override/blank_ntp/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update api-samples/fontSettings/fontSettings Basic/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Update README.md

* Update api-samples/fontSettings/fontSettings Basic/README.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Updates omnibox sample with small clarity improvement

---------

Co-authored-by: Joe Medley <jmedley@google.com>
2023-06-30 14:13:53 -04:00
IanStanion-google
307da41987 Changes onInstalled event listener to action.onClicked (#971)
* Changes onInstalled event listener to action.onClicked

* Update sandbox.html

* Update sandbox.html
2023-06-30 04:21:28 -04:00
Joe Medley
7e067289c4 Copy edit the privacy README. (#970) 2023-06-28 09:25:08 -07:00
IanStanion-google
ef7eb4cd1a Privacy mv3 sample (#956)
* Implemented mv3 privacy API sample

* Added mv3 privacy API sample

* Expanded sample and updated readme

* Update service-worker.js
2023-06-26 15:57:14 +02:00
IanStanion-google
be334066a2 Devtools mv3 samples (#938)
* devtools sample

* Added readme

* Updated readme

* Changed folder structure

* Update devtools.html

* Update devtools.js

* Update devtools.js

* Update api-samples/devtools/chrome-query/chrome-query.md

Co-authored-by: Joe Medley <jmedley@google.com>

* Changed folder name

* readme name change

---------

Co-authored-by: Joe Medley <jmedley@google.com>
2023-06-23 10:08:52 -04:00
IanStanion-google
2527b666a6 Windows api mv3 sample (#959)
* WIP windows API sample

* Update background.js

* Added mv3 windows API sample

* Corrections based on review
2023-06-21 21:01:39 +02:00
IanStanion-google
cd11c730ea Web nav mv3 sample (#958)
* implemented webNavigation mv3 sample

* Added mv3 webNavigation API sample

* Changes based on review
2023-06-21 20:57:59 +02:00
IanStanion-google
0af4863057 Top sites mv3 sample (#957)
* Implemented topsites API sample

* Added topSites mv3 API sample

* Changes based on review
2023-06-21 20:57:18 +02:00