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

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

Issue 104643004: Fix broken task handling in Files app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix recovering. 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 | « no previous file | chrome/browser/resources/file_manager/foreground/js/file_tasks.js » ('j') | 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 * FileManager constructor. 8 * FileManager constructor.
9 * 9 *
10 * FileManager objects encapsulate the functionality of the file selector 10 * FileManager objects encapsulate the functionality of the file selector
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 1481
1482 /** 1482 /**
1483 * @param {DirectoryEntry} directoryEntry Directory to be opened. 1483 * @param {DirectoryEntry} directoryEntry Directory to be opened.
1484 * @param {Entry=} opt_selectionEntry Entry to be selected. 1484 * @param {Entry=} opt_selectionEntry Entry to be selected.
1485 * @param {string=} opt_suggestedName Suggested name for a non-existing\ 1485 * @param {string=} opt_suggestedName Suggested name for a non-existing\
1486 * selection. 1486 * selection.
1487 * @private 1487 * @private
1488 */ 1488 */
1489 FileManager.prototype.finishSetupCurrentDirectory_ = function( 1489 FileManager.prototype.finishSetupCurrentDirectory_ = function(
1490 directoryEntry, opt_selectionEntry, opt_suggestedName) { 1490 directoryEntry, opt_selectionEntry, opt_suggestedName) {
1491 console.log(directoryEntry, opt_selectionEntry, opt_suggestedName);
hirono 2013/12/05 08:32:36 nit: Please remove this line.
mtomasz 2013/12/06 05:14:18 Done.
1491 // Open the directory, and select the selection (if passed). 1492 // Open the directory, and select the selection (if passed).
1492 this.directoryModel_.changeDirectoryEntry(directoryEntry, function() { 1493 this.directoryModel_.changeDirectoryEntry(directoryEntry, function() {
1493 if (opt_selectionEntry) 1494 if (opt_selectionEntry)
1494 this.directoryModel_.selectEntry(opt_selectionEntry); 1495 this.directoryModel_.selectEntry(opt_selectionEntry);
1495 }.bind(this)); 1496 }.bind(this));
1496 1497
1497 if (this.dialogType == DialogType.FULL_PAGE) { 1498 if (this.dialogType == DialogType.FULL_PAGE) {
1498 // In the FULL_PAGE mode if the restored path points to a file we might 1499 // In the FULL_PAGE mode if the restored path points to a file we might
1499 // have to invoke a task after selecting it. 1500 // have to invoke a task after selecting it.
1500 if (this.params_.action == 'select') 1501 if (this.params_.action == 'select')
(...skipping 12 matching lines...) Expand all
1513 } else if (opt_selectionEntry) { 1514 } else if (opt_selectionEntry) {
1514 // There is a file to be selected. It means, that we are recovering 1515 // There is a file to be selected. It means, that we are recovering
1515 // the Files app. 1516 // the Files app.
1516 // We call the appropriate methods of FileTasks directly as we do 1517 // We call the appropriate methods of FileTasks directly as we do
1517 // not need any of the preparations that |execute| method does. 1518 // not need any of the preparations that |execute| method does.
1518 // TODO(mtomasz): Change Entry.fullPath to Entry. 1519 // TODO(mtomasz): Change Entry.fullPath to Entry.
1519 var mediaType = FileType.getMediaType(opt_selectionEntry.fullPath); 1520 var mediaType = FileType.getMediaType(opt_selectionEntry.fullPath);
1520 if (mediaType == 'image' || mediaType == 'video') { 1521 if (mediaType == 'image' || mediaType == 'video') {
1521 task = function() { 1522 task = function() {
1522 // TODO(mtomasz): Replace the url with an entry. 1523 // TODO(mtomasz): Replace the url with an entry.
1523 new FileTasks(this, this.params_).openGallery( 1524 new FileTasks(this, this.params_).openGallery([opt_selectionEntry]);
1524 [opt_selectionEntry.toURL()]);
1525 }.bind(this); 1525 }.bind(this);
1526 } else if (mediaType == 'archive') { 1526 } else if (mediaType == 'archive') {
1527 task = function() { 1527 task = function() {
1528 new FileTasks(this, this.params_).mountArchives( 1528 new FileTasks(this, this.params_).mountArchives(
1529 [opt_selectionEntry.toURL()]); 1529 [opt_selectionEntry]);
1530 }.bind(this); 1530 }.bind(this);
1531 } 1531 }
1532 } 1532 }
1533 1533
1534 // If there is a task to be run, run it after the scan is completed. 1534 // If there is a task to be run, run it after the scan is completed.
1535 if (task) { 1535 if (task) {
1536 var listener = function() { 1536 var listener = function() {
1537 this.directoryModel_.removeEventListener( 1537 this.directoryModel_.removeEventListener(
1538 'scan-completed', listener); 1538 'scan-completed', listener);
1539 task(); 1539 task();
(...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after
3592 callback(this.preferences_); 3592 callback(this.preferences_);
3593 return; 3593 return;
3594 } 3594 }
3595 3595
3596 chrome.fileBrowserPrivate.getPreferences(function(prefs) { 3596 chrome.fileBrowserPrivate.getPreferences(function(prefs) {
3597 this.preferences_ = prefs; 3597 this.preferences_ = prefs;
3598 callback(prefs); 3598 callback(prefs);
3599 }.bind(this)); 3599 }.bind(this));
3600 }; 3600 };
3601 })(); 3601 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/foreground/js/file_tasks.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698