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

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

Issue 419173002: Files.app: Make the sort for the search result stable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 5 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/file_table.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_table.js b/ui/file_manager/file_manager/foreground/js/file_table.js
index 0a2f6cfff09876dfffd073a259b131eb240ca61e..add85a20f3799dcbeaba127b98c7d05373e2b2d1 100644
--- a/ui/file_manager/file_manager/foreground/js/file_table.js
+++ b/ui/file_manager/file_manager/foreground/js/file_table.js
@@ -219,7 +219,6 @@ FileTable.decorate = function(self, metadataCache, volumeManager, fullPage) {
self.__proto__ = FileTable.prototype;
self.metadataCache_ = metadataCache;
self.volumeManager_ = volumeManager;
- self.collator_ = Intl.Collator([], {numeric: true, sensitivity: 'base'});
var columns = [
new cr.ui.table.TableColumn('name', str('NAME_COLUMN_LABEL'),
@@ -424,21 +423,6 @@ FileTable.prototype.shouldStartDragSelection_ = function(event) {
};
/**
- * Prepares the data model to be sorted by columns.
- * @param {cr.ui.ArrayDataModel} dataModel Data model to prepare.
- */
-FileTable.prototype.setupCompareFunctions = function(dataModel) {
- dataModel.setCompareFunction('name',
- this.compareName_.bind(this));
- dataModel.setCompareFunction('modificationTime',
- this.compareMtime_.bind(this));
- dataModel.setCompareFunction('size',
- this.compareSize_.bind(this));
- dataModel.setCompareFunction('type',
- this.compareType_.bind(this));
-};
-
-/**
* Render the Name column of the detail table.
*
* Invoked by cr.ui.Table when a file needs to be rendered.
@@ -628,80 +612,6 @@ FileTable.prototype.updateListItemsMetadata = function(type, entries) {
};
/**
- * Compare by mtime first, then by name.
- * @param {Entry} a First entry.
- * @param {Entry} b Second entry.
- * @return {number} Compare result.
- * @private
- */
-FileTable.prototype.compareName_ = function(a, b) {
- return this.collator_.compare(a.name, b.name);
-};
-
-/**
- * Compare by mtime first, then by name.
- * @param {Entry} a First entry.
- * @param {Entry} b Second entry.
- * @return {number} Compare result.
- * @private
- */
-FileTable.prototype.compareMtime_ = function(a, b) {
- var aCachedFilesystem = this.metadataCache_.getCached(a, 'filesystem');
- var aTime = aCachedFilesystem ? aCachedFilesystem.modificationTime : 0;
-
- var bCachedFilesystem = this.metadataCache_.getCached(b, 'filesystem');
- var bTime = bCachedFilesystem ? bCachedFilesystem.modificationTime : 0;
-
- if (aTime > bTime)
- return 1;
-
- if (aTime < bTime)
- return -1;
-
- return this.collator_.compare(a.name, b.name);
-};
-
-/**
- * Compare by size first, then by name.
- * @param {Entry} a First entry.
- * @param {Entry} b Second entry.
- * @return {number} Compare result.
- * @private
- */
-FileTable.prototype.compareSize_ = function(a, b) {
- var aCachedFilesystem = this.metadataCache_.getCached(a, 'filesystem');
- var aSize = aCachedFilesystem ? aCachedFilesystem.size : 0;
-
- var bCachedFilesystem = this.metadataCache_.getCached(b, 'filesystem');
- var bSize = bCachedFilesystem ? bCachedFilesystem.size : 0;
-
- if (aSize !== bSize) return aSize - bSize;
- return this.collator_.compare(a.name, b.name);
-};
-
-/**
- * Compare by type first, then by subtype and then by name.
- * @param {Entry} a First entry.
- * @param {Entry} b Second entry.
- * @return {number} Compare result.
- * @private
- */
-FileTable.prototype.compareType_ = function(a, b) {
- // Directories precede files.
- if (a.isDirectory !== b.isDirectory)
- return Number(b.isDirectory) - Number(a.isDirectory);
-
- var aType = FileType.typeToString(FileType.getType(a));
- var bType = FileType.typeToString(FileType.getType(b));
-
- var result = this.collator_.compare(aType, bType);
- if (result !== 0)
- return result;
-
- return this.collator_.compare(a.name, b.name);
-};
-
-/**
* Renders table row.
* @param {function(Entry, cr.ui.Table)} baseRenderFunction Base renderer.
* @param {Entry} entry Corresponding entry.
« 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