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

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

Issue 11088074: Files app: Update directory contents properly while Drive files are being fetched (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; 7 var SIMULTANEOUS_RESCAN_INTERVAL = 1000;
8 // Used for operations that require almost instant rescan. 8 // Used for operations that require almost instant rescan.
9 var SHORT_RESCAN_INTERVAL = 100; 9 var SHORT_RESCAN_INTERVAL = 100;
10 10
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 * changed. 763 * changed.
764 * 764 *
765 * @private 765 * @private
766 * @param {boolean} initial True if it comes from setupPath and 766 * @param {boolean} initial True if it comes from setupPath and
767 * false if caused by an user action. 767 * false if caused by an user action.
768 * @param {DirectoryEntry} dirEntry The absolute path to the new directory. 768 * @param {DirectoryEntry} dirEntry The absolute path to the new directory.
769 * @param {function} opt_callback Executed if the directory loads successfully. 769 * @param {function} opt_callback Executed if the directory loads successfully.
770 */ 770 */
771 DirectoryModel.prototype.changeDirectoryEntry_ = function(initial, dirEntry, 771 DirectoryModel.prototype.changeDirectoryEntry_ = function(initial, dirEntry,
772 opt_callback) { 772 opt_callback) {
773 if (dirEntry == DirectoryModel.fakeGDataEntry_) 773 if (dirEntry == DirectoryModel.fakeGDataEntry_ &&
774 this.volumeManager_.getGDataStatus() ==
775 VolumeManager.GDataStatus.UNMOUNTED)
774 this.volumeManager_.mountGData(function() {}, function() {}); 776 this.volumeManager_.mountGData(function() {}, function() {});
775 777
776 this.clearSearch_(); 778 this.clearSearch_();
777 var previous = this.currentDirContents_.getDirectoryEntry(); 779 var previous = this.currentDirContents_.getDirectoryEntry();
778 this.changeDirectoryEntrySilent_(dirEntry, opt_callback); 780 this.changeDirectoryEntrySilent_(dirEntry, opt_callback);
779 781
780 var e = new cr.Event('directory-changed'); 782 var e = new cr.Event('directory-changed');
781 e.previousDirEntry = previous; 783 e.previousDirEntry = previous;
782 e.newDirEntry = dirEntry; 784 e.newDirEntry = dirEntry;
783 e.initial = initial; 785 e.initial = initial;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 1076
1075 /** 1077 /**
1076 * @private 1078 * @private
1077 */ 1079 */
1078 DirectoryModel.prototype.updateRootsListSelection_ = function() { 1080 DirectoryModel.prototype.updateRootsListSelection_ = function() {
1079 var rootPath = this.getCurrentRootPath(); 1081 var rootPath = this.getCurrentRootPath();
1080 this.rootsListSelection_.selectedIndex = this.findRootsListIndex(rootPath); 1082 this.rootsListSelection_.selectedIndex = this.findRootsListIndex(rootPath);
1081 }; 1083 };
1082 1084
1083 /** 1085 /**
1084 * @return {true} True if GDATA mounted. 1086 * @return {boolean} True if GDATA if fully mounted.
dgozman 2012/10/11 12:25:43 typo: if -> is
1085 * @private 1087 * @private
1086 */ 1088 */
1087 DirectoryModel.prototype.isGDataMounted_ = function() { 1089 DirectoryModel.prototype.isGDataMounted_ = function() {
1088 return this.volumeManager_.isMounted(RootDirectory.GDATA); 1090 return this.volumeManager_.getGDataStatus() ==
1091 VolumeManager.GDataStatus.MOUNTED;
1089 }; 1092 };
1090 1093
1091 /** 1094 /**
1092 * Handler for the VolumeManager's event. 1095 * Handler for the VolumeManager's event.
1093 * @private 1096 * @private
1094 */ 1097 */
1095 DirectoryModel.prototype.onMountChanged_ = function() { 1098 DirectoryModel.prototype.onMountChanged_ = function() {
1096 this.updateRoots_(); 1099 this.updateRoots_();
1097 1100
1098 var rootType = this.getCurrentRootType(); 1101 var rootType = this.getCurrentRootType();
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 }.bind(this)); 1370 }.bind(this));
1368 } 1371 }
1369 }; 1372 };
1370 1373
1371 /** 1374 /**
1372 * @return {DirectoryEntry} Current watched directory entry. 1375 * @return {DirectoryEntry} Current watched directory entry.
1373 */ 1376 */
1374 FileWatcher.prototype.getWatchedDirectoryEntry = function() { 1377 FileWatcher.prototype.getWatchedDirectoryEntry = function() {
1375 return this.watchedDirectoryEntry_; 1378 return this.watchedDirectoryEntry_;
1376 }; 1379 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698