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

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

Issue 10824145: Move all the butter bar code to a separate class. Fix some style, method & variable names and simpl… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix progress bar. 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 * FileManager constructor. 6 * FileManager constructor.
7 * 7 *
8 * FileManager objects encapsulate the functionality of the file selector 8 * FileManager objects encapsulate the functionality of the file selector
9 * dialogs, as well as the full screen file manager application (though the 9 * dialogs, as well as the full screen file manager application (though the
10 * latter is not yet implemented). 10 * latter is not yet implemented).
11 * 11 *
12 * @constructor 12 * @constructor
13 * @param {HTMLElement} dialogDom The DOM node containing the prototypical 13 * @param {HTMLElement} dialogDom The DOM node containing the prototypical
14 * dialog UI. 14 * dialog UI.
15 */ 15 */
16 function FileManager(dialogDom) { 16 function FileManager(dialogDom) {
17 this.dialogDom_ = dialogDom; 17 this.dialogDom_ = dialogDom;
18 this.filesystem_ = null; 18 this.filesystem_ = null;
19 this.params_ = location.search ? 19 this.params_ = location.search ?
20 JSON.parse(decodeURIComponent(location.search.substr(1))) : 20 JSON.parse(decodeURIComponent(location.search.substr(1))) :
21 {}; 21 {};
22 this.listType_ = null; 22 this.listType_ = null;
23 this.showDelayTimeout_ = null; 23 this.showDelayTimeout_ = null;
24 24
25 this.selection = null; 25 this.selection = null;
26 26
27 this.butterTimer_ = null;
28 this.currentButter_ = null;
29 this.butterLastShowTime_ = 0;
30
31 this.filesystemObserverId_ = null; 27 this.filesystemObserverId_ = null;
32 this.gdataObserverId_ = null; 28 this.gdataObserverId_ = null;
33 29
34 this.commands_ = {}; 30 this.commands_ = {};
35 31
36 this.document_ = dialogDom.ownerDocument; 32 this.document_ = dialogDom.ownerDocument;
37 this.dialogType_ = this.params_.type || FileManager.DialogType.FULL_PAGE; 33 this.dialogType_ = this.params_.type || FileManager.DialogType.FULL_PAGE;
38 34
39 // Optional list of file types. 35 // Optional list of file types.
40 this.fileTypes_ = this.params_.typeList || []; 36 this.fileTypes_ = this.params_.typeList || [];
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 */ 104 */
109 var MAX_PREVIEW_THUMBAIL_COUNT = 4; 105 var MAX_PREVIEW_THUMBAIL_COUNT = 4;
110 106
111 /** 107 /**
112 * Maximum width or height of an image what pops up when the mouse hovers 108 * Maximum width or height of an image what pops up when the mouse hovers
113 * thumbnail in the bottom panel (in pixels). 109 * thumbnail in the bottom panel (in pixels).
114 */ 110 */
115 var IMAGE_HOVER_PREVIEW_SIZE = 200; 111 var IMAGE_HOVER_PREVIEW_SIZE = 200;
116 112
117 /** 113 /**
118 * The minimum about of time to display the butter bar for, in ms.
119 * Justification is 1000ms for minimum display time plus 300ms for transition
120 * duration.
121 */
122 var MINIMUM_BUTTER_DISPLAY_TIME_MS = 1300;
123
124 /**
125 * Number of milliseconds in a day. 114 * Number of milliseconds in a day.
126 */ 115 */
127 var MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000; 116 var MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000;
128 117
129 /** 118 /**
130 * Item for the Grid View. 119 * Item for the Grid View.
131 * @param {FileManager} fileManager FileManager instance. 120 * @param {FileManager} fileManager FileManager instance.
132 * @param {boolean} showCheckbox True if select checkbox should be visible 121 * @param {boolean} showCheckbox True if select checkbox should be visible
133 * @param {Entry} entry File entry. 122 * @param {Entry} entry File entry.
134 * @constructor 123 * @constructor
(...skipping 21 matching lines...) Expand all
156 * @param {FileManager} fileManager FileManager instance. 145 * @param {FileManager} fileManager FileManager instance.
157 * @param {boolean} showCheckbox True if select checkbox should be visible 146 * @param {boolean} showCheckbox True if select checkbox should be visible
158 * @param {Entry} entry File entry. 147 * @param {Entry} entry File entry.
159 */ 148 */
160 GridItem.decorate = function(li, fileManager, showCheckbox, entry) { 149 GridItem.decorate = function(li, fileManager, showCheckbox, entry) {
161 li.__proto__ = GridItem.prototype; 150 li.__proto__ = GridItem.prototype;
162 fileManager.decorateThumbnail_(li, showCheckbox, entry); 151 fileManager.decorateThumbnail_(li, showCheckbox, entry);
163 }; 152 };
164 153
165 /** 154 /**
166 * Return a translated string.
167 *
168 * Wrapper function to make dealing with translated strings more concise.
169 * Equivalent to loadTimeData.getString(id).
170 *
171 * @param {string} id The id of the string to return.
172 * @return {string} The translated string.
173 */
174 function str(id) {
175 return loadTimeData.getString(id);
176 }
177
178 /**
179 * Return a translated string with arguments replaced.
180 *
181 * Wrapper function to make dealing with translated strings more concise.
182 * Equivilant to loadTimeData.getStringF(id, ...).
183 *
184 * @param {string} id The id of the string to return.
185 * @param {...string} The values to replace into the string.
186 * @return {string} The translated string with replaced values.
187 */
188 function strf(id, var_args) {
189 return loadTimeData.getStringF.apply(loadTimeData, arguments);
190 }
191
192 /**
193 * @param {number} code File error code (from FileError object). 155 * @param {number} code File error code (from FileError object).
194 * @return {string} Translated file error string. 156 * @return {string} Translated file error string.
195 */ 157 */
196 function getFileErrorString(code) { 158 function getFileErrorString(code) {
197 for (var key in FileError) { 159 for (var key in FileError) {
198 var match = /(.*)_ERR$/.exec(key); 160 var match = /(.*)_ERR$/.exec(key);
199 if (match && FileError[key] == code) { 161 if (match && FileError[key] == code) {
200 // This would convert 1 to 'NOT_FOUND'. 162 // This would convert 1 to 'NOT_FOUND'.
201 code = match[1]; 163 code = match[1];
202 break; 164 break;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 }; 482 };
521 483
522 FileManager.prototype.initDataTransferOperations_ = function() { 484 FileManager.prototype.initDataTransferOperations_ = function() {
523 this.copyManager_ = new FileCopyManagerWrapper.getInstance( 485 this.copyManager_ = new FileCopyManagerWrapper.getInstance(
524 this.filesystem_.root); 486 this.filesystem_.root);
525 this.copyManager_.addEventListener('copy-progress', 487 this.copyManager_.addEventListener('copy-progress',
526 this.onCopyProgress_.bind(this)); 488 this.onCopyProgress_.bind(this));
527 this.copyManager_.addEventListener('copy-operation-complete', 489 this.copyManager_.addEventListener('copy-operation-complete',
528 this.onCopyManagerOperationComplete_.bind(this)); 490 this.onCopyManagerOperationComplete_.bind(this));
529 491
492 this.butterBar_ = new ButterBar(this.dialogDom_, this.copyManager_);
493
530 var controller = this.fileTransferController_ = new FileTransferController( 494 var controller = this.fileTransferController_ = new FileTransferController(
531 GridItem.bind(null, this, false /* no checkbox */), 495 GridItem.bind(null, this, false /* no checkbox */),
532 this.copyManager_, 496 this.copyManager_,
533 this.directoryModel_); 497 this.directoryModel_);
534 controller.attachDragSource(this.table_.list); 498 controller.attachDragSource(this.table_.list);
535 controller.attachDropTarget(this.table_.list); 499 controller.attachDropTarget(this.table_.list);
536 controller.attachDragSource(this.grid_); 500 controller.attachDragSource(this.grid_);
537 controller.attachDropTarget(this.grid_); 501 controller.attachDropTarget(this.grid_);
538 controller.attachDropTarget(this.rootsList_, true); 502 controller.attachDropTarget(this.rootsList_, true);
539 controller.attachBreadcrumbsDropTarget(this.breadcrumbs_); 503 controller.attachBreadcrumbsDropTarget(this.breadcrumbs_);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 this.filenameInput_ = this.dialogDom_.querySelector( 570 this.filenameInput_ = this.dialogDom_.querySelector(
607 '#filename-input-box input'); 571 '#filename-input-box input');
608 this.taskItems_ = this.dialogDom_.querySelector('#tasks'); 572 this.taskItems_ = this.dialogDom_.querySelector('#tasks');
609 this.okButton_ = this.dialogDom_.querySelector('.ok'); 573 this.okButton_ = this.dialogDom_.querySelector('.ok');
610 this.cancelButton_ = this.dialogDom_.querySelector('.cancel'); 574 this.cancelButton_ = this.dialogDom_.querySelector('.cancel');
611 this.deleteButton_ = this.dialogDom_.querySelector('#delete-button'); 575 this.deleteButton_ = this.dialogDom_.querySelector('#delete-button');
612 this.table_ = this.dialogDom_.querySelector('.detail-table'); 576 this.table_ = this.dialogDom_.querySelector('.detail-table');
613 this.grid_ = this.dialogDom_.querySelector('.thumbnail-grid'); 577 this.grid_ = this.dialogDom_.querySelector('.thumbnail-grid');
614 this.spinner_ = this.dialogDom_.querySelector('#spinner-with-text'); 578 this.spinner_ = this.dialogDom_.querySelector('#spinner-with-text');
615 this.showSpinner_(false); 579 this.showSpinner_(false);
616 this.butter_ = this.dialogDom_.querySelector('.butter-bar');
617 this.unmountedPanel_ = this.dialogDom_.querySelector('#unmounted-panel'); 580 this.unmountedPanel_ = this.dialogDom_.querySelector('#unmounted-panel');
618 581
619 this.breadcrumbs_ = new BreadcrumbsController( 582 this.breadcrumbs_ = new BreadcrumbsController(
620 this.dialogDom_.querySelector('#dir-breadcrumbs')); 583 this.dialogDom_.querySelector('#dir-breadcrumbs'));
621 this.breadcrumbs_.addEventListener( 584 this.breadcrumbs_.addEventListener(
622 'pathclick', this.onBreadcrumbClick_.bind(this)); 585 'pathclick', this.onBreadcrumbClick_.bind(this));
623 this.searchBreadcrumbs_ = new BreadcrumbsController( 586 this.searchBreadcrumbs_ = new BreadcrumbsController(
624 this.dialogDom_.querySelector('#search-breadcrumbs')); 587 this.dialogDom_.querySelector('#search-breadcrumbs'));
625 this.searchBreadcrumbs_.addEventListener( 588 this.searchBreadcrumbs_.addEventListener(
626 'pathclick', this.onBreadcrumbClick_.bind(this)); 589 'pathclick', this.onBreadcrumbClick_.bind(this));
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 return this.collator_.compare(a.name, b.name); 895 return this.collator_.compare(a.name, b.name);
933 }; 896 };
934 897
935 FileManager.prototype.refocus = function() { 898 FileManager.prototype.refocus = function() {
936 if (this.dialogType_ == FileManager.DialogType.SELECT_SAVEAS_FILE) 899 if (this.dialogType_ == FileManager.DialogType.SELECT_SAVEAS_FILE)
937 this.filenameInput_.focus(); 900 this.filenameInput_.focus();
938 else 901 else
939 this.currentList_.focus(); 902 this.currentList_.focus();
940 }; 903 };
941 904
942 FileManager.prototype.showButter = function(message, opt_options) {
943 var butter = this.butter_;
944 if (opt_options) {
945 if ('actions' in opt_options) {
946 var actions = butter.querySelector('.actions');
947 while (actions.childNodes.length)
948 actions.removeChild(actions.firstChild);
949 for (var label in opt_options.actions) {
950 var link = this.document_.createElement('a');
951 link.addEventListener('click', function() {
952 opt_options.actions[label]();
953 return false;
954 });
955 actions.appendChild(link);
956 }
957 actions.classList.remove('hide-in-butter');
958 }
959 if ('progress' in opt_options) {
960 butter.querySelector('.progress-bar')
961 .classList.remove('hide-in-butter');
962 }
963 }
964
965 var self = this;
966
967 setTimeout(function() {
968 self.currentButter_ = butter;
969 self.updateButter(message, opt_options);
970 self.butterLastShowTime_ = new Date();
971 });
972
973 return butter;
974 };
975
976 FileManager.prototype.showButterError = function(message, opt_options) {
977 var butter = this.showButter(message, opt_options);
978 butter.classList.add('error');
979 return butter;
980 };
981
982 FileManager.prototype.updateButter = function(message, opt_options) {
983 if (!opt_options)
984 opt_options = {};
985
986 var timeout;
987 if ('timeout' in opt_options) {
988 timeout = opt_options.timeout;
989 } else {
990 timeout = 10 * 1000;
991 }
992
993 if (this.butterTimer_)
994 clearTimeout(this.butterTimer_);
995
996 if (timeout) {
997 var self = this;
998 this.butterTimer_ = setTimeout(function() {
999 self.hideButter();
1000 self.butterTimer_ = null;
1001 }, timeout);
1002 }
1003
1004 var butter = this.currentButter_;
1005 butter.querySelector('.butter-message').textContent = message;
1006 if (message) {
1007 // The butter bar is made visible on the first non-empty message.
1008 butter.classList.remove('before-show');
1009 }
1010 if (opt_options && 'progress' in opt_options) {
1011 butter.querySelector('.progress-track').style.width =
1012 (opt_options.progress * 100) + '%';
1013 }
1014
1015 butter.style.left = ((this.dialogDom_.clientWidth -
1016 butter.clientWidth) / 2) + 'px';
1017 };
1018
1019 FileManager.prototype.hideButter = function() {
1020 if (this.currentButter_) {
1021 var delay = Math.max(MINIMUM_BUTTER_DISPLAY_TIME_MS -
1022 (new Date() - this.butterLastShowTime_), 0);
1023
1024 var butter = this.currentButter_;
1025
1026 setTimeout(function() {
1027 butter.classList.add('after-show');
1028 }, delay);
1029
1030 setTimeout(function() {
1031 butter.classList.remove('error');
1032 butter.classList.remove('after-show');
1033 butter.classList.add('before-show');
1034 butter.querySelector('.actions').classList.add('hide-in-butter');
1035 butter.querySelector('.progress-bar').classList.add('hide-in-butter');
1036 }, delay + 1000);
1037
1038 this.currentButter_ = null;
1039 }
1040 };
1041
1042 /** 905 /**
1043 * Index of selected item in the typeList of the dialog params. 906 * Index of selected item in the typeList of the dialog params.
1044 * @return {intener} Index of selected type from this.fileTypes_ + 1. 0 907 * @return {intener} Index of selected type from this.fileTypes_ + 1. 0
1045 * means value is not specified. 908 * means value is not specified.
1046 */ 909 */
1047 FileManager.prototype.getSelectedFilterIndex_ = function() { 910 FileManager.prototype.getSelectedFilterIndex_ = function() {
1048 // 0 is the 'All files' item. 911 // 0 is the 'All files' item.
1049 return Math.min(0, this.fileTypeSelector_.selectedIndex); 912 return Math.min(0, this.fileTypeSelector_.selectedIndex);
1050 }; 913 };
1051 914
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 this.table_.list.addEventListener( 1118 this.table_.list.addEventListener(
1256 'dblclick', this.onDetailDoubleClickOrTap_.bind(this)); 1119 'dblclick', this.onDetailDoubleClickOrTap_.bind(this));
1257 this.table_.list.addEventListener( 1120 this.table_.list.addEventListener(
1258 cr.ui.TouchHandler.EventType.TAP, 1121 cr.ui.TouchHandler.EventType.TAP,
1259 this.onDetailDoubleClickOrTap_.bind(this)); 1122 this.onDetailDoubleClickOrTap_.bind(this));
1260 1123
1261 cr.ui.contextMenuHandler.setContextMenu(this.table_.querySelector('.list'), 1124 cr.ui.contextMenuHandler.setContextMenu(this.table_.querySelector('.list'),
1262 this.fileContextMenu_); 1125 this.fileContextMenu_);
1263 }; 1126 };
1264 1127
1265 FileManager.prototype.initButter_ = function() {
1266 var self = this;
1267 var progress = this.copyManager_.getProgress();
1268
1269 var options = {progress: progress.percentage, actions: {}, timeout: 0};
1270 options.actions[str('CANCEL_LABEL')] = function cancelPaste() {
1271 self.copyManager_.requestCancel();
1272 };
1273 this.showButter(strf('PASTE_ITEMS_REMAINING', progress.pendingItems),
1274 options);
1275 };
1276
1277 FileManager.prototype.onCopyProgress_ = function(event) { 1128 FileManager.prototype.onCopyProgress_ = function(event) {
1278 var progress = this.copyManager_.getProgress(); 1129 if (event.reason === 'ERROR' &&
1279 1130 event.error.reason === 'FILESYSTEM_ERROR' &&
1280 if (event.reason == 'BEGIN') { 1131 event.error.data.toGDrive &&
1281 if (this.currentButter_) 1132 event.error.data.code == FileError.QUOTA_EXCEEDED_ERR) {
1282 this.hideButter(); 1133 this.alert.showHtml(
1283 1134 strf('GDATA_SERVER_OUT_OF_SPACE_HEADER'),
1284 clearTimeout(this.butterTimeout_); 1135 strf('GDATA_SERVER_OUT_OF_SPACE_MESSAGE',
1285 // If the copy process lasts more than 500 ms, we show a progress bar. 1136 decodeURIComponent(
1286 this.butterTimeout_ = setTimeout(this.initButter_.bind(this), 500); 1137 event.error.data.sourceFileUrl.split('/').pop()),
1287 return; 1138 GOOGLE_DRIVE_BUY_STORAGE));
1288 }
1289 if (event.reason == 'PROGRESS') {
1290 // Perform this check inside Progress event handler, avoid to log error
1291 // message 'Unknown event reason: PROGRESS' in console.
1292 if (this.currentButter_) {
1293 var options = {progress: progress.percentage, timeout: 0};
1294 this.updateButter(strf('PASTE_ITEMS_REMAINING', progress.pendingItems),
1295 options);
1296 }
1297 return;
1298 }
1299 if (event.reason == 'SUCCESS') {
1300 clearTimeout(this.butterTimeout_);
1301 if (this.currentButter_)
1302 this.hideButter();
1303 } else if (event.reason == 'ERROR') {
1304 clearTimeout(this.butterTimeout_);
1305 switch (event.error.reason) {
1306 case 'TARGET_EXISTS':
1307 var name = event.error.data.name;
1308 if (event.error.data.isDirectory)
1309 name += '/';
1310 this.showButterError(strf('PASTE_TARGET_EXISTS_ERROR', name));
1311 break;
1312
1313 case 'FILESYSTEM_ERROR':
1314 if (event.error.data.toGDrive &&
1315 event.error.data.code == FileError.QUOTA_EXCEEDED_ERR) {
1316 this.hideButter();
1317 this.alert.showHtml(
1318 strf('GDATA_SERVER_OUT_OF_SPACE_HEADER'),
1319 strf('GDATA_SERVER_OUT_OF_SPACE_MESSAGE',
1320 decodeURIComponent(
1321 event.error.data.sourceFileUrl.split('/').pop()),
1322 GOOGLE_DRIVE_BUY_STORAGE));
1323 } else {
1324 this.showButterError(
1325 strf('PASTE_FILESYSTEM_ERROR',
1326 getFileErrorString(event.error.data.code)));
1327 }
1328 break;
1329
1330 default:
1331 this.showButterError(strf('PASTE_UNEXPECTED_ERROR', event.error));
1332 break;
1333 }
1334 } else if (event.reason == 'CANCELLED') {
1335 this.showButter(str('PASTE_CANCELLED'), {timeout: 1000});
1336 } else {
1337 console.log('Unknown event reason: ' + event.reason);
1338 } 1139 }
1339 1140
1340 // TODO(benchan): Currently, there is no FileWatcher emulation for 1141 // TODO(benchan): Currently, there is no FileWatcher emulation for
1341 // GDataFileSystem, so we need to manually trigger the directory rescan 1142 // GDataFileSystem, so we need to manually trigger the directory rescan
1342 // after paste operations complete. Remove this once we emulate file 1143 // after paste operations complete. Remove this once we emulate file
1343 // watching functionalities in GDataFileSystem. 1144 // watching functionalities in GDataFileSystem.
1344 if (this.isOnGData()) { 1145 if (this.isOnGData()) {
1345 if (event.reason == 'SUCCESS' || event.reason == 'ERROR' || 1146 if (event.reason == 'SUCCESS' || event.reason == 'ERROR' ||
1346 event.reason == 'CANCELLED') { 1147 event.reason == 'CANCELLED') {
1347 this.directoryModel_.rescanLater(); 1148 this.directoryModel_.rescanLater();
1348 } 1149 }
1349 } 1150 }
1350 }; 1151 };
1351 1152
1352 /** 1153 /**
1353 * Handler of file manager operations. Update directory model 1154 * Handler of file manager operations. Update directory model
1354 * to reflect operation result iimediatelly (not waiting directory 1155 * to reflect operation result immediatelly (not waiting directory
1355 * update event). 1156 * update event).
1356 */ 1157 */
1357 FileManager.prototype.onCopyManagerOperationComplete_ = function(event) { 1158 FileManager.prototype.onCopyManagerOperationComplete_ = function(event) {
1358 var currentPath = this.directoryModel_.getCurrentDirPath(); 1159 var currentPath = this.directoryModel_.getCurrentDirPath();
1359 if (this.isOnGData() && this.directoryModel_.isSearching()) 1160 if (this.isOnGData() && this.directoryModel_.isSearching())
1360 return; 1161 return;
1361 1162
1362 function inCurrentDirectory(entry) { 1163 function inCurrentDirectory(entry) {
1363 var fullPath = entry.fullPath; 1164 var fullPath = entry.fullPath;
1364 var dirPath = fullPath.substr(0, fullPath.length - 1165 var dirPath = fullPath.substr(0, fullPath.length -
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
3048 /** 2849 /**
3049 * Executes directory action (i.e. changes directory). 2850 * Executes directory action (i.e. changes directory).
3050 * 2851 *
3051 * @param {DirectoryEntry} entry Directory entry to which directory should be 2852 * @param {DirectoryEntry} entry Directory entry to which directory should be
3052 * changed. 2853 * changed.
3053 */ 2854 */
3054 FileManager.prototype.onDirectoryAction = function(entry) { 2855 FileManager.prototype.onDirectoryAction = function(entry) {
3055 var mountError = this.volumeManager_.getMountError( 2856 var mountError = this.volumeManager_.getMountError(
3056 PathUtil.getRootPath(entry.fullPath)); 2857 PathUtil.getRootPath(entry.fullPath));
3057 if (mountError == VolumeManager.Error.UNKNOWN_FILESYSTEM) { 2858 if (mountError == VolumeManager.Error.UNKNOWN_FILESYSTEM) {
3058 return this.showButter(str('UNKNOWN_FILESYSTEM_WARNING')); 2859 return this.butterBar_.show(str('UNKNOWN_FILESYSTEM_WARNING'));
3059 } else if (mountError == VolumeManager.Error.UNSUPPORTED_FILESYSTEM) { 2860 } else if (mountError == VolumeManager.Error.UNSUPPORTED_FILESYSTEM) {
3060 return this.showButter(str('UNSUPPORTED_FILESYSTEM_WARNING')); 2861 return this.butterBar_.show(str('UNSUPPORTED_FILESYSTEM_WARNING'));
3061 } 2862 }
3062 2863
3063 return this.directoryModel_.changeDirectory(entry.fullPath); 2864 return this.directoryModel_.changeDirectory(entry.fullPath);
3064 }; 2865 };
3065 2866
3066 /** 2867 /**
3067 * Show or hide the "Low disk space" warning. 2868 * Show or hide the "Low disk space" warning.
3068 * @param {boolean} show True if the box need to be shown. 2869 * @param {boolean} show True if the box need to be shown.
3069 */ 2870 */
3070 FileManager.prototype.showLowDiskSpaceWarning_ = function(show) { 2871 FileManager.prototype.showLowDiskSpaceWarning_ = function(show) {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 3213
3413 case '27': // Escape => Cancel dialog. 3214 case '27': // Escape => Cancel dialog.
3414 if (this.copyManager_ && 3215 if (this.copyManager_ &&
3415 this.copyManager_.getStatus().totalFiles != 0) { 3216 this.copyManager_.getStatus().totalFiles != 0) {
3416 // If there is a copy in progress, ESC will cancel it. 3217 // If there is a copy in progress, ESC will cancel it.
3417 event.preventDefault(); 3218 event.preventDefault();
3418 this.copyManager_.requestCancel(); 3219 this.copyManager_.requestCancel();
3419 return; 3220 return;
3420 } 3221 }
3421 3222
3422 if (this.butterTimer_) { 3223 if (this.butterBar_.hideError()) {
3423 // Allow the user to manually dismiss timed butter messages.
3424 event.preventDefault(); 3224 event.preventDefault();
3425 this.hideButter();
3426 return; 3225 return;
3427 } 3226 }
3428 3227
3429 if (this.dialogType_ != FileManager.DialogType.FULL_PAGE) { 3228 if (this.dialogType_ != FileManager.DialogType.FULL_PAGE) {
3430 // If there is nothing else for ESC to do, then cancel the dialog. 3229 // If there is nothing else for ESC to do, then cancel the dialog.
3431 event.preventDefault(); 3230 event.preventDefault();
3432 this.cancelButton_.click(); 3231 this.cancelButton_.click();
3433 } 3232 }
3434 break; 3233 break;
3435 } 3234 }
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
4233 } 4032 }
4234 4033
4235 var defaultActionSeparator = 4034 var defaultActionSeparator =
4236 this.dialogDom_.querySelector('#default-action-separator'); 4035 this.dialogDom_.querySelector('#default-action-separator');
4237 4036
4238 this.defaultActionMenuItem_.hidden = !taskItem; 4037 this.defaultActionMenuItem_.hidden = !taskItem;
4239 defaultActionSeparator.hidden = !taskItem; 4038 defaultActionSeparator.hidden = !taskItem;
4240 } 4039 }
4241 })(); 4040 })();
4242 4041
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/js/butter_bar.js ('k') | chrome/browser/resources/file_manager/js/main_scripts.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698