Skip to content

Commit 74e1edf

Browse files
authored
Rename addSiteAccessRequest to addHostAccessRequest (#1356)
1 parent 6b4db6a commit 74e1edf

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# permissions.addSiteAccessRequest() Demo
1+
# permissions.addHostAccessRequest() Demo
22

3-
This sample demonstrates using the `permissions.addSiteAccessRequest` API to request access to a site.
3+
This sample demonstrates using the `permissions.addHostAccessRequest` API to request access to a host.
44

55
## Overview
66

@@ -11,11 +11,10 @@ This API allows you to request access to an origin listed in `optional_host_perm
1111
1. Clone this repository.
1212
2. Make sure you have the latest version of Chrome Canary installed.
1313
3. At chrome://flags, enable the "Extensions Menu Access Control" flag.
14-
4. Close Chrome Canary.
15-
5. Start Chrome Canary with the `--enable-features=ApiPermissionsSiteAccessRequests` flag.
16-
6. Load this directory as an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked).
17-
7. At chrome://extensions, click on "Details" for the extension and unselect "Automatically allow access on the following sites".
18-
8. Visit https://example.com/checkout.
19-
9. Click "Allow 1?"
14+
4. Restart Chrome Canary.
15+
5. Load this directory as an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked).
16+
6. At chrome://extensions, click on "Details" for the extension and unselect "Automatically allow access on the following sites".
17+
7. Visit https://example.com/checkout.
18+
8. Click "Allow 1?"
2019

2120
You will see a banner injected on the page to show that the extension has run.

functional-samples/cookbook.permissions-addsiteaccessrequest/background.js renamed to functional-samples/cookbook.permissions-addhostaccessrequest/background.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
/**
16-
* Adds a site access request if the user visits https://example.com/checkout.
16+
* Adds a host access request if the user visits https://example.com/checkout.
1717
* This could be useful for an extension that wishes to offer users coupons or
1818
* order tracking but needs access to the site to do so.
1919
*/
@@ -33,9 +33,9 @@ chrome.tabs.onUpdated.addListener(async (tabId, changes) => {
3333
return;
3434
}
3535

36-
// Add a site access request if the API is available.
37-
if (chrome.permissions.addSiteAccessRequest) {
38-
chrome.permissions.addSiteAccessRequest({ tabId });
36+
// Add a host access request if the API is available.
37+
if (chrome.permissions.addHostAccessRequest) {
38+
chrome.permissions.addHostAccessRequest({ tabId });
3939
}
4040
}
4141
});

functional-samples/cookbook.permissions-addsiteaccessrequest/manifest.json renamed to functional-samples/cookbook.permissions-addhostaccessrequest/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "Permissions (Add Site Access Request)",
3-
"description": "Uses the `permissions.addSiteAccessRequest()` API to request access to a site.",
2+
"name": "Permissions (Add Host Access Request)",
3+
"description": "Uses the `permissions.addHostAccessRequest()` API to request access to a site.",
44
"version": "0.3",
55
"background": {
66
"service_worker": "background.js"

0 commit comments

Comments
 (0)