From d3f51690f8bb236d1ba3c79c20b3a60d3e62dc52 Mon Sep 17 00:00:00 2001 From: siikamiika <siikamiika@users.noreply.github.com> Date: Sun, 27 Oct 2019 01:51:18 +0300 Subject: make clipboardRead an optional permission --- ext/bg/js/search.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ext/bg/js') diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 8484e042..a09ca822 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -85,7 +85,16 @@ class DisplaySearch extends Display { if (this.clipboardMonitorEnable !== null) { this.clipboardMonitorEnable.addEventListener('change', (e) => { if (e.target.checked) { - this.startClipboardMonitor(); + chrome.permissions.request( + {permissions: ['clipboardRead']}, + (granted) => { + if (granted) { + this.startClipboardMonitor(); + } else { + e.target.checked = false; + } + } + ); } else { this.stopClipboardMonitor(); } -- cgit v1.2.3