OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/file_manager/open_util.h" | 5 #include "chrome/browser/chromeos/file_manager/open_util.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 file_tasks::TaskDescriptor task(kFileManagerAppId, | 70 file_tasks::TaskDescriptor task(kFileManagerAppId, |
71 file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER, | 71 file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER, |
72 action_id); | 72 action_id); |
73 ExecuteFileTaskForUrl(profile, task, url); | 73 ExecuteFileTaskForUrl(profile, task, url); |
74 } | 74 } |
75 | 75 |
76 void OpenFileMimeTypeAfterTasksListed( | 76 void OpenFileMimeTypeAfterTasksListed( |
77 Profile* profile, | 77 Profile* profile, |
78 const GURL& url, | 78 const GURL& url, |
79 const platform_util::OpenOperationCallback& callback, | 79 const platform_util::OpenOperationCallback& callback, |
80 const std::vector<file_tasks::FullTaskDescriptor>& tasks) { | 80 std::unique_ptr<std::vector<file_tasks::FullTaskDescriptor>> tasks) { |
81 // Select a default handler. If a default handler is not available, select | 81 // Select a default handler. If a default handler is not available, select |
82 // a non-generic file handler. | 82 // a non-generic file handler. |
83 const file_tasks::FullTaskDescriptor* chosen_task = nullptr; | 83 const file_tasks::FullTaskDescriptor* chosen_task = nullptr; |
84 for (const auto& task : tasks) { | 84 for (const auto& task : *tasks) { |
85 if (!task.is_generic_file_handler()) { | 85 if (!task.is_generic_file_handler()) { |
86 chosen_task = &task; | 86 chosen_task = &task; |
87 if (task.is_default()) | 87 if (task.is_default()) |
88 break; | 88 break; |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 if (chosen_task != nullptr) { | 92 if (chosen_task != nullptr) { |
93 if (shell_operations_allowed) | 93 if (shell_operations_allowed) |
94 ExecuteFileTaskForUrl(profile, chosen_task->task_descriptor(), url); | 94 ExecuteFileTaskForUrl(profile, chosen_task->task_descriptor(), url); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 OpenFileManagerWithInternalActionId(profile, url, "select"); | 197 OpenFileManagerWithInternalActionId(profile, url, "select"); |
198 callback.Run(platform_util::OPEN_SUCCEEDED); | 198 callback.Run(platform_util::OPEN_SUCCEEDED); |
199 } | 199 } |
200 | 200 |
201 void DisableShellOperationsForTesting() { | 201 void DisableShellOperationsForTesting() { |
202 shell_operations_allowed = false; | 202 shell_operations_allowed = false; |
203 } | 203 } |
204 | 204 |
205 } // namespace util | 205 } // namespace util |
206 } // namespace file_manager | 206 } // namespace file_manager |
OLD | NEW |