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

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

Issue 10001004: Not blinking action tasks. (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 // Setting the src of an img to an empty string can crash the browser, so we 5 // Setting the src of an img to an empty string can crash the browser, so we
6 // use an empty 1x1 gif instead. 6 // use an empty 1x1 gif instead.
7 7
8 /** 8 /**
9 * FileManager constructor. 9 * FileManager constructor.
10 * 10 *
(...skipping 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 }; 2235 };
2236 2236
2237 if (!selection.indexes.length) { 2237 if (!selection.indexes.length) {
2238 this.updateCommonActionButtons_(); 2238 this.updateCommonActionButtons_();
2239 this.updatePreviewPanelVisibility_(); 2239 this.updatePreviewPanelVisibility_();
2240 cr.dispatchSimpleEvent(this, 'selection-summarized'); 2240 cr.dispatchSimpleEvent(this, 'selection-summarized');
2241 return; 2241 return;
2242 } 2242 }
2243 2243
2244 this.previewSummary_.textContent = str('COMPUTING_SELECTION'); 2244 this.previewSummary_.textContent = str('COMPUTING_SELECTION');
2245 // Removing childrens of task buttons and preview thumbnails after simple
2246 // event dispatched (see above). This can ensure a smooth disappearing
2247 // animation when nothing is selected.
2248 this.taskItems_.visible = false;
2249 this.taskItems_.clear();
2250 removeChildren(this.previewThumbnails_); 2245 removeChildren(this.previewThumbnails_);
2251 2246
2252 var fileCount = 0; 2247 var fileCount = 0;
2253 var byteCount = 0; 2248 var byteCount = 0;
2254 var pendingFiles = []; 2249 var pendingFiles = [];
2255 var thumbnailCount = 0; 2250 var thumbnailCount = 0;
2256 2251
2257 for (var i = 0; i < selection.indexes.length; i++) { 2252 for (var i = 0; i < selection.indexes.length; i++) {
2258 var entry = this.directoryModel_.fileList.item(selection.indexes[i]); 2253 var entry = this.directoryModel_.fileList.item(selection.indexes[i]);
2259 if (!entry) 2254 if (!entry)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 } 2315 }
2321 2316
2322 if (pendingFiles.length) { 2317 if (pendingFiles.length) {
2323 cacheEntryDateAndSize(pendingFiles.pop(), cacheNextFile); 2318 cacheEntryDateAndSize(pendingFiles.pop(), cacheNextFile);
2324 } else { 2319 } else {
2325 self.dispatchEvent(new cr.Event('selection-summarized')); 2320 self.dispatchEvent(new cr.Event('selection-summarized'));
2326 } 2321 }
2327 } 2322 }
2328 2323
2329 if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) { 2324 if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) {
2330 this.taskItems_.clear();
2331 // Some internal tasks cannot be defined in terms of file patterns, 2325 // Some internal tasks cannot be defined in terms of file patterns,
2332 // so we pass selection to check for them manually. 2326 // so we pass selection to check for them manually.
2333 if (selection.directoryCount == 0 && selection.fileCount > 0) { 2327 if (selection.directoryCount == 0 && selection.fileCount > 0) {
2334 // Only files, not directories, are supported for external tasks. 2328 // Only files, not directories, are supported for external tasks.
2335 chrome.fileBrowserPrivate.getFileTasks( 2329 chrome.fileBrowserPrivate.getFileTasks(
2336 selection.urls, 2330 selection.urls,
2337 this.onTasksFound_.bind(this, selection)); 2331 this.onTasksFound_.bind(this, selection));
2338 } else { 2332 } else {
2339 // There may be internal tasks for directories. 2333 // There may be internal tasks for directories.
2340 this.onTasksFound_(selection, []); 2334 this.onTasksFound_(selection, []);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2536 task.iconUrl = 2530 task.iconUrl =
2537 chrome.extension.getURL('images/filetype_generic.png'); 2531 chrome.extension.getURL('images/filetype_generic.png');
2538 task.title = str('INSTALL_CRX'); 2532 task.title = str('INSTALL_CRX');
2539 } 2533 }
2540 } 2534 }
2541 this.renderTaskItem_(task); 2535 this.renderTaskItem_(task);
2542 tasksCount++; 2536 tasksCount++;
2543 if (defaultTask == null) defaultTask = task; 2537 if (defaultTask == null) defaultTask = task;
2544 } 2538 }
2545 2539
2546 this.taskItems_.visible = tasksCount > 0; 2540 this.taskItems_.hidden = tasksCount == 0;
2547 if (tasksCount > 1) { 2541 if (tasksCount > 1) {
2548 // Duplicate default task in drop-down list. 2542 // Duplicate default task in drop-down list.
2549 this.renderTaskItem_(defaultTask); 2543 this.renderTaskItem_(defaultTask);
2550 } 2544 }
2551 2545
2552 selection.tasksList = tasksList; 2546 selection.tasksList = tasksList;
2553 if (selection.dispatchDefault) { 2547 if (selection.dispatchDefault) {
2554 // We got a request to dispatch the default task for the selection. 2548 // We got a request to dispatch the default task for the selection.
2555 selection.dispatchDefault = false; 2549 selection.dispatchDefault = false;
2556 this.dispatchDefaultTask_(selection); 2550 this.dispatchDefaultTask_(selection);
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after
4404 4398
4405 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); 4399 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo);
4406 4400
4407 if (oldValue) { 4401 if (oldValue) {
4408 event.target.removeAttribute('checked'); 4402 event.target.removeAttribute('checked');
4409 } else { 4403 } else {
4410 event.target.setAttribute('checked', 'checked'); 4404 event.target.setAttribute('checked', 'checked');
4411 } 4405 }
4412 }; 4406 };
4413 })(); 4407 })();
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