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

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

Issue 104643004: Fix broken task handling in Files app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 7 years 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 | « chrome/browser/resources/file_manager/foreground/js/file_manager.js ('k') | 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 * This object encapsulates everything related to tasks execution. 8 * This object encapsulates everything related to tasks execution.
9 * 9 *
10 * @param {FileManager} fileManager FileManager instance. 10 * @param {FileManager} fileManager FileManager instance.
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 * @private 552 * @private
553 */ 553 */
554 FileTasks.prototype.mountArchivesInternal_ = function(entries) { 554 FileTasks.prototype.mountArchivesInternal_ = function(entries) {
555 var fm = this.fileManager_; 555 var fm = this.fileManager_;
556 556
557 var tracker = fm.directoryModel_.createDirectoryChangeTracker(); 557 var tracker = fm.directoryModel_.createDirectoryChangeTracker();
558 tracker.start(); 558 tracker.start();
559 559
560 // TODO(mtomasz): Pass Entries instead of URLs. 560 // TODO(mtomasz): Pass Entries instead of URLs.
561 var urls = util.entriesToURLs(entries); 561 var urls = util.entriesToURLs(entries);
562 fm.resolveSelectResults_(urls, function(entries) { 562 fm.resolveSelectResults_(urls, function(resolvedURLs) {
563 for (var index = 0; index < entries.length; ++index) { 563 for (var index = 0; index < resolvedURLs.length; ++index) {
564 // TODO(mtomasz): Pass Entry instead of URL. 564 // TODO(mtomasz): Pass Entry instead of URL.
565 fm.volumeManager_.mountArchive(entries[index].toURL(), 565 fm.volumeManager_.mountArchive(resolvedURLs[index],
566 function(mountPath) { 566 function(mountPath) {
567 tracker.stop(); 567 tracker.stop();
568 if (!tracker.hasChanged) 568 if (!tracker.hasChanged)
569 fm.directoryModel_.changeDirectory(mountPath); 569 fm.directoryModel_.changeDirectory(mountPath);
570 }, function(entry, error) { 570 }, function(url, error) {
571 tracker.stop(); 571 tracker.stop();
572 fm.alert.show(strf('ARCHIVE_MOUNT_FAILED', entry.name, error)); 572 var path = util.extractFilePath(url);
573 }.bind(null, entries[index])); 573 var namePos = path.lastIndexOf('/');
574 fm.alert.show(strf('ARCHIVE_MOUNT_FAILED',
575 path.substr(namePos + 1), error));
576 }.bind(null, resolvedURLs[index]));
574 } 577 }
575 }); 578 });
576 }; 579 };
577 580
578 /** 581 /**
579 * Open the Gallery. 582 * Open the Gallery.
580 * 583 *
581 * @param {Array.<Entry>} entries List of selected entries. 584 * @param {Array.<Entry>} entries List of selected entries.
582 */ 585 */
583 FileTasks.prototype.openGallery = function(entries) { 586 FileTasks.prototype.openGallery = function(entries) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 items, defaultIdx, 817 items, defaultIdx,
815 function(item) { 818 function(item) {
816 onSuccess(item.task); 819 onSuccess(item.task);
817 }); 820 });
818 }; 821 };
819 822
820 FileTasks.decorate('display'); 823 FileTasks.decorate('display');
821 FileTasks.decorate('updateMenuItem'); 824 FileTasks.decorate('updateMenuItem');
822 FileTasks.decorate('execute'); 825 FileTasks.decorate('execute');
823 FileTasks.decorate('executeDefault'); 826 FileTasks.decorate('executeDefault');
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/foreground/js/file_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698