| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * The list of known extensions to record UMA. | 128 * The list of known extensions to record UMA. |
| 129 * Note: Because the data is recorded by the index, so new item shouldn't be | 129 * Note: Because the data is recorded by the index, so new item shouldn't be |
| 130 * inserted. | 130 * inserted. |
| 131 * | 131 * |
| 132 * @const | 132 * @const |
| 133 * @type {Array.<string>} | 133 * @type {Array.<string>} |
| 134 * @private | 134 * @private |
| 135 */ | 135 */ |
| 136 FileTasks.knownExtensions_ = [ | 136 FileTasks.UMA_INDEX_KNOWN_EXTENSIONS_ = Object.freeze([ |
| 137 'other', '.3ga', '.3gp', '.aac', '.alac', '.asf', '.avi', '.bmp', '.csv', | 137 'other', '.3ga', '.3gp', '.aac', '.alac', '.asf', '.avi', '.bmp', '.csv', |
| 138 '.doc', '.docx', '.flac', '.gif', '.ico', '.jpeg', '.jpg', '.log', '.m3u', | 138 '.doc', '.docx', '.flac', '.gif', '.jpeg', '.jpg', '.log', '.m3u', '.m3u8', |
| 139 '.m3u8', '.m4a', '.m4v', '.mid', '.mkv', '.mov', '.mp3', '.mp4', '.mpg', | 139 '.m4a', '.m4v', '.mid', '.mkv', '.mov', '.mp3', '.mp4', '.mpg', '.odf', |
| 140 '.odf', '.odp', '.ods', '.odt', '.oga', '.ogg', '.ogv', '.pdf', '.png', | 140 '.odp', '.ods', '.odt', '.oga', '.ogg', '.ogv', '.pdf', '.png', '.ppt', |
| 141 '.ppt', '.pptx', '.ra', '.ram', '.rar', '.rm', '.rtf', '.wav', '.webm', | 141 '.pptx', '.ra', '.ram', '.rar', '.rm', '.rtf', '.wav', '.webm', '.webp', |
| 142 '.webp', '.wma', '.wmv', '.xls', '.xlsx', | 142 '.wma', '.wmv', '.xls', '.xlsx', |
| 143 ]; | 143 ]); |
| 144 | 144 |
| 145 /** | 145 /** |
| 146 * The list of excutable file extensions. | 146 * The list of excutable file extensions. |
| 147 * | 147 * |
| 148 * @const | 148 * @const |
| 149 * @type {Array.<string>} | 149 * @type {Array.<string>} |
| 150 */ | 150 */ |
| 151 FileTasks.EXECUTABLE_EXTENSIONS = Object.freeze([ | 151 FileTasks.EXECUTABLE_EXTENSIONS = Object.freeze([ |
| 152 '.exe', '.lnk', '.deb', '.dmg', '.jar', '.msi', | 152 '.exe', '.lnk', '.deb', '.dmg', '.jar', '.msi', |
| 153 ]); | 153 ]); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 165 /** | 165 /** |
| 166 * Records trial of opening file grouped by extensions. | 166 * Records trial of opening file grouped by extensions. |
| 167 * | 167 * |
| 168 * @param {Array.<Entry>} entries The entries to be opened. | 168 * @param {Array.<Entry>} entries The entries to be opened. |
| 169 * @private | 169 * @private |
| 170 */ | 170 */ |
| 171 FileTasks.recordViewingFileTypeUMA_ = function(entries) { | 171 FileTasks.recordViewingFileTypeUMA_ = function(entries) { |
| 172 for (var i = 0; i < entries.length; i++) { | 172 for (var i = 0; i < entries.length; i++) { |
| 173 var entry = entries[i]; | 173 var entry = entries[i]; |
| 174 var extension = FileType.getExtension(entry).toLowerCase(); | 174 var extension = FileType.getExtension(entry).toLowerCase(); |
| 175 if (FileTasks.knownExtensions_.indexOf(extension) < 0) { | 175 if (FileTasks.UMA_INDEX_KNOWN_EXTENSIONS_.indexOf(extension) < 0) { |
| 176 extension = 'other'; | 176 extension = 'other'; |
| 177 } | 177 } |
| 178 metrics.recordEnum( | 178 metrics.recordEnum( |
| 179 'ViewingFileType', extension, FileTasks.knownExtensions_); | 179 'ViewingFileType', extension, FileTasks.UMA_INDEX_KNOWN_EXTENSIONS_); |
| 180 } | 180 } |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 /** | 183 /** |
| 184 * Returns true if the taskId is for an internal task. | 184 * Returns true if the taskId is for an internal task. |
| 185 * | 185 * |
| 186 * @param {string} taskId Task identifier. | 186 * @param {string} taskId Task identifier. |
| 187 * @return {boolean} True if the task ID is for an internal task. | 187 * @return {boolean} True if the task ID is for an internal task. |
| 188 * @private | 188 * @private |
| 189 */ | 189 */ |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 items, defaultIdx, | 857 items, defaultIdx, |
| 858 function(item) { | 858 function(item) { |
| 859 onSuccess(item.task); | 859 onSuccess(item.task); |
| 860 }); | 860 }); |
| 861 }; | 861 }; |
| 862 | 862 |
| 863 FileTasks.decorate('display'); | 863 FileTasks.decorate('display'); |
| 864 FileTasks.decorate('updateMenuItem'); | 864 FileTasks.decorate('updateMenuItem'); |
| 865 FileTasks.decorate('execute'); | 865 FileTasks.decorate('execute'); |
| 866 FileTasks.decorate('executeDefault'); | 866 FileTasks.decorate('executeDefault'); |
| OLD | NEW |