make clipboardRead an optional permission

This commit is contained in:
siikamiika 2019-10-27 01:51:18 +03:00
parent 7ee87265cd
commit d3f51690f8
2 changed files with 13 additions and 2 deletions

View File

@ -85,7 +85,16 @@ class DisplaySearch extends Display {
if (this.clipboardMonitorEnable !== null) {
this.clipboardMonitorEnable.addEventListener('change', (e) => {
if (e.target.checked) {
chrome.permissions.request(
{permissions: ['clipboardRead']},
(granted) => {
if (granted) {
this.startClipboardMonitor();
} else {
e.target.checked = false;
}
}
);
} else {
this.stopClipboardMonitor();
}

View File

@ -41,10 +41,12 @@
"permissions": [
"<all_urls>",
"storage",
"clipboardRead",
"clipboardWrite",
"unlimitedStorage"
],
"optional_permissions": [
"clipboardRead"
],
"commands": {
"toggle": {
"suggested_key": {