From 08a0215b13587ed3f272d2997494a2f3ab8cdaec Mon Sep 17 00:00:00 2001 From: David Held Date: Fri, 20 Dec 2013 14:11:01 -0500 Subject: [PATCH] Update to not require permissions by default. Instead of using permissions use optional_permissions. When a URL is entered, request permissions for that URL only. The extension no longer needs "tabs" (which was unneeded anyway), and will only get permissions to the appropriate URL instead of all URLs. --- manifest.json | 3 +-- options.js | 13 +++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 2087007..85963da 100644 --- a/manifest.json +++ b/manifest.json @@ -18,8 +18,7 @@ "page": "background.html" }, "options_page": "options.html", - "permissions": [ - "tabs", + "optional_permissions": [ "http://*/", "https://*/" ] diff --git a/options.js b/options.js index 50ae5df..5ed1388 100644 --- a/options.js +++ b/options.js @@ -133,9 +133,18 @@ function save() { } else { delete localStorage.green; } - + + chrome.permissions.request({ + origins:[localStorage.url] + }, function (granted) { + if (granted) { + chrome.extension.getBackgroundPage()["init"](); + } else { + markDirty(); + } + }); + init(); - chrome.extension.getBackgroundPage()["init"](); } function markDirty() {