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

Unified Diff: chrome/browser/resources/file_manager/foreground/js/file_tasks.js

Issue 215103003: [Files.app] Hide video-player related task menu according to condition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/foreground/js/file_tasks.js
diff --git a/chrome/browser/resources/file_manager/foreground/js/file_tasks.js b/chrome/browser/resources/file_manager/foreground/js/file_tasks.js
index 63e460ee8b81d753eb049763233266cf0f154340..cdcb9a3f90f070692fb63804c9f4a896b7b0222e 100644
--- a/chrome/browser/resources/file_manager/foreground/js/file_tasks.js
+++ b/chrome/browser/resources/file_manager/foreground/js/file_tasks.js
@@ -46,6 +46,14 @@ FileTasks.CHROME_WEB_STORE_URL = 'https://chrome.google.com/webstore';
FileTasks.WEB_STORE_HANDLER_BASE_URL =
'https://chrome.google.com/webstore/category/collection/file_handlers';
+
+/**
+ * The app ID of the video player app.
+ * @const
+ * @type {string}
+ */
+FileTasks.VIDEO_PLAYER_ID = 'jcgeabjmjgoblfofpppfkcoakmfobdko';
+
/**
* Returns URL of the Chrome Web Store which show apps supporting the given
* file-extension and mime-type.
@@ -189,7 +197,8 @@ FileTasks.isInternalTask_ = function(taskId) {
taskType === 'file' &&
(actionId === 'play' ||
actionId === 'mount-archive' ||
- actionId === 'gallery'));
+ actionId === 'gallery' ||
+ actionId === 'gallery-video'));
};
/**
@@ -203,6 +212,7 @@ FileTasks.prototype.processTasks_ = function(tasks) {
var id = chrome.runtime.id;
var isOnDrive = false;
var fm = this.fileManager_;
+ var isMultiple = (this.entries_.length > 1);
for (var index = 0; index < this.entries_.length; ++index) {
var locationInfo = fm.volumeManager.getLocationInfo(this.entries_[index]);
if (locationInfo && locationInfo.isDriveBased) {
@@ -221,6 +231,22 @@ FileTasks.prototype.processTasks_ = function(tasks) {
continue;
}
+ // Skip video player app if multiple files are selected.
hirono 2014/03/28 05:35:22 Not so strong opinion. How about filtering the tas
yoshiki 2014/03/28 06:53:10 Done.
+ if (isMultiple &&
+ taskParts[0] === FileTasks.VIDEO_PLAYER_ID &&
+ taskParts[1] === 'app' &&
+ taskParts[2] === 'video') {
+ continue;
+ }
+
+ // Skip gallaly (video mode) if a single files is selected.
+ if (!isMultiple &&
+ taskParts[0] === id &&
+ taskParts[1] === 'file' &&
+ taskParts[2] === 'gallery-video') {
+ continue;
+ }
+
// Tweak images, titles of internal tasks.
if (taskParts[0] === id && taskParts[1] === 'file') {
if (taskParts[2] === 'play') {
@@ -231,7 +257,8 @@ FileTasks.prototype.processTasks_ = function(tasks) {
} else if (taskParts[2] === 'mount-archive') {
task.iconType = 'archive';
task.title = loadTimeData.getString('MOUNT_ARCHIVE');
- } else if (taskParts[2] === 'gallery') {
+ } else if (taskParts[2] === 'gallery' ||
+ taskParts[2] === 'gallery-video') {
task.iconType = 'image';
task.title = loadTimeData.getString('ACTION_OPEN');
} else if (taskParts[2] === 'open-hosted-generic') {
@@ -552,7 +579,7 @@ FileTasks.prototype.executeInternalTask_ = function(id, entries) {
return;
}
- if (id === 'gallery') {
+ if (id === 'gallery' || id === 'gallery-video') {
this.openGalleryInternal_(entries);
return;
}

Powered by Google App Engine
This is Rietveld 408576698