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

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

Issue 9395077: [filebrowser] Introduce View action for supported file types (e.g. pdf). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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/js/file_manager.js
===================================================================
--- chrome/browser/resources/file_manager/js/file_manager.js (revision 125140)
+++ chrome/browser/resources/file_manager/js/file_manager.js (working copy)
@@ -2173,6 +2173,7 @@
FileManager.prototype.onTasksFound_ = function(selection, tasksList) {
this.taskItems_.clear();
+ var tasksCount = 0;
for (var i = 0; i < tasksList.length; i++) {
var task = tasksList[i];
@@ -2194,15 +2195,30 @@
} else if (task_parts[1] == 'gallery') {
task.iconUrl =
chrome.extension.getURL('images/icon_preview_16x16.png');
- task.title = str('GALLERY');
+ task.title = str('OPEN_ACTION');
task.allTasks = tasksList;
- this.galleryTask_ = task;
+ } else if (task_parts[1] == 'view-pdf') {
+ // Do not render this task if disabled.
+ if (str('PDF_VIEW_ENABLED') == 'false') continue;
+ task.iconUrl =
+ chrome.extension.getURL('images/icon_preview_16x16.png');
+ task.title = str('OPEN_ACTION');
+ } else if (task_parts[1] == 'view-txt') {
+ task.iconUrl =
+ chrome.extension.getURL('images/icon_preview_16x16.png');
+ task.title = str('OPEN_ACTION');
+ } else if (task_parts[1] == 'install-crx') {
+ // TODO(dgozman): change to the right icon.
+ task.iconUrl =
+ chrome.extension.getURL('images/icon_preview_16x16.png');
+ task.title = str('INSTALL_CRX');
}
}
this.renderTaskItem_(task);
+ tasksCount++;
}
- this.taskItems_.visible = tasksList.length > 0;
+ this.taskItems_.visible = tasksCount > 0;
selection.tasksList = tasksList;
if (selection.dispatchDefault) {
@@ -2458,6 +2474,8 @@
}
}
this.openGallery_(urls, noGallery);
+ } else if (id == 'view-pdf' || id == 'view-txt' || id == 'install-crx') {
+ chrome.fileBrowserPrivate.viewFiles(urls, 'default', function() {});
}
};
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager_util.cc ('k') | chrome/browser/resources/file_manager/js/mock_chrome.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698