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

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

Issue 7310002: Filebrowser: keep selection when switching between list and grid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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
« 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 // WK Bug 55728 is fixed on the chrome 12 branch but not on the trunk. 5 // WK Bug 55728 is fixed on the chrome 12 branch but not on the trunk.
6 // TODO(rginda): Enable this everywhere once we have a trunk-worthy fix. 6 // TODO(rginda): Enable this everywhere once we have a trunk-worthy fix.
7 const ENABLE_METADATA = true; 7 const ENABLE_METADATA = true;
8 8
9 // Thumbnail view is painful without the exif reader. 9 // Thumbnail view is painful without the exif reader.
10 const ENABLE_THUMBNAIL_VIEW = ENABLE_METADATA; 10 const ENABLE_THUMBNAIL_VIEW = ENABLE_METADATA;
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 this.currentDirEntry_.fullPath != '/' && 637 this.currentDirEntry_.fullPath != '/' &&
638 // Not in media directory. 638 // Not in media directory.
639 this.currentDirEntry_.fullPath != MEDIA_DIRECTORY); 639 this.currentDirEntry_.fullPath != MEDIA_DIRECTORY);
640 }; 640 };
641 641
642 FileManager.prototype.setListType = function(type) { 642 FileManager.prototype.setListType = function(type) {
643 if (type && type == this.listType_) 643 if (type && type == this.listType_)
644 return; 644 return;
645 645
646 if (type == FileManager.ListType.DETAIL) { 646 if (type == FileManager.ListType.DETAIL) {
647 var selectedIndexes = this.grid_.selectionModel.selectedIndexes;
647 this.table_.dataModel = this.dataModel_; 648 this.table_.dataModel = this.dataModel_;
648 this.table_.style.display = ''; 649 this.table_.style.display = '';
649 this.grid_.style.display = 'none'; 650 this.grid_.style.display = 'none';
650 this.grid_.dataModel = this.emptyDataModel_; 651 this.grid_.dataModel = this.emptyDataModel_;
651 this.currentList_ = this.table_; 652 this.currentList_ = this.table_;
652 this.dialogDom_.querySelector('button.detail-view').disabled = true; 653 this.dialogDom_.querySelector('button.detail-view').disabled = true;
653 this.dialogDom_.querySelector('button.thumbnail-view').disabled = false; 654 this.dialogDom_.querySelector('button.thumbnail-view').disabled = false;
655 this.table_.selectionModel.selectedIndexes = selectedIndexes;
654 } else if (type == FileManager.ListType.THUMBNAIL) { 656 } else if (type == FileManager.ListType.THUMBNAIL) {
657 var selectedIndexes = this.table_.selectionModel.selectedIndexes;
655 this.grid_.dataModel = this.dataModel_; 658 this.grid_.dataModel = this.dataModel_;
656 this.grid_.style.display = ''; 659 this.grid_.style.display = '';
657 this.table_.style.display = 'none'; 660 this.table_.style.display = 'none';
658 this.table_.dataModel = this.emptyDataModel_; 661 this.table_.dataModel = this.emptyDataModel_;
659 this.currentList_ = this.grid_; 662 this.currentList_ = this.grid_;
660 this.dialogDom_.querySelector('button.thumbnail-view').disabled = true; 663 this.dialogDom_.querySelector('button.thumbnail-view').disabled = true;
661 this.dialogDom_.querySelector('button.detail-view').disabled = false; 664 this.dialogDom_.querySelector('button.detail-view').disabled = false;
665 this.grid_.selectionModel.selectedIndexes = selectedIndexes;
662 } else { 666 } else {
663 throw new Error('Unknown list type: ' + type); 667 throw new Error('Unknown list type: ' + type);
664 } 668 }
665 669
666 this.listType_ = type; 670 this.listType_ = type;
667 this.onResize_(); 671 this.onResize_();
668 }; 672 };
669 673
670 /** 674 /**
671 * Initialize the file thumbnail grid. 675 * Initialize the file thumbnail grid.
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 window.alert(str('ERROR_WHITESPACE_NAME')); 2337 window.alert(str('ERROR_WHITESPACE_NAME'));
2334 return false; 2338 return false;
2335 } 2339 }
2336 if (/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i.test(name)) { 2340 if (/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i.test(name)) {
2337 window.alert(str('ERROR_RESERVED_NAME')); 2341 window.alert(str('ERROR_RESERVED_NAME'));
2338 return false; 2342 return false;
2339 } 2343 }
2340 return true; 2344 return true;
2341 }; 2345 };
2342 })(); 2346 })();
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