|
|
|
@ -18,21 +18,21 @@ limitations under the License.
@@ -18,21 +18,21 @@ limitations under the License.
|
|
|
|
|
/* globals chrome, getViewerURL */ |
|
|
|
|
|
|
|
|
|
(function() { |
|
|
|
|
'use strict'; |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
if (!chrome.fileBrowserHandler) { |
|
|
|
|
if (!chrome.fileBrowserHandler) { |
|
|
|
|
// Not on Chromium OS, bail out
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
chrome.fileBrowserHandler.onExecute.addListener(onExecuteFileBrowserHandler); |
|
|
|
|
} |
|
|
|
|
chrome.fileBrowserHandler.onExecute.addListener(onExecuteFileBrowserHandler); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* Invoked when "Open with PDF Viewer" is chosen in the File browser. |
|
|
|
|
* |
|
|
|
|
* @param {String} id File browser action ID as specified in manifest.json |
|
|
|
|
* @param {Object} details Object of type FileHandlerExecuteEventDetails |
|
|
|
|
*/ |
|
|
|
|
function onExecuteFileBrowserHandler(id, details) { |
|
|
|
|
function onExecuteFileBrowserHandler(id, details) { |
|
|
|
|
if (id !== 'open-as-pdf') { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -54,15 +54,15 @@ function onExecuteFileBrowserHandler(id, details) {
@@ -54,15 +54,15 @@ function onExecuteFileBrowserHandler(id, details) {
|
|
|
|
|
openViewer(windowId, fileEntries); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* Open the PDF Viewer for the given list of PDF files. |
|
|
|
|
* |
|
|
|
|
* @param {number} windowId |
|
|
|
|
* @param {Array} fileEntries List of Entry objects (HTML5 FileSystem API) |
|
|
|
|
*/ |
|
|
|
|
function openViewer(windowId, fileEntries) { |
|
|
|
|
function openViewer(windowId, fileEntries) { |
|
|
|
|
if (!fileEntries.length) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -90,6 +90,5 @@ function openViewer(windowId, fileEntries) {
@@ -90,6 +90,5 @@ function openViewer(windowId, fileEntries) {
|
|
|
|
|
openViewer(chromeWindow.id, fileEntries); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
})(); |
|
|
|
|