| Index: ui/file_manager/file_manager/foreground/js/directory_contents.js
|
| diff --git a/ui/file_manager/file_manager/foreground/js/directory_contents.js b/ui/file_manager/file_manager/foreground/js/directory_contents.js
|
| index b40d1ec04fab3da10ee88ebe3bcd1c0221e15340..10ca762e4b2cfd863986691d4016db35c5c25b5b 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/directory_contents.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/directory_contents.js
|
| @@ -415,14 +415,8 @@ function FileListModel(metadataCache) {
|
| */
|
| this.metadataCache_ = metadataCache;
|
|
|
| - /**
|
| - * Collator for sorting.
|
| - * @type {Intl.Collator}
|
| - */
|
| - this.collator_ = new Intl.Collator([], {numeric: true, sensitivity: 'base'});
|
| -
|
| // Initialize compare functions.
|
| - this.setCompareFunction('name', this.compareName_.bind(this));
|
| + this.setCompareFunction('name', util.compareName);
|
| this.setCompareFunction('modificationTime', this.compareMtime_.bind(this));
|
| this.setCompareFunction('size', this.compareSize_.bind(this));
|
| this.setCompareFunction('type', this.compareType_.bind(this));
|
| @@ -439,18 +433,6 @@ FileListModel.prototype = {
|
| * @return {number} Compare result.
|
| * @private
|
| */
|
| -FileListModel.prototype.compareName_ = function(a, b) {
|
| - var result = this.collator_.compare(a.name, b.name);
|
| - return result !== 0 ? result : a.toURL().localeCompare(b.toURL());
|
| -};
|
| -
|
| -/**
|
| - * Compare by mtime first, then by name.
|
| - * @param {Entry} a First entry.
|
| - * @param {Entry} b Second entry.
|
| - * @return {number} Compare result.
|
| - * @private
|
| - */
|
| FileListModel.prototype.compareMtime_ = function(a, b) {
|
| var aCachedFilesystem = this.metadataCache_.getCached(a, 'filesystem');
|
| var aTime = aCachedFilesystem ? aCachedFilesystem.modificationTime : 0;
|
| @@ -464,7 +446,7 @@ FileListModel.prototype.compareMtime_ = function(a, b) {
|
| if (aTime < bTime)
|
| return -1;
|
|
|
| - return this.compareName_(a, b);
|
| + return util.compareName(a, b);
|
| };
|
|
|
| /**
|
| @@ -481,7 +463,7 @@ FileListModel.prototype.compareSize_ = function(a, b) {
|
| var bCachedFilesystem = this.metadataCache_.getCached(b, 'filesystem');
|
| var bSize = bCachedFilesystem ? bCachedFilesystem.size : 0;
|
|
|
| - return aSize !== bSize ? aSize - bSize : this.compareName_(a, b);
|
| + return aSize !== bSize ? aSize - bSize : util.compareName(a, b);
|
| };
|
|
|
| /**
|
| @@ -499,8 +481,8 @@ FileListModel.prototype.compareType_ = function(a, b) {
|
| var aType = FileType.typeToString(FileType.getType(a));
|
| var bType = FileType.typeToString(FileType.getType(b));
|
|
|
| - var result = this.collator_.compare(aType, bType);
|
| - return result !== 0 ? result : this.compareName_(a, b);
|
| + var result = util.collator.compare(aType, bType);
|
| + return result !== 0 ? result : util.compareName(a, b);
|
| };
|
|
|
| /**
|
|
|