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

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

Issue 7776031: Handling file actions in only one instance of file manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handling internal tasks around chrome.fileBrowserPrivate.executeTask. Created 9 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Setting the src of an img to an empty string can crash the browser, so we 5 // Setting the src of an img to an empty string can crash the browser, so we
6 // use an empty 1x1 gif instead. 6 // use an empty 1x1 gif instead.
7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' 7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,'
8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; 8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D';
9 9
10 var g_slideshow_data = null; 10 var g_slideshow_data = null;
(...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 */ 1649 */
1650 FileManager.prototype.onTasksFound_ = function(selection, tasksList) { 1650 FileManager.prototype.onTasksFound_ = function(selection, tasksList) {
1651 this.taskButtons_.innerHTML = ''; 1651 this.taskButtons_.innerHTML = '';
1652 1652
1653 for (var i = 0; i < tasksList.length; i++) { 1653 for (var i = 0; i < tasksList.length; i++) {
1654 var task = tasksList[i]; 1654 var task = tasksList[i];
1655 1655
1656 // Tweak images, titles of internal tasks. 1656 // Tweak images, titles of internal tasks.
1657 var task_parts = task.taskId.split('|'); 1657 var task_parts = task.taskId.split('|');
1658 if (task_parts[0] == this.getExtensionId_()) { 1658 if (task_parts[0] == this.getExtensionId_()) {
1659 task.internal = true;
1659 if (task_parts[1] == 'preview') { 1660 if (task_parts[1] == 'preview') {
1660 // TODO(serya): This hack needed until task.iconUrl get working 1661 // TODO(serya): This hack needed until task.iconUrl get working
1661 // (see GetFileTasksFileBrowserFunction::RunImpl). 1662 // (see GetFileTasksFileBrowserFunction::RunImpl).
1662 task.iconUrl = 1663 task.iconUrl =
1663 chrome.extension.getURL('images/icon_preview_16x16.png'); 1664 chrome.extension.getURL('images/icon_preview_16x16.png');
1664 task.title = str('PREVIEW_IMAGE'); 1665 task.title = str('PREVIEW_IMAGE');
1665 } else if (task_parts[1] == 'edit') { 1666 } else if (task_parts[1] == 'edit') {
1666 task.iconUrl = 1667 task.iconUrl =
1667 chrome.extension.getURL('images/icon_preview_16x16.png'); 1668 chrome.extension.getURL('images/icon_preview_16x16.png');
1668 task.title = 'Edit'; 1669 task.title = 'Edit';
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 } 1784 }
1784 1785
1785 chrome.fileBrowserPrivate.getMountPoints(onMountPointsFound); 1786 chrome.fileBrowserPrivate.getMountPoints(onMountPointsFound);
1786 }; 1787 };
1787 1788
1788 FileManager.prototype.getExtensionId_ = function() { 1789 FileManager.prototype.getExtensionId_ = function() {
1789 return chrome.extension.getURL('').split('/')[2]; 1790 return chrome.extension.getURL('').split('/')[2];
1790 }; 1791 };
1791 1792
1792 FileManager.prototype.onTaskButtonClicked_ = function(event) { 1793 FileManager.prototype.onTaskButtonClicked_ = function(event) {
1793 chrome.fileBrowserPrivate.executeTask(event.srcElement.task.taskId, 1794 var task = event.srcElement.task;
1795 if (task.internal) {
1796 // For internal tasks call the handler directly to avoid being handled
1797 // multiple times.
1798 var taskId = task.taskId.split('|')[1];
1799 this.onFileTaskExecute_(taskId, {entries: this.selection.entries});
1800 return;
1801 }
1802 chrome.fileBrowserPrivate.executeTask(task.taskId,
1794 this.selection.urls); 1803 this.selection.urls);
1795 }; 1804 };
1796 1805
1797 /** 1806 /**
1798 * Event handler called when some volume was mounted or unmouted. 1807 * Event handler called when some volume was mounted or unmouted.
1799 */ 1808 */
1800 FileManager.prototype.onMountCompleted_ = function(event) { 1809 FileManager.prototype.onMountCompleted_ = function(event) {
1801 var self = this; 1810 var self = this;
1802 chrome.fileBrowserPrivate.getMountPoints(function(mountPoints) { 1811 chrome.fileBrowserPrivate.getMountPoints(function(mountPoints) {
1803 self.mountPoints_ = mountPoints; 1812 self.mountPoints_ = mountPoints;
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
3266 3275
3267 if (msg) { 3276 if (msg) {
3268 console.log('no no no'); 3277 console.log('no no no');
3269 this.alert.show(msg, onAccept); 3278 this.alert.show(msg, onAccept);
3270 return false; 3279 return false;
3271 } 3280 }
3272 3281
3273 return true; 3282 return true;
3274 }; 3283 };
3275 })(); 3284 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698