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

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

Issue 10412023: Fixing click on thumbnail in the bottom panel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 self.previewThumbnails_.appendChild(thumbnails[i]); 2132 self.previewThumbnails_.appendChild(thumbnails[i]);
2133 } 2133 }
2134 } 2134 }
2135 2135
2136 function onThumbnailLoaded() { 2136 function onThumbnailLoaded() {
2137 thumbnailLoaded++; 2137 thumbnailLoaded++;
2138 if (thumbnailLoaded == thumbnailCount) 2138 if (thumbnailLoaded == thumbnailCount)
2139 showThumbnails(); 2139 showThumbnails();
2140 } 2140 }
2141 2141
2142 var thumbnailClickHandler =
2143 this.dispatchDefaultTask_.bind(this, selection);
2144
2142 for (var i = 0; i < selection.indexes.length; i++) { 2145 for (var i = 0; i < selection.indexes.length; i++) {
2143 var entry = this.directoryModel_.getFileList().item(selection.indexes[i]); 2146 var entry = this.directoryModel_.getFileList().item(selection.indexes[i]);
2144 if (!entry) 2147 if (!entry)
2145 continue; 2148 continue;
2146 2149
2147 selection.entries.push(entry); 2150 selection.entries.push(entry);
2148 selection.urls.push(entry.toURL()); 2151 selection.urls.push(entry.toURL());
2149 2152
2150 if (thumbnailCount < MAX_PREVIEW_THUMBAIL_COUNT) { 2153 if (thumbnailCount < MAX_PREVIEW_THUMBAIL_COUNT) {
2151 var box = this.document_.createElement('div'); 2154 var box = this.document_.createElement('div');
2152 box.className = 'thumbnail'; 2155 box.className = 'thumbnail';
2153 if (thumbnailCount == 0) { 2156 if (thumbnailCount == 0) {
2154 var zoomed = this.document_.createElement('div'); 2157 var zoomed = this.document_.createElement('div');
2155 zoomed.hidden = true; 2158 zoomed.hidden = true;
2156 thumbnails.push(zoomed); 2159 thumbnails.push(zoomed);
2157 function onFirstThumbnailLoaded(img, transform) { 2160 function onFirstThumbnailLoaded(img, transform) {
2158 if (self.decorateThumbnailZoom_(zoomed, img, transform)) { 2161 if (self.decorateThumbnailZoom_(zoomed, img, transform)) {
2159 zoomed.hidden = false; 2162 zoomed.hidden = false;
2160 thumbnailsHaveZoom = true; 2163 thumbnailsHaveZoom = true;
2161 } 2164 }
2162 onThumbnailLoaded(); 2165 onThumbnailLoaded();
2163 } 2166 }
2164 var thumbnail = this.renderThumbnailBox_(entry, true, 2167 var thumbnail = this.renderThumbnailBox_(entry, true,
2165 onFirstThumbnailLoaded); 2168 onFirstThumbnailLoaded);
2169 zoomed.addEventListener('click', thumbnailClickHandler);
2166 } else { 2170 } else {
2167 var thumbnail = this.renderThumbnailBox_(entry, true, 2171 var thumbnail = this.renderThumbnailBox_(entry, true,
2168 onThumbnailLoaded); 2172 onThumbnailLoaded);
2169 } 2173 }
2170 thumbnailCount++; 2174 thumbnailCount++;
2171 box.appendChild(thumbnail); 2175 box.appendChild(thumbnail);
2172 box.style.zIndex = MAX_PREVIEW_THUMBAIL_COUNT + 1 - i; 2176 box.style.zIndex = MAX_PREVIEW_THUMBAIL_COUNT + 1 - i;
2173 box.addEventListener('click', 2177 box.addEventListener('click', thumbnailClickHandler);
2174 this.dispatchDefaultTask_.bind(this, selection));
2175 2178
2176 thumbnails.push(box); 2179 thumbnails.push(box);
2177 } 2180 }
2178 2181
2179 if (selection.iconType == null) { 2182 if (selection.iconType == null) {
2180 selection.iconType = FileType.getIcon(entry); 2183 selection.iconType = FileType.getIcon(entry);
2181 } else if (selection.iconType != 'unknown') { 2184 } else if (selection.iconType != 'unknown') {
2182 var iconType = FileType.getIcon(entry); 2185 var iconType = FileType.getIcon(entry);
2183 if (selection.iconType != iconType) 2186 if (selection.iconType != iconType)
2184 selection.iconType = 'unknown'; 2187 selection.iconType = 'unknown';
(...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after
4655 4658
4656 function closeBanner() { 4659 function closeBanner() {
4657 self.cleanupGDataWelcome_(); 4660 self.cleanupGDataWelcome_();
4658 // Stop showing the welcome banner. 4661 // Stop showing the welcome banner.
4659 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; 4662 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT;
4660 } 4663 }
4661 4664
4662 return maybeShowBanner; 4665 return maybeShowBanner;
4663 }; 4666 };
4664 })(); 4667 })();
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