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,
file_urls,
&tasks);
if (tasks.empty()) {
callback.Run(false);
return;
}
const file_tasks::FullTaskDescriptor* chosen_task = &tasks[0];
for (size_t i = 0; i < tasks.size(); ++i) {
if (tasks[i].is_default()) {
chosen_task = &tasks[i];
// Select a default handler. If a default handler is not available, select
// a non-generic file handler.
const file_tasks::FullTaskDescriptor* chosen_task = nullptr;
for (const auto& task : tasks) {
if (!task.is_generic_file_handler()) {
chosen_task = &task;
if (task.is_default())
break;
}
}
if (chosen_task != nullptr) {
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
......
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