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

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

Issue 2622133008: mediaview: Implement UI. (Closed)
Patch Set: Fix typo and add logging. 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
Index: ui/file_manager/file_manager/background/js/volume_info_list_impl.js
diff --git a/ui/file_manager/file_manager/background/js/volume_info_list_impl.js b/ui/file_manager/file_manager/background/js/volume_info_list_impl.js
index 08b4f5eaa4ff9d0c0a0e44e602748af869ffb743..b3981cc0e5a90d5a59bc21689257edaad784624e 100644
--- a/ui/file_manager/file_manager/background/js/volume_info_list_impl.js
+++ b/ui/file_manager/file_manager/background/js/volume_info_list_impl.js
@@ -37,13 +37,27 @@ VolumeInfoListImpl.VOLUME_LIST_ORDER_ = [
VolumeManagerCommon.VolumeType.REMOVABLE,
VolumeManagerCommon.VolumeType.MTP,
VolumeManagerCommon.VolumeType.PROVIDED,
+ VolumeManagerCommon.VolumeType.MEDIA_VIEW,
+];
+
+/**
+ * The order of the media view roots.
+ * @type {Array<VolumeManagerCommon.MediaViewRootType>}
+ * @const
+ * @private
+ */
+VolumeInfoListImpl.MEDIA_VIEW_ROOT_ORDER_ = [
+ VolumeManagerCommon.MediaViewRootType.IMAGES,
+ VolumeManagerCommon.MediaViewRootType.VIDEOS,
+ VolumeManagerCommon.MediaViewRootType.AUDIO,
];
/**
* Orders two volumes by volumeType and volumeId.
*
* The volumes at first are compared by volume type in the order of
- * volumeListOrder_. Then they are compared by volume ID.
+ * volumeListOrder_. Then they are compared by volume ID, except for media
+ * views which are sorted in a fixed order.
*
* @param {!VolumeInfo} volumeInfo1 Volume info to be compared.
* @param {!VolumeInfo} volumeInfo2 Volume info to be compared.
@@ -58,6 +72,17 @@ VolumeInfoListImpl.compareVolumeInfo_ = function(volumeInfo1, volumeInfo2) {
VolumeInfoListImpl.VOLUME_LIST_ORDER_.indexOf(volumeInfo2.volumeType);
if (typeIndex1 !== typeIndex2)
return typeIndex1 < typeIndex2 ? -1 : 1;
+ if (volumeInfo1.volumeType === VolumeManagerCommon.VolumeType.MEDIA_VIEW) {
+ var mediaTypeIndex1 = VolumeInfoListImpl.MEDIA_VIEW_ROOT_ORDER_.indexOf(
+ VolumeManagerCommon.getMediaViewRootTypeFromVolumeId(
+ volumeInfo1.volumeId));
+ var mediaTypeIndex2 = VolumeInfoListImpl.MEDIA_VIEW_ROOT_ORDER_.indexOf(
+ VolumeManagerCommon.getMediaViewRootTypeFromVolumeId(
+ volumeInfo2.volumeId));
+ if (mediaTypeIndex1 !== mediaTypeIndex2)
+ return mediaTypeIndex1 < mediaTypeIndex2 ? -1 : 1;
+ return 0;
+ }
if (volumeInfo1.volumeId !== volumeInfo2.volumeId)
return volumeInfo1.volumeId < volumeInfo2.volumeId ? -1 : 1;
return 0;
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | ui/file_manager/file_manager/background/js/volume_manager_impl.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698