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

Unified Diff: ui/file_manager/file_manager/foreground/js/quick_view_controller.js

Issue 2633053003: Fix broken quick view in non-local volumes. (Closed)
Patch Set: Do not query unnecessary externalFileUrl. Created 3 years, 11 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
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/file_manager.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/quick_view_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/quick_view_controller.js b/ui/file_manager/file_manager/foreground/js/quick_view_controller.js
index f659b30046494aa279226457c6585e3ae776a150..1b8e182b64088b4ddf28907da85aabb0ae6933cc 100644
--- a/ui/file_manager/file_manager/foreground/js/quick_view_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/quick_view_controller.js
@@ -15,13 +15,14 @@
* @param {!QuickViewUma} quickViewUma
* @param {!MetadataBoxController} metadataBoxController
* @param {DialogType} dialogType
+ * @param {!VolumeManagerWrapper} volumeManager
*
* @constructor
*/
function QuickViewController(
metadataModel, selectionHandler, listContainer, quickViewModel,
taskController, fileListSelectionModel, quickViewUma,
- metadataBoxController, dialogType) {
+ metadataBoxController, dialogType, volumeManager) {
/**
* @type {FilesQuickView}
* @private
@@ -83,6 +84,12 @@ function QuickViewController(
this.dialogType_ = dialogType;
/**
+ * @type {!VolumeManagerWrapper}
+ * @private
+ */
+ this.volumeManager_ = volumeManager;
+
+ /**
* Current selection of selectionHandler.
*
* @type {!Array<!FileEntry>}
@@ -102,6 +109,28 @@ function QuickViewController(
}
/**
+ * List of local volume types.
+ *
+ * In this context, "local" means that files in that volume are directly
+ * accessible from the Chrome browser process by Linux VFS paths. In this
+ * regard, media views are NOT local even though files in media views are
+ * actually stored in the local disk.
+ *
+ * Due to access control of WebView, non-local files can not be previewed
+ * with Quick View unless thumbnails are provided (which is the case with
+ * Drive).
+ *
+ * @type {!Array<!VolumeManagerCommon.VolumeType>}
+ * @const
+ * @private
+ */
+QuickViewController.LOCAL_VOLUME_TYPES_ = [
+ VolumeManagerCommon.VolumeType.ARCHIVE,
+ VolumeManagerCommon.VolumeType.DOWNLOADS,
+ VolumeManagerCommon.VolumeType.REMOVABLE,
+];
+
+/**
* Initialize the controller with quick view which will be lazily loaded.
* @param {!FilesQuickView} quickView
* @private
@@ -258,7 +287,7 @@ QuickViewController.prototype.updateQuickView_ = function() {
this.quickViewUma_.onEntryChanged(entry);
return Promise
.all([
- this.metadataModel_.get([entry], ['thumbnailUrl', 'externalFileUrl']),
+ this.metadataModel_.get([entry], ['thumbnailUrl']),
this.getAvailableTasks_(entry)
])
.then(function(values) {
@@ -325,7 +354,13 @@ QuickViewController.prototype.getQuickViewParameters_ = function(
hasTask: tasks.length > 0,
};
- if (item.externalFileUrl) {
+ var volumeInfo = this.volumeManager_.getVolumeInfo(entry);
+ var localFile =
+ volumeInfo &&
+ QuickViewController.LOCAL_VOLUME_TYPES_.indexOf(
+ volumeInfo.volumeType) >= 0;
+
+ if (!localFile) {
switch (type) {
case 'image':
if (item.thumbnailUrl) {
@@ -349,7 +384,7 @@ QuickViewController.prototype.getQuickViewParameters_ = function(
}
break;
}
- // If the file is in Drive, we ask user to open it with external app.
+ // We ask user to open it with external app.
return Promise.resolve(params);
}
« no previous file with comments | « ui/file_manager/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