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

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

Issue 10184005: [File Manager] Properly enable/disable Copy and Open for GData files in the offline mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 8 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/file_manager.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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 DirectoryModel.prototype.__proto__ = cr.EventTarget.prototype; 96 DirectoryModel.prototype.__proto__ = cr.EventTarget.prototype;
97 97
98 /** 98 /**
99 * @return {cr.ui.ArrayDataModel} Files in the current directory. 99 * @return {cr.ui.ArrayDataModel} Files in the current directory.
100 */ 100 */
101 DirectoryModel.prototype.getFileList = function() { 101 DirectoryModel.prototype.getFileList = function() {
102 return this.fileList_; 102 return this.fileList_;
103 }; 103 };
104 104
105 /** 105 /**
106 * @return {MetadataCache} Metadata cache.
107 */
108 DirectoryModel.prototype.getMetadataCache = function() {
109 return this.metadataCache_;
110 };
111
112 /**
106 * Sort the file list. 113 * Sort the file list.
107 * @param {string} sortField Sort field. 114 * @param {string} sortField Sort field.
108 * @param {string} sortDirection "asc" or "desc". 115 * @param {string} sortDirection "asc" or "desc".
109 */ 116 */
110 DirectoryModel.prototype.sortFileList = function(sortField, sortDirection) { 117 DirectoryModel.prototype.sortFileList = function(sortField, sortDirection) {
111 this.fileList_.sort(sortField, sortDirection); 118 this.fileList_.sort(sortField, sortDirection);
112 }; 119 };
113 120
114 /** 121 /**
115 * @return {cr.ui.ListSelectionModel|cr.ui.ListSingleSelectionModel} Selection 122 * @return {cr.ui.ListSelectionModel|cr.ui.ListSingleSelectionModel} Selection
(...skipping 30 matching lines...) Expand all
146 */ 153 */
147 DirectoryModel.prototype.isPathReadOnly = function(path) { 154 DirectoryModel.prototype.isPathReadOnly = function(path) {
148 switch (DirectoryModel.getRootType(path)) { 155 switch (DirectoryModel.getRootType(path)) {
149 case DirectoryModel.RootType.REMOVABLE: 156 case DirectoryModel.RootType.REMOVABLE:
150 return !!this.volumeReadOnlyStatus_[DirectoryModel.getRootPath(path)]; 157 return !!this.volumeReadOnlyStatus_[DirectoryModel.getRootPath(path)];
151 case DirectoryModel.RootType.ARCHIVE: 158 case DirectoryModel.RootType.ARCHIVE:
152 return true; 159 return true;
153 case DirectoryModel.RootType.DOWNLOADS: 160 case DirectoryModel.RootType.DOWNLOADS:
154 return false; 161 return false;
155 case DirectoryModel.RootType.GDATA: 162 case DirectoryModel.RootType.GDATA:
156 return !navigator.onLine; 163 return util.isOffline();
157 default: 164 default:
158 return true; 165 return true;
159 } 166 }
160 }; 167 };
161 168
162 /** 169 /**
163 * @return {boolean} If current directory is system. 170 * @return {boolean} If current directory is system.
164 */ 171 */
165 DirectoryModel.prototype.isSystemDirectory = function() { 172 DirectoryModel.prototype.isSystemDirectory = function() {
166 var path = this.currentDirEntry_.fullPath; 173 var path = this.currentDirEntry_.fullPath;
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 /** 1244 /**
1238 * @private 1245 * @private
1239 */ 1246 */
1240 DirectoryModel.Scanner.prototype.recordMetrics_ = function() { 1247 DirectoryModel.Scanner.prototype.recordMetrics_ = function() {
1241 metrics.recordInterval('DirectoryScan'); 1248 metrics.recordInterval('DirectoryScan');
1242 if (this.dir_.fullPath == 1249 if (this.dir_.fullPath ==
1243 '/' + DirectoryModel.DOWNLOADS_DIRECTORY) { 1250 '/' + DirectoryModel.DOWNLOADS_DIRECTORY) {
1244 metrics.recordMediumCount('DownloadsCount', this.list_.length); 1251 metrics.recordMediumCount('DownloadsCount', this.list_.length);
1245 } 1252 }
1246 }; 1253 };
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/file_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698