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

Side by Side Diff: trunk/src/chrome/browser/resources/file_manager/js/file_selection.js

Issue 15742020: Revert 202508 "Made the open menu item in the context menu updat..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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) 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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * The current selection object. 8 * The current selection object.
9 * 9 *
10 * @param {FileManager} fileManager FileManager instance. 10 * @param {FileManager} fileManager FileManager instance.
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 469
470 /** 470 /**
471 * Calculates async selection stats and updates secondary UI elements. 471 * Calculates async selection stats and updates secondary UI elements.
472 * 472 *
473 * @param {FileSelection} selection The selection object. 473 * @param {FileSelection} selection The selection object.
474 */ 474 */
475 FileSelectionHandler.prototype.updateFileSelectionAsync = function(selection) { 475 FileSelectionHandler.prototype.updateFileSelectionAsync = function(selection) {
476 if (this.selection != selection) return; 476 if (this.selection != selection) return;
477 477
478 // Update the file tasks. 478 // Update the file tasks.
479 var onTasks = function() {
480 if (this.selection != selection) return;
481 selection.tasks.display(this.taskItems_);
482 selection.tasks.updateMenuItem();
483 }.bind(this);
484
479 if (this.fileManager_.dialogType == DialogType.FULL_PAGE && 485 if (this.fileManager_.dialogType == DialogType.FULL_PAGE &&
480 selection.directoryCount == 0 && selection.fileCount > 0) { 486 selection.directoryCount == 0 && selection.fileCount > 0) {
481 selection.createTasks(function() { 487 selection.createTasks(onTasks);
482 if (this.selection != selection)
483 return;
484 selection.tasks.display(this.taskItems_);
485 selection.tasks.updateMenuItem();
486 }.bind(this));
487 } else { 488 } else {
488 this.taskItems_.hidden = true; 489 this.taskItems_.hidden = true;
489 } 490 }
490 491
491 // Update preview panels. 492 // Update the UI.
492 var wasVisible = this.isPreviewPanelVisibile_(); 493 var wasVisible = this.isPreviewPanelVisibile_();
493 var thumbnailEntries; 494 this.updatePreviewPanelVisibility_();
495
494 if (util.platform.newUI() && selection.totalCount == 0) { 496 if (util.platform.newUI() && selection.totalCount == 0) {
495 thumbnailEntries = [ 497 var path = this.fileManager_.getCurrentDirectory();
496 this.fileManager_.getCurrentDirectoryEntry() 498 // Hides the breadcrumbs list on the root path.
497 ]; 499 if (PathUtil.isRootPath(path))
498 } else { 500 this.updatePreviewPanelBreadcrumbs_(null);
499 thumbnailEntries = selection.entries; 501 else
500 if (selection.totalCount != 1) { 502 this.updatePreviewPanelBreadcrumbs_(path);
501 selection.computeBytes(function() { 503 var entry = this.fileManager_.getCurrentDirectoryEntry();
502 if (this.selection != selection) 504 this.showPreviewThumbnails_([entry]);
503 return; 505 this.updatePreviewPanelText_();
504 this.updatePreviewPanelText_(); 506 return;
505 }.bind(this));
506 }
507 } 507 }
508 this.updatePreviewPanelVisibility_();
509 this.updatePreviewPanelText_();
510 this.showPreviewThumbnails_(thumbnailEntries);
511 508
512 // Update breadcrums. 509 this.fileManager_.updateContextMenuActionItems(null, false);
513 var updateTarget = null;
514 if (util.platform.newUI()) {
515 var path = this.fileManager_.getCurrentDirectory();
516 if (selection.totalCount == 1) {
517 // Shows the breadcrumb list when a file is selected.
518 updateTarget = selection.entries[0].fullPath;
519 } else if (selection.totalCount == 0 && !PathUtil.isRootPath(path)) {
520 // Shows the breadcrumb list when no file is selected and the current
521 // directory is non-root path.
522 updateTarget = path;
523 }
524 }
525 this.updatePreviewPanelBreadcrumbs_(updateTarget);
526
527 // Scroll to item
528 if (!wasVisible && this.selection.totalCount == 1) { 510 if (!wasVisible && this.selection.totalCount == 1) {
529 var list = this.fileManager_.getCurrentList(); 511 var list = this.fileManager_.getCurrentList();
530 list.scrollIndexIntoView(list.selectionModel.selectedIndex); 512 list.scrollIndexIntoView(list.selectionModel.selectedIndex);
531 } 513 }
532 514
533 // Sync the commands availability. 515 // Sync the commands availability.
534 if (selection.totalCount != 0) { 516 var commands = this.fileManager_.dialogDom_.querySelectorAll('command');
535 var commands = this.fileManager_.dialogDom_.querySelectorAll('command'); 517 for (var i = 0; i < commands.length; i++)
536 for (var i = 0; i < commands.length; i++) 518 commands[i].canExecuteChange();
537 commands[i].canExecuteChange(); 519
520 if (!util.platform.newUI()) {
521 this.updateSearchBreadcrumbs_();
522 // Update the summary information.
523 var onBytes = function() {
524 if (this.selection != selection) return;
525 this.updatePreviewPanelText_();
526 }.bind(this);
527 selection.computeBytes(onBytes);
528 this.updatePreviewPanelText_();
529 } else {
530 if (selection.totalCount == 1) {
531 // Shows the breadcrumb list.
532 var firstEntry = selection.entries[0];
533 this.updatePreviewPanelBreadcrumbs_(firstEntry.fullPath);
534 this.updatePreviewPanelText_();
535 } else {
536 this.updatePreviewPanelBreadcrumbs_(null);
537
538 // Update the summary information.
539 var onBytes = function() {
540 if (this.selection != selection) return;
541 this.updatePreviewPanelText_();
542 }.bind(this);
543 selection.computeBytes(onBytes);
544 this.updatePreviewPanelText_();
545 }
538 } 546 }
539 547
540 // Update context menu.
541 this.fileManager_.updateContextMenuActionItems(null, false);
542
543 // Inform tests it's OK to click buttons now. 548 // Inform tests it's OK to click buttons now.
544 chrome.test.sendMessage('selection-change-complete'); 549 chrome.test.sendMessage('selection-change-complete');
550
551 // Show thumbnails.
552 this.showPreviewThumbnails_(selection.entries);
545 }; 553 };
546 554
547 /** 555 /**
548 * Renders preview thumbnails in preview panel. 556 * Renders preview thumbnails in preview panel.
549 * 557 *
550 * @param {Array.<FileEntry>} entries The entries of selected object. 558 * @param {Array.<FileEntry>} entries The entries of selected object.
551 * @private 559 * @private
552 */ 560 */
553 FileSelectionHandler.prototype.showPreviewThumbnails_ = function(entries) { 561 FileSelectionHandler.prototype.showPreviewThumbnails_ = function(entries) {
554 var selection = this.selection; 562 var selection = this.selection;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 style.left = (boxWidth - imageWidth) / 2 + 'px'; 758 style.left = (boxWidth - imageWidth) / 2 + 'px';
751 style.top = (boxHeight - imageHeight) / 2 + 'px'; 759 style.top = (boxHeight - imageHeight) / 2 + 'px';
752 style.position = 'relative'; 760 style.position = 'relative';
753 761
754 util.applyTransform(largeImage, transform); 762 util.applyTransform(largeImage, transform);
755 763
756 largeImageBox.appendChild(largeImage); 764 largeImageBox.appendChild(largeImage);
757 largeImageBox.style.zIndex = 1000; 765 largeImageBox.style.zIndex = 1000;
758 return true; 766 return true;
759 }; 767 };
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