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

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

Issue 10804010: HiDPI assets for Chrome OS Files app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed ID ranges to accommodate new resources Created 8 years, 5 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 /** 46 /**
47 * Processes internal tasks. 47 * Processes internal tasks.
48 * @param {Array.<Object>} tasks The tasks. 48 * @param {Array.<Object>} tasks The tasks.
49 * @private 49 * @private
50 */ 50 */
51 FileTasks.prototype.processTasks_ = function(tasks) { 51 FileTasks.prototype.processTasks_ = function(tasks) {
52 this.tasks_ = []; 52 this.tasks_ = [];
53 var id = this.fileManager_.getExtensionId(); 53 var id = this.fileManager_.getExtensionId();
54 54
55 // TODO(kaznacheev): Teach menu items to use HiDPI assets.
56 function getFileTypeIcon(type) {
57 return chrome.extension.getURL(
58 'images/files/file_types/' + type + '.png');
59 }
60
55 for (var i = 0; i < tasks.length; i++) { 61 for (var i = 0; i < tasks.length; i++) {
56 var task = tasks[i]; 62 var task = tasks[i];
57 63
58 // Tweak images, titles of internal tasks. 64 // Tweak images, titles of internal tasks.
59 var task_parts = task.taskId.split('|'); 65 var task_parts = task.taskId.split('|');
60 if (task_parts[0] == id) { 66 if (task_parts[0] == id) {
61 if (task_parts[1] == 'play') { 67 if (task_parts[1] == 'play') {
62 // TODO(serya): This hack needed until task.iconUrl is working 68 // TODO(serya): This hack needed until task.iconUrl is working
63 // (see GetFileTasksFileBrowserFunction::RunImpl). 69 // (see GetFileTasksFileBrowserFunction::RunImpl).
64 task.iconUrl = 70 task.iconUrl = getFileTypeIcon('audio');
65 chrome.extension.getURL('images/filetype_audio.png');
66 task.title = loadTimeData.getString('ACTION_LISTEN'); 71 task.title = loadTimeData.getString('ACTION_LISTEN');
67 } else if (task_parts[1] == 'mount-archive') { 72 } else if (task_parts[1] == 'mount-archive') {
68 task.iconUrl = 73 task.iconUrl = getFileTypeIcon('archive');
69 chrome.extension.getURL('images/filetype_archive.png');
70 task.title = loadTimeData.getString('MOUNT_ARCHIVE'); 74 task.title = loadTimeData.getString('MOUNT_ARCHIVE');
71 } else if (task_parts[1] == 'gallery') { 75 } else if (task_parts[1] == 'gallery') {
76 task.iconUrl = getFileTypeIcon('image');
72 task.title = loadTimeData.getString('ACTION_OPEN'); 77 task.title = loadTimeData.getString('ACTION_OPEN');
73 task.iconUrl =
74 chrome.extension.getURL('images/filetype_image.png');
75 } else if (task_parts[1] == 'watch') { 78 } else if (task_parts[1] == 'watch') {
76 task.iconUrl = 79 task.iconUrl = getFileTypeIcon('video');
77 chrome.extension.getURL('images/filetype_video.png');
78 task.title = loadTimeData.getString('ACTION_WATCH'); 80 task.title = loadTimeData.getString('ACTION_WATCH');
79 } else if (task_parts[1] == 'open-hosted') { 81 } else if (task_parts[1] == 'open-hosted') {
80 if (this.urls_.length > 1) { 82 if (this.urls_.length > 1)
81 task.iconUrl = 83 task.iconUrl = getFileTypeIcon('generic');
82 chrome.extension.getURL('images/filetype_generic.png'); 84 else // Use specific icon.
83 } else { 85 task.iconUrl = getFileTypeIcon(FileType.getIcon(this.urls_[0]));
84 // Use specific icon.
85 var icon = FileType.getIcon(this.urls_[0]);
86 task.iconUrl =
87 chrome.extension.getURL('images/filetype_' + icon + '.png');
88 }
89 task.title = loadTimeData.getString('ACTION_OPEN'); 86 task.title = loadTimeData.getString('ACTION_OPEN');
90 } else if (task_parts[1] == 'view-pdf') { 87 } else if (task_parts[1] == 'view-pdf') {
91 // Do not render this task if disabled. 88 // Do not render this task if disabled.
92 if (!loadTimeData.getBoolean('PDF_VIEW_ENABLED')) 89 if (!loadTimeData.getBoolean('PDF_VIEW_ENABLED'))
93 continue; 90 continue;
94 task.iconUrl = 91 task.iconUrl = getFileTypeIcon('pdf');
95 chrome.extension.getURL('images/filetype_pdf.png');
96 task.title = loadTimeData.getString('ACTION_VIEW'); 92 task.title = loadTimeData.getString('ACTION_VIEW');
97 } else if (task_parts[1] == 'view-in-browser') { 93 } else if (task_parts[1] == 'view-in-browser') {
98 task.iconUrl = 94 task.iconUrl = getFileTypeIcon('generic');
99 chrome.extension.getURL('images/filetype_generic.png');
100 task.title = loadTimeData.getString('ACTION_VIEW'); 95 task.title = loadTimeData.getString('ACTION_VIEW');
101 } else if (task_parts[1] == 'install-crx') { 96 } else if (task_parts[1] == 'install-crx') {
102 task.iconUrl = 97 task.iconUrl = getFileTypeIcon('generic');
103 chrome.extension.getURL('images/filetype_generic.png');
104 task.title = loadTimeData.getString('INSTALL_CRX'); 98 task.title = loadTimeData.getString('INSTALL_CRX');
105 } 99 }
106 } 100 }
107 101
108 this.tasks_.push(task); 102 this.tasks_.push(task);
109 if (this.defaultTask_ == null) { 103 if (this.defaultTask_ == null) {
110 this.defaultTask_ = task; 104 this.defaultTask_ = task;
111 } 105 }
112 } 106 }
113 }; 107 };
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 return this; 496 return this;
503 }; 497 };
504 }; 498 };
505 499
506 FileTasks.decorate('display'); 500 FileTasks.decorate('display');
507 FileTasks.decorate('updateMenuItem'); 501 FileTasks.decorate('updateMenuItem');
508 FileTasks.decorate('execute'); 502 FileTasks.decorate('execute');
509 FileTasks.decorate('executeDefault'); 503 FileTasks.decorate('executeDefault');
510 FileTasks.decorate('getExternals'); 504 FileTasks.decorate('getExternals');
511 505
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698