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

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

Issue 148193002: Removed most of path utility functions in Files app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 10 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
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 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 tracker.start(); 1403 tracker.start();
1404 this.volumeManager_.ensureInitialized(callback); 1404 this.volumeManager_.ensureInitialized(callback);
1405 }.bind(this)); 1405 }.bind(this));
1406 1406
1407 var nextCurrentDirEntry; 1407 var nextCurrentDirEntry;
1408 var selectionEntry; 1408 var selectionEntry;
1409 1409
1410 // Resolve the selectionURL to selectionEntry or to currentDirectoryEntry 1410 // Resolve the selectionURL to selectionEntry or to currentDirectoryEntry
1411 // in case of being a display root. 1411 // in case of being a display root.
1412 queue.run(function(callback) { 1412 queue.run(function(callback) {
1413 // TODO(mtomasz): Migrate to URLs, and stop calling resolveAbsoluteURL.
1414 if (!this.initSelectionURL_) { 1413 if (!this.initSelectionURL_) {
1415 callback(); 1414 callback();
1416 return; 1415 return;
1417 } 1416 }
1418 webkitResolveLocalFileSystemURL( 1417 webkitResolveLocalFileSystemURL(
1419 this.initSelectionURL_, 1418 this.initSelectionURL_,
1420 function(inEntry) { 1419 function(inEntry) {
1421 var locationInfo = this.volumeManager_.getLocationInfo(inEntry); 1420 var locationInfo = this.volumeManager_.getLocationInfo(inEntry);
1421 // If location information is not available, then the volume is
1422 // no longer (or never) available.
1423 if (!locationInfo) {
1424 callback();
1425 return;
1426 }
1422 // If the selection is root, then use it as a current directory 1427 // If the selection is root, then use it as a current directory
1423 // instead. This is because, selecting a root entry is done as 1428 // instead. This is because, selecting a root entry is done as
1424 // opening it. 1429 // opening it.
1425 if (locationInfo && locationInfo.isRootEntry) 1430 if (locationInfo.isRootEntry)
1426 nextCurrentDirEntry = inEntry; 1431 nextCurrentDirEntry = inEntry;
1427 else 1432 else
1428 selectionEntry = inEntry; 1433 selectionEntry = inEntry;
1429 callback(); 1434 callback();
1430 }.bind(this), callback); 1435 }.bind(this), callback);
1431 }.bind(this)); 1436 }.bind(this));
1432 // Resolve the currentDirectoryURL to currentDirectoryEntry (if not done 1437 // Resolve the currentDirectoryURL to currentDirectoryEntry (if not done
1433 // by the previous step). 1438 // by the previous step).
1434 queue.run(function(callback) { 1439 queue.run(function(callback) {
1435 if (nextCurrentDirEntry || !this.initCurrentDirectoryURL_) { 1440 if (nextCurrentDirEntry || !this.initCurrentDirectoryURL_) {
1436 callback(); 1441 callback();
1437 return; 1442 return;
1438 } 1443 }
1439 webkitResolveLocalFileSystemURL( 1444 webkitResolveLocalFileSystemURL(
1440 this.initCurrentDirectoryURL_, 1445 this.initCurrentDirectoryURL_,
1441 function(inEntry) { 1446 function(inEntry) {
1447 var locationInfo = this.volumeManager_.getLocationInfo(inEntry);
1448 if (!locationInfo) {
1449 callback();
1450 return;
1451 }
1442 nextCurrentDirEntry = inEntry; 1452 nextCurrentDirEntry = inEntry;
1443 callback(); 1453 callback();
1444 }, callback); 1454 }.bind(this), callback);
1445 // TODO(mtomasz): Implement reopening on special search, when fake 1455 // TODO(mtomasz): Implement reopening on special search, when fake
1446 // entries are converted to directory providers. 1456 // entries are converted to directory providers.
1447 }.bind(this)); 1457 }.bind(this));
1448 1458
1449 // If the directory to be changed to is not available, then first fallback 1459 // If the directory to be changed to is not available, then first fallback
1450 // to the parent of the selection entry. 1460 // to the parent of the selection entry.
1451 queue.run(function(callback) { 1461 queue.run(function(callback) {
1452 if (nextCurrentDirEntry || !selectionEntry) { 1462 if (nextCurrentDirEntry || !selectionEntry) {
1453 callback(); 1463 callback();
1454 return; 1464 return;
(...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3680 callback(this.preferences_); 3690 callback(this.preferences_);
3681 return; 3691 return;
3682 } 3692 }
3683 3693
3684 chrome.fileBrowserPrivate.getPreferences(function(prefs) { 3694 chrome.fileBrowserPrivate.getPreferences(function(prefs) {
3685 this.preferences_ = prefs; 3695 this.preferences_ = prefs;
3686 callback(prefs); 3696 callback(prefs);
3687 }.bind(this)); 3697 }.bind(this));
3688 }; 3698 };
3689 })(); 3699 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698