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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * This object encapsulates everything related to tasks execution. | 8 * This object encapsulates everything related to tasks execution. |
9 * | 9 * |
10 * @param {FileManager} fileManager FileManager instance. | 10 * @param {FileManager} fileManager FileManager instance. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 var isOnDrive = false; | 130 var isOnDrive = false; |
131 for (var index = 0; index < this.urls_.length; ++index) { | 131 for (var index = 0; index < this.urls_.length; ++index) { |
132 if (FileType.isOnDrive(this.urls_[index])) { | 132 if (FileType.isOnDrive(this.urls_[index])) { |
133 isOnDrive = true; | 133 isOnDrive = true; |
134 break; | 134 break; |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 for (var i = 0; i < tasks.length; i++) { | 138 for (var i = 0; i < tasks.length; i++) { |
139 var task = tasks[i]; | 139 var task = tasks[i]; |
| 140 var taskParts = task.taskId.split('|'); |
140 | 141 |
141 // Skip Drive App if the file is not on Drive. | 142 // Skip Drive App if the file is not on Drive. |
142 if (!isOnDrive && task.driveApp) | 143 if (!isOnDrive && task.driveApp) |
143 continue; | 144 continue; |
144 | 145 |
| 146 // Skip internal Files.app's handlers. |
| 147 if (taskParts[0] == id && (taskParts[2] == 'auto-open' || |
| 148 taskParts[2] == 'select' || taskParts[2] == 'open')) { |
| 149 continue; |
| 150 } |
| 151 |
145 // Tweak images, titles of internal tasks. | 152 // Tweak images, titles of internal tasks. |
146 var taskParts = task.taskId.split('|'); | |
147 if (taskParts[0] == id && taskParts[1] == 'file') { | 153 if (taskParts[0] == id && taskParts[1] == 'file') { |
148 if (taskParts[2] == 'play') { | 154 if (taskParts[2] == 'play') { |
149 // TODO(serya): This hack needed until task.iconUrl is working | 155 // TODO(serya): This hack needed until task.iconUrl is working |
150 // (see GetFileTasksFileBrowserFunction::RunImpl). | 156 // (see GetFileTasksFileBrowserFunction::RunImpl). |
151 task.iconType = 'audio'; | 157 task.iconType = 'audio'; |
152 task.title = loadTimeData.getString('ACTION_LISTEN'); | 158 task.title = loadTimeData.getString('ACTION_LISTEN'); |
153 } else if (taskParts[2] == 'mount-archive') { | 159 } else if (taskParts[2] == 'mount-archive') { |
154 task.iconType = 'archive'; | 160 task.iconType = 'archive'; |
155 task.title = loadTimeData.getString('MOUNT_ARCHIVE'); | 161 task.title = loadTimeData.getString('MOUNT_ARCHIVE'); |
156 } else if (taskParts[2] == 'gallery') { | 162 } else if (taskParts[2] == 'gallery') { |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 items, defaultIdx, | 698 items, defaultIdx, |
693 function(item) { | 699 function(item) { |
694 onSuccess(item.task); | 700 onSuccess(item.task); |
695 }); | 701 }); |
696 }; | 702 }; |
697 | 703 |
698 FileTasks.decorate('display'); | 704 FileTasks.decorate('display'); |
699 FileTasks.decorate('updateMenuItem'); | 705 FileTasks.decorate('updateMenuItem'); |
700 FileTasks.decorate('execute'); | 706 FileTasks.decorate('execute'); |
701 FileTasks.decorate('executeDefault'); | 707 FileTasks.decorate('executeDefault'); |
OLD | NEW |