Commit 0bc28489 authored by mtomasz@chromium.org's avatar mtomasz@chromium.org

Get rid of fullPath in the metadata cache.

This patch removes the last instance of fullPath from the metadata cache, by using volume manager and its getLocationInformation method.

TEST=Tested manually.
BUG=320967

Review URL: https://codereview.chromium.org/130663002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243812 0039d316-1c4b-4281-b951-d872f2087c98
parent 09c2c765
...@@ -659,7 +659,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; ...@@ -659,7 +659,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
DialogType.FULL_PAGE]); DialogType.FULL_PAGE]);
// Create the metadata cache. // Create the metadata cache.
this.metadataCache_ = MetadataCache.createFull(); this.metadataCache_ = MetadataCache.createFull(this.volumeManager_);
// Create the root view of FileManager. // Create the root view of FileManager.
this.ui_ = new FileManagerUI(this.dialogDom_, this.dialogType); this.ui_ = new FileManagerUI(this.dialogDom_, this.dialogType);
......
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
*/ */
function AudioPlayer(container) { function AudioPlayer(container) {
this.container_ = container; this.container_ = container;
this.metadataCache_ = MetadataCache.createFull();
this.currentTrack_ = -1; this.currentTrack_ = -1;
this.playlistGeneration_ = 0; this.playlistGeneration_ = 0;
this.selectedEntry_ = null; this.selectedEntry_ = null;
this.volumeManager_ = new VolumeManagerWrapper( this.volumeManager_ = new VolumeManagerWrapper(
VolumeManagerWrapper.DriveEnabledStatus.DRIVE_ENABLED); VolumeManagerWrapper.DriveEnabledStatus.DRIVE_ENABLED);
this.metadataCache_ = MetadataCache.createFull(this.volumeManager_);
this.container_.classList.add('collapsed'); this.container_.classList.add('collapsed');
......
...@@ -141,11 +141,11 @@ function loadVideoPlayer() { ...@@ -141,11 +141,11 @@ function loadVideoPlayer() {
document.querySelector('#video-container'), document.querySelector('#video-container'),
document.querySelector('#controls')); document.querySelector('#controls'));
metadataCache = MetadataCache.createFull();
volumeManager = new VolumeManagerWrapper( volumeManager = new VolumeManagerWrapper(
VolumeManagerWrapper.DriveEnabledStatus.DRIVE_ENABLED); VolumeManagerWrapper.DriveEnabledStatus.DRIVE_ENABLED);
volumeManager.addEventListener('externally-unmounted', volumeManager.addEventListener('externally-unmounted',
onExternallyUnmounted); onExternallyUnmounted);
metadataCache = MetadataCache.createFull(volumeManager);
// If the video player is starting before the first instance of the File // If the video player is starting before the first instance of the File
// Manager then it does not have access to filesystem URLs. // Manager then it does not have access to filesystem URLs.
......
...@@ -108,12 +108,13 @@ MetadataCache.DESCENDANTS = 2; ...@@ -108,12 +108,13 @@ MetadataCache.DESCENDANTS = 2;
MetadataCache.EVICTION_NUMBER = 1000; MetadataCache.EVICTION_NUMBER = 1000;
/** /**
* @param {VolumeManagerWrapper} volumeManager Volume manager instance.
* @return {MetadataCache!} The cache with all providers. * @return {MetadataCache!} The cache with all providers.
*/ */
MetadataCache.createFull = function() { MetadataCache.createFull = function(volumeManager) {
var cache = new MetadataCache(); var cache = new MetadataCache();
cache.providers_.push(new FilesystemProvider()); cache.providers_.push(new FilesystemProvider());
cache.providers_.push(new DriveProvider()); cache.providers_.push(new DriveProvider(volumeManager));
cache.providers_.push(new ContentProvider()); cache.providers_.push(new ContentProvider());
return cache; return cache;
}; };
...@@ -671,11 +672,18 @@ FilesystemProvider.prototype.fetch = function( ...@@ -671,11 +672,18 @@ FilesystemProvider.prototype.fetch = function(
* drive: { pinned, hosted, present, customIconUrl, etc. } * drive: { pinned, hosted, present, customIconUrl, etc. }
* thumbnail: { url, transform } * thumbnail: { url, transform }
* streaming: { } * streaming: { }
* @param {VolumeManagerWrapper} volumeManager Volume manager instance.
* @constructor * @constructor
*/ */
function DriveProvider() { function DriveProvider(volumeManager) {
MetadataProvider.call(this); MetadataProvider.call(this);
/**
* @type {VolumeManagerWrapper}
* @private
*/
this.volumeManager_ = volumeManager;
// We batch metadata fetches into single API call. // We batch metadata fetches into single API call.
this.entries_ = []; this.entries_ = [];
this.callbacks_ = []; this.callbacks_ = [];
...@@ -693,8 +701,8 @@ DriveProvider.prototype = { ...@@ -693,8 +701,8 @@ DriveProvider.prototype = {
* @return {boolean} Whether this provider supports the entry. * @return {boolean} Whether this provider supports the entry.
*/ */
DriveProvider.prototype.supportsEntry = function(entry) { DriveProvider.prototype.supportsEntry = function(entry) {
// TODO(mtomasz): Use Entry instead of paths. var locationInfo = this.volumeManager_.getLocationInfo(entry);
return PathUtil.isDriveBasedPath(entry.fullPath); return locationInfo && locationInfo.isDriveBased;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment