Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Side by Side Diff: chrome/browser/resources/file_manager/js/file_tasks.js

Issue 10832185: FileBrowser: Hide DriveApps on Open-with menu when the selected file is not on drive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 */ 9 */
10 function FileTasks(fileManager, urls) { 10 function FileTasks(fileManager, urls) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 }; 49 };
50 50
51 /** 51 /**
52 * Processes internal tasks. 52 * Processes internal tasks.
53 * @param {Array.<Object>} tasks The tasks. 53 * @param {Array.<Object>} tasks The tasks.
54 * @private 54 * @private
55 */ 55 */
56 FileTasks.prototype.processTasks_ = function(tasks) { 56 FileTasks.prototype.processTasks_ = function(tasks) {
57 this.tasks_ = []; 57 this.tasks_ = [];
58 var id = this.fileManager_.getExtensionId(); 58 var id = this.fileManager_.getExtensionId();
59 var is_on_drive = false;
60 for (var index = 0; index < this.urls_.length; ++index) {
61 if (FileType.isOnGDrive(this.urls_[index])) {
62 is_on_drive = true;
63 break;
64 }
65 }
59 66
60 for (var i = 0; i < tasks.length; i++) { 67 for (var i = 0; i < tasks.length; i++) {
61 var task = tasks[i]; 68 var task = tasks[i];
62 69
70 // Skip Drive App if the file is on Drive.
71 if (!is_on_drive && task.driveApp)
72 continue;
73
63 // Tweak images, titles of internal tasks. 74 // Tweak images, titles of internal tasks.
64 var task_parts = task.taskId.split('|'); 75 var task_parts = task.taskId.split('|');
65 if (task_parts[0] == id) { 76 if (task_parts[0] == id) {
66 if (task_parts[1] == 'play') { 77 if (task_parts[1] == 'play') {
67 // TODO(serya): This hack needed until task.iconUrl is working 78 // TODO(serya): This hack needed until task.iconUrl is working
68 // (see GetFileTasksFileBrowserFunction::RunImpl). 79 // (see GetFileTasksFileBrowserFunction::RunImpl).
69 task.iconType = 'audio'; 80 task.iconType = 'audio';
70 task.title = loadTimeData.getString('ACTION_LISTEN'); 81 task.title = loadTimeData.getString('ACTION_LISTEN');
71 } else if (task_parts[1] == 'mount-archive') { 82 } else if (task_parts[1] == 'mount-archive') {
72 task.iconType = 'archive'; 83 task.iconType = 'archive';
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 return this; 512 return this;
502 }; 513 };
503 }; 514 };
504 515
505 FileTasks.decorate('display'); 516 FileTasks.decorate('display');
506 FileTasks.decorate('updateMenuItem'); 517 FileTasks.decorate('updateMenuItem');
507 FileTasks.decorate('execute'); 518 FileTasks.decorate('execute');
508 FileTasks.decorate('executeDefault'); 519 FileTasks.decorate('executeDefault');
509 FileTasks.decorate('getExternals'); 520 FileTasks.decorate('getExternals');
510 521
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_private_api.cc ('k') | chrome/common/extensions/api/file_browser_private.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698