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

Unified Diff: ui/file_manager/file_manager/background/js/background.js

Issue 612303005: Files.app: Remove navigationVolumeMap from the background page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/file_manager/background/js/background.js
diff --git a/ui/file_manager/file_manager/background/js/background.js b/ui/file_manager/file_manager/background/js/background.js
index 47fdcc4e5330abd66b634348cf77a04dadfb8076..40a414f6c31fa6a16947ab94410d2eac66e19de8 100644
--- a/ui/file_manager/file_manager/background/js/background.js
+++ b/ui/file_manager/file_manager/background/js/background.js
@@ -65,7 +65,7 @@ function Background() {
this.deviceHandler_.addEventListener(
DeviceHandler.VOLUME_NAVIGATION_REQUESTED,
function(event) {
- this.navigateToVolume(event.volumeId);
+ this.navigateToVolume_(event.devicePath);
}.bind(this));
/**
@@ -226,13 +226,17 @@ Background.prototype.getSimilarWindows = function(url) {
/**
* Opens the root directory of the volume in Files.app.
* @param {string} volumeId ID of a volume to be opened.
+ * @private
*/
-Background.prototype.navigateToVolume = function(volumeId) {
+Background.prototype.navigateToVolume_ = function(devicePath) {
VolumeManager.getInstance().then(function(volumeManager) {
var volumeInfoList = volumeManager.volumeInfoList;
- var index = volumeInfoList.findIndex(volumeId);
- var volumeInfo = volumeInfoList.item(index);
- return volumeInfo.resolveDisplayRoot();
+ for (var i = 0; i < volumeInfoList.length; i++) {
+ if (volumeInfoList.item(i).devicePath == devicePath)
+ return volumeInfoList.item(i).resolveDisplayRoot();
+ }
+ return Promise.reject(
+ 'Volume having the device path: ' + devicePath + ' is not found.');
}).then(function(entry) {
launchFileManager(
{currentDirectoryURL: entry.toURL()},

Powered by Google App Engine
This is Rietveld 408576698