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

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

Issue 10850038: Drive: Add "Clear Local Cache" in the Gear menu to clear all local cache of Drive. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed the indent Created 8 years, 4 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
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 /** 5 /**
6 * FileManager constructor. 6 * FileManager constructor.
7 * 7 *
8 * FileManager objects encapsulate the functionality of the file selector 8 * FileManager objects encapsulate the functionality of the file selector
9 * dialogs, as well as the full screen file manager application (though the 9 * dialogs, as well as the full screen file manager application (though the
10 * latter is not yet implemented). 10 * latter is not yet implemented).
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 this.searchBreadcrumbs_ = new BreadcrumbsController( 586 this.searchBreadcrumbs_ = new BreadcrumbsController(
587 this.dialogDom_.querySelector('#search-breadcrumbs')); 587 this.dialogDom_.querySelector('#search-breadcrumbs'));
588 this.searchBreadcrumbs_.addEventListener( 588 this.searchBreadcrumbs_.addEventListener(
589 'pathclick', this.onBreadcrumbClick_.bind(this)); 589 'pathclick', this.onBreadcrumbClick_.bind(this));
590 this.searchBreadcrumbs_.setHideLast(true); 590 this.searchBreadcrumbs_.setHideLast(true);
591 591
592 cr.ui.Table.decorate(this.table_); 592 cr.ui.Table.decorate(this.table_);
593 cr.ui.Grid.decorate(this.grid_); 593 cr.ui.Grid.decorate(this.grid_);
594 594
595 this.document_.addEventListener('keydown', this.onKeyDown_.bind(this)); 595 this.document_.addEventListener('keydown', this.onKeyDown_.bind(this));
596 this.document_.addEventListener('keyup', this.onKeyUp_.bind(this));
596 // Disable the default browser context menu. 597 // Disable the default browser context menu.
597 this.document_.addEventListener('contextmenu', 598 this.document_.addEventListener('contextmenu',
598 function(e) { e.preventDefault() }); 599 function(e) { e.preventDefault() });
599 600
600 this.renameInput_ = this.document_.createElement('input'); 601 this.renameInput_ = this.document_.createElement('input');
601 this.renameInput_.className = 'rename'; 602 this.renameInput_.className = 'rename';
602 603
603 this.renameInput_.addEventListener( 604 this.renameInput_.addEventListener(
604 'keydown', this.onRenameInputKeyDown_.bind(this)); 605 'keydown', this.onRenameInputKeyDown_.bind(this));
605 this.renameInput_.addEventListener( 606 this.renameInput_.addEventListener(
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 this.directoryModel_.getCurrentRootType() == RootType.REMOVABLE; 971 this.directoryModel_.getCurrentRootType() == RootType.REMOVABLE;
971 972
972 case 'format': 973 case 'format':
973 return this.directoryModel_.getCurrentRootType() == RootType.REMOVABLE; 974 return this.directoryModel_.getCurrentRootType() == RootType.REMOVABLE;
974 975
975 case 'import-photos': 976 case 'import-photos':
976 return this.directoryModel_.getCurrentRootType() != RootType.GDATA; 977 return this.directoryModel_.getCurrentRootType() != RootType.GDATA;
977 978
978 case 'gdata-help': 979 case 'gdata-help':
979 case 'gdata-buy-more-space': 980 case 'gdata-buy-more-space':
981 case 'gdata-clear-local-cache':
980 return this.isOnGData(); 982 return this.isOnGData();
981 } 983 }
982 }; 984 };
983 985
984 FileManager.prototype.getRootEntry_ = function(index) { 986 FileManager.prototype.getRootEntry_ = function(index) {
985 if (index == -1) 987 if (index == -1)
986 return null; 988 return null;
987 989
988 return this.rootsList_.dataModel.item(index); 990 return this.rootsList_.dataModel.item(index);
989 }; 991 };
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 '#' + this.directoryModel_.getCurrentRootPath()}); 1303 '#' + this.directoryModel_.getCurrentRootPath()});
1302 return; 1304 return;
1303 1305
1304 case 'gdata-buy-more-space': 1306 case 'gdata-buy-more-space':
1305 window.open(GOOGLE_DRIVE_BUY_STORAGE, 'buy-more-space'); 1307 window.open(GOOGLE_DRIVE_BUY_STORAGE, 'buy-more-space');
1306 return; 1308 return;
1307 1309
1308 case 'gdata-help': 1310 case 'gdata-help':
1309 window.open(GOOGLE_DRIVE_HELP, 'help'); 1311 window.open(GOOGLE_DRIVE_HELP, 'help');
1310 return; 1312 return;
1313
1314 case 'gdata-clear-local-cache':
1315 chrome.fileBrowserPrivate.clearDriveCache();
1316 return;
1311 } 1317 }
1312 }; 1318 };
1313 1319
1314 /** 1320 /**
1315 * Respond to the back and forward buttons. 1321 * Respond to the back and forward buttons.
1316 */ 1322 */
1317 FileManager.prototype.onPopState_ = function(event) { 1323 FileManager.prototype.onPopState_ = function(event) {
1318 this.closeFilePopup_(); 1324 this.closeFilePopup_();
1319 this.setupCurrentDirectory_(false /* page loading */); 1325 this.setupCurrentDirectory_(false /* page loading */);
1320 }; 1326 };
(...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after
3218 /** 3224 /**
3219 * KeyDown event handler for the document. 3225 * KeyDown event handler for the document.
3220 */ 3226 */
3221 FileManager.prototype.onKeyDown_ = function(event) { 3227 FileManager.prototype.onKeyDown_ = function(event) {
3222 if (event.srcElement === this.renameInput_) { 3228 if (event.srcElement === this.renameInput_) {
3223 // Ignore keydown handler in the rename input box. 3229 // Ignore keydown handler in the rename input box.
3224 return; 3230 return;
3225 } 3231 }
3226 3232
3227 switch (util.getKeyModifiers(event) + event.keyCode) { 3233 switch (util.getKeyModifiers(event) + event.keyCode) {
3234 case 'Ctrl-17': // Ctrl => Show hidden setting
3235 this.dialogDom_.setAttribute('ctrl-pressing', 'true');
3236 return;
3237
3228 case 'Ctrl-190': // Ctrl-. => Toggle filter files. 3238 case 'Ctrl-190': // Ctrl-. => Toggle filter files.
3229 var dm = this.directoryModel_; 3239 var dm = this.directoryModel_;
3230 dm.setFilterHidden(!dm.isFilterHiddenOn()); 3240 dm.setFilterHidden(!dm.isFilterHiddenOn());
3231 event.preventDefault(); 3241 event.preventDefault();
3232 return; 3242 return;
3233 3243
3234 case '27': // Escape => Cancel dialog. 3244 case '27': // Escape => Cancel dialog.
3235 if (this.copyManager_ && 3245 if (this.copyManager_ &&
3236 this.copyManager_.getStatus().totalFiles != 0) { 3246 this.copyManager_.getStatus().totalFiles != 0) {
3237 // If there is a copy in progress, ESC will cancel it. 3247 // If there is a copy in progress, ESC will cancel it.
(...skipping 10 matching lines...) Expand all
3248 if (this.dialogType_ != FileManager.DialogType.FULL_PAGE) { 3258 if (this.dialogType_ != FileManager.DialogType.FULL_PAGE) {
3249 // If there is nothing else for ESC to do, then cancel the dialog. 3259 // If there is nothing else for ESC to do, then cancel the dialog.
3250 event.preventDefault(); 3260 event.preventDefault();
3251 this.cancelButton_.click(); 3261 this.cancelButton_.click();
3252 } 3262 }
3253 break; 3263 break;
3254 } 3264 }
3255 }; 3265 };
3256 3266
3257 /** 3267 /**
3268 * KeyUp event handler for the document.
3269 */
3270 FileManager.prototype.onKeyUp_ = function(event) {
3271 if (event.srcElement === this.renameInput_) {
3272 // Ignore keydown handler in the rename input box.
3273 return;
3274 }
3275
3276 switch (util.getKeyModifiers(event) + event.keyCode) {
3277 case '17': // Ctrl => Hide hidden setting
3278 this.dialogDom_.removeAttribute('ctrl-pressing');
3279 return;
3280 }
3281 }
3282
3283 /**
3258 * KeyDown event handler for the div#list-container element. 3284 * KeyDown event handler for the div#list-container element.
3259 */ 3285 */
3260 FileManager.prototype.onListKeyDown_ = function(event) { 3286 FileManager.prototype.onListKeyDown_ = function(event) {
3261 if (event.srcElement.tagName == 'INPUT') { 3287 if (event.srcElement.tagName == 'INPUT') {
3262 // Ignore keydown handler in the rename input box. 3288 // Ignore keydown handler in the rename input box.
3263 return; 3289 return;
3264 } 3290 }
3265 3291
3266 var self = this; 3292 var self = this;
3267 function handleCommand(name) { 3293 function handleCommand(name) {
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
4052 } 4078 }
4053 4079
4054 var defaultActionSeparator = 4080 var defaultActionSeparator =
4055 this.dialogDom_.querySelector('#default-action-separator'); 4081 this.dialogDom_.querySelector('#default-action-separator');
4056 4082
4057 this.defaultActionMenuItem_.hidden = !taskItem; 4083 this.defaultActionMenuItem_.hidden = !taskItem;
4058 defaultActionSeparator.hidden = !taskItem; 4084 defaultActionSeparator.hidden = !taskItem;
4059 } 4085 }
4060 })(); 4086 })();
4061 4087
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/css/file_manager.css ('k') | chrome/browser/resources/file_manager/js/mock_chrome.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698