| 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  * TODO(hirono): Pass each component instead of the entire FileManager. |   10  * TODO(hirono): Pass each component instead of the entire FileManager. | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
|   39 /** |   39 /** | 
|   40  * Base URL of apps list in the Chrome Web Store. This constant is used in |   40  * Base URL of apps list in the Chrome Web Store. This constant is used in | 
|   41  * FileTasks.createWebStoreLink(). |   41  * FileTasks.createWebStoreLink(). | 
|   42  * |   42  * | 
|   43  * @const |   43  * @const | 
|   44  * @type {string} |   44  * @type {string} | 
|   45  */ |   45  */ | 
|   46 FileTasks.WEB_STORE_HANDLER_BASE_URL = |   46 FileTasks.WEB_STORE_HANDLER_BASE_URL = | 
|   47     'https://chrome.google.com/webstore/category/collection/file_handlers'; |   47     'https://chrome.google.com/webstore/category/collection/file_handlers'; | 
|   48  |   48  | 
 |   49  | 
 |   50 /** | 
 |   51  * The app ID of the video player app. | 
 |   52  * @const | 
 |   53  * @type {string} | 
 |   54  */ | 
 |   55 FileTasks.VIDEO_PLAYER_ID = 'jcgeabjmjgoblfofpppfkcoakmfobdko'; | 
 |   56  | 
|   49 /** |   57 /** | 
|   50  * Returns URL of the Chrome Web Store which show apps supporting the given |   58  * Returns URL of the Chrome Web Store which show apps supporting the given | 
|   51  * file-extension and mime-type. |   59  * file-extension and mime-type. | 
|   52  * |   60  * | 
|   53  * @param {string} extension Extension of the file (with the first dot). |   61  * @param {string} extension Extension of the file (with the first dot). | 
|   54  * @param {string} mimeType Mime type of the file. |   62  * @param {string} mimeType Mime type of the file. | 
|   55  * @return {string} URL |   63  * @return {string} URL | 
|   56  */ |   64  */ | 
|   57 FileTasks.createWebStoreLink = function(extension, mimeType) { |   65 FileTasks.createWebStoreLink = function(extension, mimeType) { | 
|   58   if (!extension) |   66   if (!extension) | 
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  182 FileTasks.isInternalTask_ = function(taskId) { |  190 FileTasks.isInternalTask_ = function(taskId) { | 
|  183   var taskParts = taskId.split('|'); |  191   var taskParts = taskId.split('|'); | 
|  184   var appId = taskParts[0]; |  192   var appId = taskParts[0]; | 
|  185   var taskType = taskParts[1]; |  193   var taskType = taskParts[1]; | 
|  186   var actionId = taskParts[2]; |  194   var actionId = taskParts[2]; | 
|  187   // The action IDs here should match ones used in executeInternalTask_(). |  195   // The action IDs here should match ones used in executeInternalTask_(). | 
|  188   return (appId === chrome.runtime.id && |  196   return (appId === chrome.runtime.id && | 
|  189           taskType === 'file' && |  197           taskType === 'file' && | 
|  190           (actionId === 'play' || |  198           (actionId === 'play' || | 
|  191            actionId === 'mount-archive' || |  199            actionId === 'mount-archive' || | 
|  192            actionId === 'gallery')); |  200            actionId === 'gallery' || | 
 |  201            actionId === 'gallery-video')); | 
|  193 }; |  202 }; | 
|  194  |  203  | 
|  195 /** |  204 /** | 
|  196  * Processes internal tasks. |  205  * Processes internal tasks. | 
|  197  * |  206  * | 
|  198  * @param {Array.<Object>} tasks The tasks. |  207  * @param {Array.<Object>} tasks The tasks. | 
|  199  * @private |  208  * @private | 
|  200  */ |  209  */ | 
|  201 FileTasks.prototype.processTasks_ = function(tasks) { |  210 FileTasks.prototype.processTasks_ = function(tasks) { | 
|  202   this.tasks_ = []; |  211   this.tasks_ = []; | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
|  224     // Tweak images, titles of internal tasks. |  233     // Tweak images, titles of internal tasks. | 
|  225     if (taskParts[0] === id && taskParts[1] === 'file') { |  234     if (taskParts[0] === id && taskParts[1] === 'file') { | 
|  226       if (taskParts[2] === 'play') { |  235       if (taskParts[2] === 'play') { | 
|  227         // TODO(serya): This hack needed until task.iconUrl is working |  236         // TODO(serya): This hack needed until task.iconUrl is working | 
|  228         //             (see GetFileTasksFileBrowserFunction::RunImpl). |  237         //             (see GetFileTasksFileBrowserFunction::RunImpl). | 
|  229         task.iconType = 'audio'; |  238         task.iconType = 'audio'; | 
|  230         task.title = loadTimeData.getString('ACTION_LISTEN'); |  239         task.title = loadTimeData.getString('ACTION_LISTEN'); | 
|  231       } else if (taskParts[2] === 'mount-archive') { |  240       } else if (taskParts[2] === 'mount-archive') { | 
|  232         task.iconType = 'archive'; |  241         task.iconType = 'archive'; | 
|  233         task.title = loadTimeData.getString('MOUNT_ARCHIVE'); |  242         task.title = loadTimeData.getString('MOUNT_ARCHIVE'); | 
|  234       } else if (taskParts[2] === 'gallery') { |  243       } else if (taskParts[2] === 'gallery' || | 
 |  244                  taskParts[2] === 'gallery-video') { | 
|  235         task.iconType = 'image'; |  245         task.iconType = 'image'; | 
|  236         task.title = loadTimeData.getString('ACTION_OPEN'); |  246         task.title = loadTimeData.getString('ACTION_OPEN'); | 
|  237       } else if (taskParts[2] === 'open-hosted-generic') { |  247       } else if (taskParts[2] === 'open-hosted-generic') { | 
|  238         if (this.entries_.length > 1) |  248         if (this.entries_.length > 1) | 
|  239           task.iconType = 'generic'; |  249           task.iconType = 'generic'; | 
|  240         else // Use specific icon. |  250         else // Use specific icon. | 
|  241           task.iconType = FileType.getIcon(this.entries_[0]); |  251           task.iconType = FileType.getIcon(this.entries_[0]); | 
|  242         task.title = loadTimeData.getString('ACTION_OPEN'); |  252         task.title = loadTimeData.getString('ACTION_OPEN'); | 
|  243       } else if (taskParts[2] === 'open-hosted-gdoc') { |  253       } else if (taskParts[2] === 'open-hosted-gdoc') { | 
|  244         task.iconType = 'gdoc'; |  254         task.iconType = 'gdoc'; | 
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  545                                           displayedId); |  555                                           displayedId); | 
|  546     }); |  556     }); | 
|  547     return; |  557     return; | 
|  548   } |  558   } | 
|  549  |  559  | 
|  550   if (id === 'mount-archive') { |  560   if (id === 'mount-archive') { | 
|  551     this.mountArchivesInternal_(entries); |  561     this.mountArchivesInternal_(entries); | 
|  552     return; |  562     return; | 
|  553   } |  563   } | 
|  554  |  564  | 
|  555   if (id === 'gallery') { |  565   if (id === 'gallery' || id === 'gallery-video') { | 
|  556     this.openGalleryInternal_(entries); |  566     this.openGalleryInternal_(entries); | 
|  557     return; |  567     return; | 
|  558   } |  568   } | 
|  559  |  569  | 
|  560   console.error('Unexpected action ID: ' + id); |  570   console.error('Unexpected action ID: ' + id); | 
|  561 }; |  571 }; | 
|  562  |  572  | 
|  563 /** |  573 /** | 
|  564  * Mounts archives. |  574  * Mounts archives. | 
|  565  * |  575  * | 
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  850       this.pendingInvocations_.push([privateMethod, arguments]); |  860       this.pendingInvocations_.push([privateMethod, arguments]); | 
|  851     } |  861     } | 
|  852     return this; |  862     return this; | 
|  853   }; |  863   }; | 
|  854 }; |  864 }; | 
|  855  |  865  | 
|  856 FileTasks.decorate('display'); |  866 FileTasks.decorate('display'); | 
|  857 FileTasks.decorate('updateMenuItem'); |  867 FileTasks.decorate('updateMenuItem'); | 
|  858 FileTasks.decorate('execute'); |  868 FileTasks.decorate('execute'); | 
|  859 FileTasks.decorate('executeDefault'); |  869 FileTasks.decorate('executeDefault'); | 
| OLD | NEW |