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 /** | 5 /** |
6 * This object encapsulates everything related to tasks execution. | 6 * This object encapsulates everything related to tasks execution. |
7 * @param {FileManager} fileManager FileManager instance. | 7 * @param {FileManager} fileManager FileManager instance. |
8 * @param {Array.<string>} urls List of file urls. | 8 * @param {Array.<string>} urls List of file urls. |
9 * @param {Array.<string>=} opt_mimeTypes List of MIME types for each | 9 * @param {Array.<string>=} opt_mimeTypes List of MIME types for each |
10 * of the files. | 10 * of the files. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 task.title = loadTimeData.getString('ACTION_LISTEN'); | 94 task.title = loadTimeData.getString('ACTION_LISTEN'); |
95 } else if (task_parts[1] == 'mount-archive') { | 95 } else if (task_parts[1] == 'mount-archive') { |
96 task.iconType = 'archive'; | 96 task.iconType = 'archive'; |
97 task.title = loadTimeData.getString('MOUNT_ARCHIVE'); | 97 task.title = loadTimeData.getString('MOUNT_ARCHIVE'); |
98 } else if (task_parts[1] == 'gallery') { | 98 } else if (task_parts[1] == 'gallery') { |
99 task.iconType = 'image'; | 99 task.iconType = 'image'; |
100 task.title = loadTimeData.getString('ACTION_OPEN'); | 100 task.title = loadTimeData.getString('ACTION_OPEN'); |
101 } else if (task_parts[1] == 'watch') { | 101 } else if (task_parts[1] == 'watch') { |
102 task.iconType = 'video'; | 102 task.iconType = 'video'; |
103 task.title = loadTimeData.getString('ACTION_WATCH'); | 103 task.title = loadTimeData.getString('ACTION_WATCH'); |
104 } else if (task_parts[1] == 'open-hosted') { | 104 } else if (task_parts[1] == 'open-hosted-generic') { |
105 if (this.urls_.length > 1) | 105 if (this.urls_.length > 1) |
106 task.iconType = 'generic'; | 106 task.iconType = 'generic'; |
107 else // Use specific icon. | 107 else // Use specific icon. |
108 task.iconType = FileType.getIcon(this.urls_[0]); | 108 task.iconType = FileType.getIcon(this.urls_[0]); |
109 task.title = loadTimeData.getString('ACTION_OPEN'); | 109 task.title = loadTimeData.getString('ACTION_OPEN'); |
| 110 } else if (task_parts[1] == 'open-hosted-gdoc') { |
| 111 task.iconType = 'gdoc'; |
| 112 task.title = loadTimeData.getString('ACTION_OPEN_GDOC'); |
| 113 } else if (task_parts[1] == 'open-hosted-gsheet') { |
| 114 task.iconType = 'gsheet'; |
| 115 task.title = loadTimeData.getString('ACTION_OPEN_GSHEET'); |
| 116 } else if (task_parts[1] == 'open-hosted-gslides') { |
| 117 task.iconType = 'gslides'; |
| 118 task.title = loadTimeData.getString('ACTION_OPEN_GSLIDES'); |
110 } else if (task_parts[1] == 'view-pdf') { | 119 } else if (task_parts[1] == 'view-pdf') { |
111 // Do not render this task if disabled. | 120 // Do not render this task if disabled. |
112 if (!loadTimeData.getBoolean('PDF_VIEW_ENABLED')) | 121 if (!loadTimeData.getBoolean('PDF_VIEW_ENABLED')) |
113 continue; | 122 continue; |
114 task.iconType = 'pdf'; | 123 task.iconType = 'pdf'; |
115 task.title = loadTimeData.getString('ACTION_VIEW'); | 124 task.title = loadTimeData.getString('ACTION_VIEW'); |
116 } else if (task_parts[1] == 'view-in-browser') { | 125 } else if (task_parts[1] == 'view-in-browser') { |
117 task.iconType = 'generic'; | 126 task.iconType = 'generic'; |
118 task.title = loadTimeData.getString('ACTION_VIEW'); | 127 task.title = loadTimeData.getString('ACTION_VIEW'); |
119 } else if (task_parts[1] == 'install-crx') { | 128 } else if (task_parts[1] == 'install-crx') { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 }); | 300 }); |
292 return; | 301 return; |
293 } | 302 } |
294 | 303 |
295 if (id == 'gallery') { | 304 if (id == 'gallery') { |
296 this.openGallery(urls); | 305 this.openGallery(urls); |
297 return; | 306 return; |
298 } | 307 } |
299 | 308 |
300 if (id == 'view-pdf' || id == 'view-in-browser' || | 309 if (id == 'view-pdf' || id == 'view-in-browser' || |
301 id == 'install-crx' || id == 'open-hosted' || id == 'watch') { | 310 id == 'install-crx' || id.match(/^open-hosted-/) || id == 'watch') { |
302 chrome.fileBrowserPrivate.viewFiles(urls, id, function(success) { | 311 chrome.fileBrowserPrivate.viewFiles(urls, id, function(success) { |
303 if (!success) | 312 if (!success) |
304 console.error('chrome.fileBrowserPrivate.viewFiles failed', urls); | 313 console.error('chrome.fileBrowserPrivate.viewFiles failed', urls); |
305 }); | 314 }); |
306 return; | 315 return; |
307 } | 316 } |
308 }; | 317 }; |
309 | 318 |
310 /** | 319 /** |
311 * Mounts archives. | 320 * Mounts archives. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 message, | 533 message, |
525 items, defaultIdx, | 534 items, defaultIdx, |
526 onSuccess); | 535 onSuccess); |
527 }; | 536 }; |
528 | 537 |
529 FileTasks.decorate('display'); | 538 FileTasks.decorate('display'); |
530 FileTasks.decorate('updateMenuItem'); | 539 FileTasks.decorate('updateMenuItem'); |
531 FileTasks.decorate('execute'); | 540 FileTasks.decorate('execute'); |
532 FileTasks.decorate('executeDefault'); | 541 FileTasks.decorate('executeDefault'); |
533 | 542 |
OLD | NEW |