diff --git a/extensions/chromium/manifest.json b/extensions/chromium/manifest.json index c029d12a4..cd760480b 100644 --- a/extensions/chromium/manifest.json +++ b/extensions/chromium/manifest.json @@ -16,12 +16,6 @@ "storage", "streamsPrivate" ], - /* FOR demo & debugging purposes only! This key is required to get access to the streams API. - * This key forces the extension ID to be gbkeegbaiigmenfmjfclcdgdpimamgkj (= Chrome Office Viewer) - * This comment has been added to prevent it from being uploaded to the Chrome Web Store. - * Remove it when the PDF.js extensionID is whitelisted for the streamsPrivate API. - */ - "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4zyYTii0VTKI7W2U6fDeAvs3YCVZeAt7C62IC64IDCMHvWy7SKMpOPjfg5v1PgYkFm+fGsCsVLN8NaF7fzYMVtjLc5bqhqPAi56Qidrqh1HxPAAYhwFQd5BVGhZmh1fySHXFPE8VI2tIHwRrASOtx67jbSEk4nBAcJz6n+eGq8QIDAQAB", "content_scripts": [{ "matches": [ "http://*/*", diff --git a/extensions/chromium/pdfHandler-v2.js b/extensions/chromium/pdfHandler-v2.js index 91b90bfb9..92c621134 100644 --- a/extensions/chromium/pdfHandler-v2.js +++ b/extensions/chromium/pdfHandler-v2.js @@ -17,8 +17,22 @@ limitations under the License. */ /* globals chrome, URL, getViewerURL */ +(function() { 'use strict'; +if (!chrome.streamsPrivate) { + // Aww, PDF.js is still not whitelisted... See http://crbug.com/326949 + console.warn('streamsPrivate not available, PDF from FTP or POST ' + + 'requests will not be displayed using this extension! ' + + 'See http://crbug.com/326949'); + chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { + if (message && message.action === 'getPDFStream') { + sendResponse(); + } + }); + return; +} + // // Stream URL storage manager // @@ -26,10 +40,6 @@ limitations under the License. // Hash map of "": { "": ["", ...], ... } var urlToStream = {}; -// Note: Execution of this script stops when the streamsPrivate API is -// not available, because an error will be thrown. Don't bother with -// catching and handling the error, because it is a great way to see -// when the streamsPrivate API is unavailable. chrome.streamsPrivate.onExecuteMimeTypeHandler.addListener(handleStream); // Chrome before 27 does not support tabIds on stream events. @@ -235,3 +245,5 @@ function handleWebNavigation(details) { }); } } + +})();