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

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

Issue 10184008: [File Manager] Retain current image focus when exiting Gallery (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 /** 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).
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 }); 1422 });
1423 1423
1424 return; 1424 return;
1425 } 1425 }
1426 }; 1426 };
1427 1427
1428 /** 1428 /**
1429 * Respond to the back and forward buttons. 1429 * Respond to the back and forward buttons.
1430 */ 1430 */
1431 FileManager.prototype.onPopState_ = function(event) { 1431 FileManager.prototype.onPopState_ = function(event) {
1432 // TODO(serya): We should restore selected items here.
1433 this.closeFilePopup_(); 1432 this.closeFilePopup_();
1433 // Nothing left to do if the current directory is not changing. This happens
1434 // if we are exiting the Gallery.
1435 if (this.getPathFromUrlOrParams_() ==
1436 this.directoryModel_.currentEntry.fullPath)
1437 return;
1434 this.setupCurrentDirectory_(true /* invokeHandler */); 1438 this.setupCurrentDirectory_(true /* invokeHandler */);
1435 }; 1439 };
1436 1440
1437 FileManager.prototype.requestResize_ = function(timeout) { 1441 FileManager.prototype.requestResize_ = function(timeout) {
1438 setTimeout(this.onResize_.bind(this), timeout || 0); 1442 setTimeout(this.onResize_.bind(this), timeout || 0);
1439 }; 1443 };
1440 1444
1441 /** 1445 /**
1442 * Resize details and thumb views to fit the new window size. 1446 * Resize details and thumb views to fit the new window size.
1443 */ 1447 */
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2810 }; 2814 };
2811 2815
2812 FileManager.prototype.openGallery_ = function(urls) { 2816 FileManager.prototype.openGallery_ = function(urls) {
2813 var self = this; 2817 var self = this;
2814 2818
2815 var galleryFrame = this.document_.createElement('iframe'); 2819 var galleryFrame = this.document_.createElement('iframe');
2816 galleryFrame.className = 'overlay-pane'; 2820 galleryFrame.className = 'overlay-pane';
2817 galleryFrame.scrolling = 'no'; 2821 galleryFrame.scrolling = 'no';
2818 galleryFrame.setAttribute('webkitallowfullscreen', true); 2822 galleryFrame.setAttribute('webkitallowfullscreen', true);
2819 2823
2824 var singleSelection = urls.length == 1;
2820 var selectedUrl; 2825 var selectedUrl;
2821 if (urls.length == 1 && FileType.isImage(urls[0])) { 2826 if (singleSelection && FileType.isImage(urls[0])) {
2822 // Single image item selected. Pass to the Gallery as a selected. 2827 // Single image item selected. Pass to the Gallery as a selected.
2823 selectedUrl = urls[0]; 2828 selectedUrl = urls[0];
2824 // Pass along every image and video in the directory so that it shows up 2829 // Pass along every image and video in the directory so that it shows up
2825 // in the ribbon. 2830 // in the ribbon.
2826 // We do not do that if a single video is selected because the UI is 2831 // We do not do that if a single video is selected because the UI is
2827 // cleaner without the ribbon. 2832 // cleaner without the ribbon.
2828 urls = this.getAllUrlsInCurrentDirectory_().filter( 2833 urls = this.getAllUrlsInCurrentDirectory_().filter(
2829 FileType.isImageOrVideo); 2834 FileType.isImageOrVideo);
2830 } else { 2835 } else {
2831 // Pass just the selected items, select the first entry. 2836 // Pass just the selected items, select the first entry.
(...skipping 10 matching lines...) Expand all
2842 galleryFrame.contentWindow.ImageUtil.metrics = metrics; 2847 galleryFrame.contentWindow.ImageUtil.metrics = metrics;
2843 galleryFrame.contentWindow.FileType = FileType; 2848 galleryFrame.contentWindow.FileType = FileType;
2844 galleryFrame.contentWindow.util = util; 2849 galleryFrame.contentWindow.util = util;
2845 2850
2846 // Gallery shoud treat GData folder as readonly even when online 2851 // Gallery shoud treat GData folder as readonly even when online
2847 // until we learn to save files directly to GData. 2852 // until we learn to save files directly to GData.
2848 var readonly = self.isOnReadonlyDirectory() || self.isOnGData(); 2853 var readonly = self.isOnReadonlyDirectory() || self.isOnGData();
2849 var currentDir = self.directoryModel_.currentEntry; 2854 var currentDir = self.directoryModel_.currentEntry;
2850 var downloadsDir = self.directoryModel_.rootsList.item(0); 2855 var downloadsDir = self.directoryModel_.rootsList.item(0);
2851 2856
2857 var gallerySelection;
dgozman 2012/04/23 16:22:17 Another approach is to introduce parameter |select
Vladislav Kaznacheev 2012/04/24 08:13:53 I thought about that but it requires at least as m
2852 var context = { 2858 var context = {
2853 // We show the root label in readonly warning (e.g. archive name). 2859 // We show the root label in readonly warning (e.g. archive name).
2854 readonlyDirName: 2860 readonlyDirName:
2855 readonly ? 2861 readonly ?
2856 (self.isOnGData() ? 2862 (self.isOnGData() ?
2857 self.getRootLabel_(currentDir.fullPath) : 2863 self.getRootLabel_(currentDir.fullPath) :
2858 self.directoryModel_.rootName) : 2864 self.directoryModel_.rootName) :
2859 null, 2865 null,
2860 saveDirEntry: readonly ? downloadsDir : currentDir, 2866 saveDirEntry: readonly ? downloadsDir : currentDir,
2861 metadataProvider: self.getMetadataProvider(), 2867 metadataProvider: self.getMetadataProvider(),
2862 getShareActions: self.getShareActions_.bind(self), 2868 getShareActions: self.getShareActions_.bind(self),
2863 onNameChange: function(name) { 2869 onNameChange: function(name) {
2864 self.document_.title = name; 2870 self.document_.title = gallerySelection = name;
2865 self.updateLocation_(true /*replace*/, dirPath + '/' + name); 2871 self.updateLocation_(true /*replace*/, dirPath + '/' + name);
2866 }, 2872 },
2867 onClose: function() { 2873 onClose: function() {
2874 if (singleSelection)
2875 self.directoryModel_.selectEntry(gallerySelection);
2868 history.back(1); 2876 history.back(1);
2869 }, 2877 },
2870 displayStringFunction: strf 2878 displayStringFunction: strf
2871 }; 2879 };
2872 galleryFrame.contentWindow.Gallery.open(context, urls, selectedUrl); 2880 galleryFrame.contentWindow.Gallery.open(context, urls, selectedUrl);
2873 }; 2881 };
2874 2882
2875 galleryFrame.src = 'gallery.html'; 2883 galleryFrame.src = 'gallery.html';
2876 this.openFilePopup_(galleryFrame); 2884 this.openFilePopup_(galleryFrame);
2877 }; 2885 };
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
4323 4331
4324 handleSplitterDragEnd: function(e) { 4332 handleSplitterDragEnd: function(e) {
4325 Splitter.prototype.handleSplitterDragEnd.apply(this, arguments); 4333 Splitter.prototype.handleSplitterDragEnd.apply(this, arguments);
4326 this.ownerDocument.documentElement.classList.remove('col-resize'); 4334 this.ownerDocument.documentElement.classList.remove('col-resize');
4327 } 4335 }
4328 }; 4336 };
4329 4337
4330 customSplitter.decorate(splitterElement); 4338 customSplitter.decorate(splitterElement);
4331 }; 4339 };
4332 })(); 4340 })();
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