From 20232c23c12a81d98b69d10c9e18c0b4292606cb Mon Sep 17 00:00:00 2001 From: cmihail Date: Wed, 24 Feb 2016 18:15:21 -0800 Subject: Add directories handling support for apps/extensions. The change introduces a "include_directories" entry in the manifest file for file_handlers. In case the value is true, the file handler becomes a generic handler and adds the given extension to the right click menu. BUG=415897 R=mtomasz@chromium.org Review URL: https://codereview.chromium.org/1407473003 Cr-Commit-Position: refs/heads/master@{#377467} --- .../resources/app_runtime_custom_bindings.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'extensions/renderer') diff --git a/extensions/renderer/resources/app_runtime_custom_bindings.js b/extensions/renderer/resources/app_runtime_custom_bindings.js index 0364b66..3f0dbd2 100644 --- a/extensions/renderer/resources/app_runtime_custom_bindings.js +++ b/extensions/renderer/resources/app_runtime_custom_bindings.js @@ -57,12 +57,21 @@ eventBindings.registerArgumentMassager('app.runtime.onLaunched', }; $Array.forEach(launchData.items, function(item) { var fs = GetIsolatedFileSystem(item.fileSystemId); - fs.root.getFile(item.baseName, {}, function(fileEntry) { - entryIdManager.registerEntry(item.entryId, fileEntry); - itemLoaded(null, { entry: fileEntry, type: item.mimeType }); - }, function(fileError) { - itemLoaded(fileError); - }); + if (item.isDirectory) { + fs.root.getDirectory(item.baseName, {}, function(dirEntry) { + entryIdManager.registerEntry(item.entryId, dirEntry); + itemLoaded(null, {entry: dirEntry}); + }, function(fileError) { + itemLoaded(fileError); + }); + } else { + fs.root.getFile(item.baseName, {}, function(fileEntry) { + entryIdManager.registerEntry(item.entryId, fileEntry); + itemLoaded(null, {entry: fileEntry, type: item.mimeType}); + }, function(fileError) { + itemLoaded(fileError); + }); + } }); } else { // Default case. This currently covers an onLaunched corresponding to -- cgit v1.1