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

Side by Side Diff: chrome/browser/resources/file_manager/js/directory_model.js

Issue 9349015: [filebrowser] Save sorting field/order for modal dialogs, show spinner when scanning directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Spinner itself Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // If directory files changes too often, don't rescan directory more than once 5 // If directory files changes too often, don't rescan directory more than once
6 // per specified interval 6 // per specified interval
7 const SIMULTANEOUS_RESCAN_INTERVAL = 1000; 7 const SIMULTANEOUS_RESCAN_INTERVAL = 1000;
8 8
9 /** 9 /**
10 * Data model of the file manager. 10 * Data model of the file manager.
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 */ 331 */
332 scan_: function(callback) { 332 scan_: function(callback) {
333 if (this.rescanTimeout_) { 333 if (this.rescanTimeout_) {
334 clearTimeout(this.rescanTimeout_); 334 clearTimeout(this.rescanTimeout_);
335 this.rescanTimeout_ = 0; 335 this.rescanTimeout_ = 0;
336 } 336 }
337 if (this.runningScan_) 337 if (this.runningScan_)
338 this.runningScan_.cancel(); 338 this.runningScan_.cancel();
339 this.pendingScan_ = null; 339 this.pendingScan_ = null;
340 340
341 var onDone = function() {
342 cr.dispatchSimpleEvent(this, 'scan-completed');
343 callback();
344 }.bind(this);
345
341 // Clear the table first. 346 // Clear the table first.
342 this.fileList_.splice(0, this.fileList_.length); 347 this.fileList_.splice(0, this.fileList_.length);
343 this.runningScan_ = this.createScanner_(this.fileList_, callback); 348 cr.dispatchSimpleEvent(this, 'scan-started');
349 this.runningScan_ = this.createScanner_(this.fileList_, onDone);
344 this.runningScan_.run(); 350 this.runningScan_.run();
345 }, 351 },
346 352
347 prefetchCacheForSorting_: function(entries, callback) { 353 prefetchCacheForSorting_: function(entries, callback) {
348 var field = this.fileList_.sortStatus.field; 354 var field = this.fileList_.sortStatus.field;
349 if (field) { 355 if (field) {
350 this.prepareSortEntries_(entries, field, callback); 356 this.prepareSortEntries_(entries, field, callback);
351 } else { 357 } else {
352 callback(); 358 callback();
353 return; 359 return;
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 884
879 recordMetrics_: function() { 885 recordMetrics_: function() {
880 metrics.recordInterval('DirectoryScan'); 886 metrics.recordInterval('DirectoryScan');
881 if (this.dir_.fullPath == 887 if (this.dir_.fullPath ==
882 '/' + DirectoryModel.DOWNLOADS_DIRECTORY) { 888 '/' + DirectoryModel.DOWNLOADS_DIRECTORY) {
883 metrics.recordMediumCount("DownloadsCount", this.list_.length); 889 metrics.recordMediumCount("DownloadsCount", this.list_.length);
884 } 890 }
885 } 891 }
886 }; 892 };
887 893
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/images/spinner.svg ('k') | chrome/browser/resources/file_manager/js/file_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698