Commit 78914d35 authored by yawano's avatar yawano Committed by Commit bot

Do not open a downloaded file with generic file handler.

BUG=chrome-os-partner:36486
TEST=none

Review URL: https://codereview.chromium.org/910613002

Cr-Commit-Position: refs/heads/master@{#315267}
parent 2e8a2a7b
...@@ -103,21 +103,23 @@ void OpenFileWithMimeType(Profile* profile, ...@@ -103,21 +103,23 @@ void OpenFileWithMimeType(Profile* profile,
file_urls, file_urls,
&tasks); &tasks);
if (tasks.empty()) { // Select a default handler. If a default handler is not available, select
callback.Run(false); // a non-generic file handler.
return; const file_tasks::FullTaskDescriptor* chosen_task = nullptr;
} for (const auto& task : tasks) {
if (!task.is_generic_file_handler()) {
const file_tasks::FullTaskDescriptor* chosen_task = &tasks[0]; chosen_task = &task;
for (size_t i = 0; i < tasks.size(); ++i) { if (task.is_default())
if (tasks[i].is_default()) { break;
chosen_task = &tasks[i];
break;
} }
} }
ExecuteFileTaskForUrl(profile, chosen_task->task_descriptor(), url); if (chosen_task != nullptr) {
callback.Run(true); ExecuteFileTaskForUrl(profile, chosen_task->task_descriptor(), url);
callback.Run(true);
} else {
callback.Run(false);
}
} }
// Opens the file specified by |url| by finding and executing a file task for // Opens the file specified by |url| by finding and executing a file task for
......
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