Commit cc3d6eab authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Fix FileTasks.create to filter FakeEntry rather than NativeEntry

Linux files root does not currently show 'Open' in the action bar,
or allow open-with for terminal since it is a VolumeEntry and is
filtered out by util.isNativeEntry from being passed to getFileTakss.

Using util.isFakeEntry now since VolumeEntry is ok to pass to
getFileTasks.

Bug: 1097715
Change-Id: Ib995fda32b9baa1cf2b79ac67ffd613d6da44aff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2327092
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793027}
parent ca955755
......@@ -163,16 +163,16 @@ class LauncherSearch {
{currentDirectoryURL: entry.toURL()}, undefined, /* App ID */
LaunchType.FOCUS_SAME_OR_CREATE);
} else {
// getFileTasks supports only native entries.
if (!util.isNativeEntry(entry)) {
// getFileTasks does not support fake entries.
if (util.isFakeEntry(entry)) {
return;
}
// If the file is not directory, try to execute default task.
chrome.fileManagerPrivate.getFileTasks([entry], tasks => {
// Select default task.
let defaultTask = null;
for (var i = 0; i < tasks.length; i++) {
var task = tasks[i];
for (let i = 0; i < tasks.length; i++) {
const task = tasks[i];
if (task.isDefault) {
defaultTask = task;
break;
......@@ -183,8 +183,8 @@ class LauncherSearch {
// one which is not generic file handler as default task.
// TODO(yawano) Share task execution logic with file_tasks.js.
if (!defaultTask) {
for (var i = 0; i < tasks.length; i++) {
var task = tasks[i];
for (let i = 0; i < tasks.length; i++) {
const task = tasks[i];
if (!task.isGenericFileHandler) {
defaultTask = task;
break;
......
......@@ -96,8 +96,8 @@ class FileTasks {
progressCenter) {
let tasks = [];
// getFileTasks supports only native entries.
entries = entries.filter(util.isNativeEntry);
// Cannot use fake entries with getFileTasks.
entries = entries.filter(e => !util.isFakeEntry(e));
if (entries.length !== 0) {
tasks = await new Promise(
fulfill => chrome.fileManagerPrivate.getFileTasks(entries, fulfill));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment