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

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

Issue 12716015: filemanager: Files App change necessary to use "drive/root". It still works with "drive". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments. Created 7 years, 9 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 | chrome/browser/resources/file_manager/js/drive_banners.js » ('j') | 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 * @type {Object.<string, string>} 50 * @type {Object.<string, string>}
51 * @private 51 * @private
52 */ 52 */
53 this.currentDirByRoot_ = {}; 53 this.currentDirByRoot_ = {};
54 54
55 this.volumeManager_ = volumeManager; 55 this.volumeManager_ = volumeManager;
56 } 56 }
57 57
58 /** 58 /**
59 * Fake entry to be used in currentDirEntry_ when current directory is 59 * Fake entry to be used in currentDirEntry_ when current directory is
60 * unmounted DRIVE. 60 * unmounted DRIVE. TODO(haruki): Support "drive/root" and "drive/other".
61 * @private 61 * @private
62 */ 62 */
63 DirectoryModel.fakeDriveEntry_ = { 63 DirectoryModel.fakeDriveEntry_ = {
64 fullPath: RootDirectory.DRIVE, 64 fullPath: RootDirectory.DRIVE,
65 isDirectory: true 65 isDirectory: true
66 }; 66 };
67 67
68 /** 68 /**
69 * Fake entry representing a psuedo directory, which contains Drive files 69 * Fake entry representing a psuedo directory, which contains Drive files
70 * available offline. This entry works as a trigger to start a search using 70 * available offline. This entry works as a trigger to start a search using
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 1088
1089 readSingle(RootDirectory.DOWNLOADS.substring(1), 'downloads'); 1089 readSingle(RootDirectory.DOWNLOADS.substring(1), 'downloads');
1090 util.readDirectory(root, RootDirectory.ARCHIVE.substring(1), 1090 util.readDirectory(root, RootDirectory.ARCHIVE.substring(1),
1091 append.bind(this, 'archives')); 1091 append.bind(this, 'archives'));
1092 util.readDirectory(root, RootDirectory.REMOVABLE.substring(1), 1092 util.readDirectory(root, RootDirectory.REMOVABLE.substring(1),
1093 append.bind(this, 'removables')); 1093 append.bind(this, 'removables'));
1094 1094
1095 if (this.driveEnabled_) { 1095 if (this.driveEnabled_) {
1096 var fake = [DirectoryModel.fakeDriveEntry_]; 1096 var fake = [DirectoryModel.fakeDriveEntry_];
1097 if (this.isDriveMounted()) { 1097 if (this.isDriveMounted()) {
1098 readSingle(RootDirectory.DRIVE.substring(1), 'drive', fake); 1098 readSingle(DirectoryModel.fakeDriveEntry_.fullPath, 'drive', fake);
1099 } else { 1099 } else {
1100 groups.drive = fake; 1100 groups.drive = fake;
1101 } 1101 }
1102 // TODO(haruki): Add DirectoryModel.fakeDriveOfflineEntry_ to show the tab. 1102 // TODO(haruki): Add DirectoryModel.fakeDriveOfflineEntry_ to show the tab.
1103 } else { 1103 } else {
1104 groups.drive = []; 1104 groups.drive = [];
1105 } 1105 }
1106 }; 1106 };
1107 1107
1108 /** 1108 /**
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 var onGotDirectory = function(entry) { 1177 var onGotDirectory = function(entry) {
1178 this.updateRootEntry_(entry); 1178 this.updateRootEntry_(entry);
1179 var currentDirEntry = this.getCurrentDirEntry(); 1179 var currentDirEntry = this.getCurrentDirEntry();
1180 if (currentDirEntry == DirectoryModel.fakeDriveEntry_) { 1180 if (currentDirEntry == DirectoryModel.fakeDriveEntry_) {
1181 this.changeDirectoryEntrySilent_(entry); 1181 this.changeDirectoryEntrySilent_(entry);
1182 } else if (currentDirEntry == DirectoryModel.fakeDriveOfflineEntry_) { 1182 } else if (currentDirEntry == DirectoryModel.fakeDriveOfflineEntry_) {
1183 // Need to update the results for offline available files. 1183 // Need to update the results for offline available files.
1184 this.getDriveOfflineFiles(''); 1184 this.getDriveOfflineFiles('');
1185 } 1185 }
1186 } 1186 }
1187 this.root_.getDirectory(RootDirectory.DRIVE, {}, 1187 this.root_.getDirectory(
1188 onGotDirectory.bind(this)); 1188 DirectoryModel.fakeDriveEntry_.fullPath, {},
1189 onGotDirectory.bind(this));
1190 // TODO(haruki): support "other" root.
1189 } else { 1191 } else {
1190 var rootType = this.getCurrentRootType(); 1192 var rootType = this.getCurrentRootType();
1191 if (rootType != RootType.DRIVE && rootType != RootType.DRIVE_OFFLINE) 1193 if (rootType != RootType.DRIVE && rootType != RootType.DRIVE_OFFLINE)
1192 return; 1194 return;
1193 1195
1194 // Current entry unmounted. Replace with fake drive one. 1196 // Current entry unmounted. Replace with fake drive one.
1195 this.updateRootEntry_(DirectoryModel.fakeDriveEntry_); 1197 this.updateRootEntry_(DirectoryModel.fakeDriveEntry_);
1196 if (this.getCurrentDirPath() == DirectoryModel.fakeDriveEntry_.fullPath) { 1198 if (this.getCurrentDirPath() == DirectoryModel.fakeDriveEntry_.fullPath) {
1197 // Replace silently and rescan. 1199 // Replace silently and rescan.
1198 this.changeDirectoryEntrySilent_(DirectoryModel.fakeDriveEntry_); 1200 this.changeDirectoryEntrySilent_(DirectoryModel.fakeDriveEntry_);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 }.bind(this)); 1506 }.bind(this));
1505 } 1507 }
1506 }; 1508 };
1507 1509
1508 /** 1510 /**
1509 * @return {DirectoryEntry} Current watched directory entry. 1511 * @return {DirectoryEntry} Current watched directory entry.
1510 */ 1512 */
1511 FileWatcher.prototype.getWatchedDirectoryEntry = function() { 1513 FileWatcher.prototype.getWatchedDirectoryEntry = function() {
1512 return this.watchedDirectoryEntry_; 1514 return this.watchedDirectoryEntry_;
1513 }; 1515 };
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/drive_banners.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698