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

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

Issue 12208084: Removed a context menu from Files.app's left nav, since it became redundant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 // This variable is checked in SelectFileDialogExtensionBrowserTest. 5 // This variable is checked in SelectFileDialogExtensionBrowserTest.
6 var JSErrorCount = 0; 6 var JSErrorCount = 0;
7 7
8 /** 8 /**
9 * Count uncaught exceptions. 9 * Count uncaught exceptions.
10 */ 10 */
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 cr.ui.contextMenuHandler.setContextMenu(this.table_.querySelector('.list'), 529 cr.ui.contextMenuHandler.setContextMenu(this.table_.querySelector('.list'),
530 this.fileContextMenu_); 530 this.fileContextMenu_);
531 cr.ui.contextMenuHandler.setContextMenu( 531 cr.ui.contextMenuHandler.setContextMenu(
532 this.document_.querySelector('.drive-welcome.page'), 532 this.document_.querySelector('.drive-welcome.page'),
533 this.fileContextMenu_); 533 this.fileContextMenu_);
534 534
535 this.rootsContextMenu_ = 535 this.rootsContextMenu_ =
536 this.dialogDom_.querySelector('#roots-context-menu'); 536 this.dialogDom_.querySelector('#roots-context-menu');
537 cr.ui.Menu.decorate(this.rootsContextMenu_); 537 cr.ui.Menu.decorate(this.rootsContextMenu_);
538 538
539 this.downloadsRootContextMenu_ =
540 this.dialogDom_.querySelector('#downloads-root-context-menu');
541 cr.ui.Menu.decorate(this.downloadsRootContextMenu_);
542
543 this.textContextMenu_ = 539 this.textContextMenu_ =
544 this.dialogDom_.querySelector('#text-context-menu'); 540 this.dialogDom_.querySelector('#text-context-menu');
545 cr.ui.Menu.decorate(this.textContextMenu_); 541 cr.ui.Menu.decorate(this.textContextMenu_);
546 542
547 this.driveSettingsMenu_ = this.dialogDom_.querySelector('#drive-settings'); 543 this.driveSettingsMenu_ = this.dialogDom_.querySelector('#drive-settings');
548 cr.ui.decorate(this.driveSettingsMenu_, cr.ui.MenuButton); 544 cr.ui.decorate(this.driveSettingsMenu_, cr.ui.MenuButton);
549 545
550 this.driveSettingsMenu_.addEventListener('menushow', 546 this.driveSettingsMenu_.addEventListener('menushow',
551 this.onDriveMenuShow_.bind(this)); 547 this.onDriveMenuShow_.bind(this));
552 548
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 596
601 CommandUtil.registerCommand(doc, 'drive-clear-local-cache', 597 CommandUtil.registerCommand(doc, 'drive-clear-local-cache',
602 Commands.driveClearCacheCommand, this); 598 Commands.driveClearCacheCommand, this);
603 599
604 CommandUtil.registerCommand(doc, 'drive-reload', 600 CommandUtil.registerCommand(doc, 'drive-reload',
605 Commands.driveReloadCommand, this); 601 Commands.driveReloadCommand, this);
606 602
607 CommandUtil.registerCommand(doc, 'drive-go-to-drive', 603 CommandUtil.registerCommand(doc, 'drive-go-to-drive',
608 Commands.driveGoToDriveCommand, this); 604 Commands.driveGoToDriveCommand, this);
609 605
610 CommandUtil.registerCommand(doc, 'files-app-help',
611 Commands.filesAppHelpCommand, this);
612
613 CommandUtil.registerCommand(doc, 'paste', 606 CommandUtil.registerCommand(doc, 'paste',
614 Commands.pasteFileCommand, doc, this.fileTransferController_); 607 Commands.pasteFileCommand, doc, this.fileTransferController_);
615 608
616 CommandUtil.registerCommand(doc, 'open-with', 609 CommandUtil.registerCommand(doc, 'open-with',
617 Commands.openWithCommand, this); 610 Commands.openWithCommand, this);
618 611
619 CommandUtil.registerCommand(doc, 'toggle-pinned', 612 CommandUtil.registerCommand(doc, 'toggle-pinned',
620 Commands.togglePinnedCommand, this); 613 Commands.togglePinnedCommand, this);
621 614
622 CommandUtil.registerCommand(doc, 'zip-selection', 615 CommandUtil.registerCommand(doc, 'zip-selection',
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 // the root before executing it. 1430 // the root before executing it.
1438 unmountCommand.canExecuteChange(li); 1431 unmountCommand.canExecuteChange(li);
1439 unmountCommand.execute(li); 1432 unmountCommand.execute(li);
1440 }.bind(this)); 1433 }.bind(this));
1441 // Block other mouse handlers. 1434 // Block other mouse handlers.
1442 eject.addEventListener('mouseup', function(e) { e.stopPropagation() }); 1435 eject.addEventListener('mouseup', function(e) { e.stopPropagation() });
1443 eject.addEventListener('mousedown', function(e) { e.stopPropagation() }); 1436 eject.addEventListener('mousedown', function(e) { e.stopPropagation() });
1444 li.appendChild(eject); 1437 li.appendChild(eject);
1445 } 1438 }
1446 1439
1447 // Add a context menu for the root. "Downloads" has a menu item showing the 1440 if (rootType != RootType.DRIVE && rootType != RootType.DOWNLOADS)
1448 // remaining space information.
1449 if (rootType == RootType.DOWNLOADS) {
1450 cr.ui.contextMenuHandler.setContextMenu(li,
1451 this.downloadsRootContextMenu_);
1452
1453 var downloadsRootContextMenu = this.downloadsRootContextMenu_;
1454 var downloadsSpaceInfoLabel =
1455 this.dialogDom_.querySelector('#downloads-space-info-label');
1456
1457 var downloadsSpaceInnerBar =
1458 this.dialogDom_.querySelector('#downloads-space-info-bar');
1459 var downloadsSpaceOuterBar =
1460 this.dialogDom_.querySelector('#downloads-space-info-bar').
1461 parentNode;
1462
1463 if (this.downloadsRootContextMenuListener_) {
1464 cr.ui.contextMenuHandler.removeEventListener(
1465 'show', this.downloadsRootContextMenuListener_);
1466 }
1467 this.downloadsRootContextMenuListener_ = function(ev) {
1468 // Check available space on opening the context menu for Downloads.
1469 if (ev.element != li || ev.menu != downloadsRootContextMenu)
1470 return;
1471
1472 downloadsSpaceInnerBar.setAttribute('pending', '');
1473 chrome.fileBrowserPrivate.getSizeStats(
1474 util.makeFilesystemUrl(path),
1475 function(sizeStats) {
1476 updateSpaceInfo(sizeStats, downloadsSpaceInnerBar,
1477 downloadsSpaceInfoLabel, downloadsSpaceOuterBar);
1478 });
1479 };
1480
1481 cr.ui.contextMenuHandler.addEventListener(
1482 'show', this.downloadsRootContextMenuListener_);
1483 } else if (rootType != RootType.DRIVE) {
1484 cr.ui.contextMenuHandler.setContextMenu(li, this.rootsContextMenu_); 1441 cr.ui.contextMenuHandler.setContextMenu(li, this.rootsContextMenu_);
1485 }
1486 1442
1487 cr.defineProperty(li, 'lead', cr.PropertyKind.BOOL_ATTR); 1443 cr.defineProperty(li, 'lead', cr.PropertyKind.BOOL_ATTR);
1488 cr.defineProperty(li, 'selected', cr.PropertyKind.BOOL_ATTR); 1444 cr.defineProperty(li, 'selected', cr.PropertyKind.BOOL_ATTR);
1489 1445
1490 return li; 1446 return li;
1491 }; 1447 };
1492 1448
1493 /** 1449 /**
1494 * Unmounts device. 1450 * Unmounts device.
1495 * @param {string} path Path to a volume to unmount. 1451 * @param {string} path Path to a volume to unmount.
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2954 return this.directoryModel_.getFileList(); 2910 return this.directoryModel_.getFileList();
2955 }; 2911 };
2956 2912
2957 /** 2913 /**
2958 * @return {cr.ui.List} Current list object. 2914 * @return {cr.ui.List} Current list object.
2959 */ 2915 */
2960 FileManager.prototype.getCurrentList = function() { 2916 FileManager.prototype.getCurrentList = function() {
2961 return this.currentList_; 2917 return this.currentList_;
2962 }; 2918 };
2963 })(); 2919 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698