| OLD | NEW |
| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * FileManager constructor. | 8 * FileManager constructor. |
| 9 * | 9 * |
| 10 * FileManager objects encapsulate the functionality of the file selector | 10 * FileManager objects encapsulate the functionality of the file selector |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 controller.attachFileListDropTarget(this.table_.list); | 392 controller.attachFileListDropTarget(this.table_.list); |
| 393 controller.attachDragSource(this.grid_); | 393 controller.attachDragSource(this.grid_); |
| 394 controller.attachFileListDropTarget(this.grid_); | 394 controller.attachFileListDropTarget(this.grid_); |
| 395 controller.attachTreeDropTarget(this.directoryTree_); | 395 controller.attachTreeDropTarget(this.directoryTree_); |
| 396 controller.attachNavigationListDropTarget(this.navigationList_, true); | 396 controller.attachNavigationListDropTarget(this.navigationList_, true); |
| 397 controller.attachCopyPasteHandlers(); | 397 controller.attachCopyPasteHandlers(); |
| 398 controller.addEventListener('selection-copied', | 398 controller.addEventListener('selection-copied', |
| 399 this.blinkSelection.bind(this)); | 399 this.blinkSelection.bind(this)); |
| 400 controller.addEventListener('selection-cut', | 400 controller.addEventListener('selection-cut', |
| 401 this.blinkSelection.bind(this)); | 401 this.blinkSelection.bind(this)); |
| 402 controller.addEventListener('source-not-found', |
| 403 this.onSourceNotFound_.bind(this)); |
| 402 }; | 404 }; |
| 403 | 405 |
| 404 /** | 406 /** |
| 407 * Handles an error that the source entry of file operation is not found. |
| 408 * @private |
| 409 */ |
| 410 FileManager.prototype.onSourceNotFound_ = function(event) { |
| 411 // Ensure this.sourceNotFoundErrorCount_ is integer. |
| 412 this.sourceNotFoundErrorCount_ = ~~this.sourceNotFoundErrorCount_; |
| 413 var item = new ProgressCenterItem(); |
| 414 item.id = 'source-not-found-' + this.sourceNotFoundErrorCount_; |
| 415 if (event.progressType === ProgressItemType.COPY) |
| 416 item.message = strf('COPY_SOURCE_NOT_FOUND_ERROR', event.fileName); |
| 417 else if (event.progressType === ProgressItemType.MOVE) |
| 418 item.message = strf('MOVE_SOURCE_NOT_FOUND_ERROR', event.fileName); |
| 419 item.state = ProgressItemState.ERROR; |
| 420 this.backgroundPage_.background.progressCenter.updateItem(item); |
| 421 this.sourceNotFoundErrorCount_++; |
| 422 }; |
| 423 |
| 424 /** |
| 405 * One-time initialization of context menus. | 425 * One-time initialization of context menus. |
| 406 * @private | 426 * @private |
| 407 */ | 427 */ |
| 408 FileManager.prototype.initContextMenus_ = function() { | 428 FileManager.prototype.initContextMenus_ = function() { |
| 409 this.fileContextMenu_ = this.dialogDom_.querySelector('#file-context-menu'); | 429 this.fileContextMenu_ = this.dialogDom_.querySelector('#file-context-menu'); |
| 410 cr.ui.Menu.decorate(this.fileContextMenu_); | 430 cr.ui.Menu.decorate(this.fileContextMenu_); |
| 411 | 431 |
| 412 cr.ui.contextMenuHandler.setContextMenu(this.grid_, this.fileContextMenu_); | 432 cr.ui.contextMenuHandler.setContextMenu(this.grid_, this.fileContextMenu_); |
| 413 cr.ui.contextMenuHandler.setContextMenu(this.table_.querySelector('.list'), | 433 cr.ui.contextMenuHandler.setContextMenu(this.table_.querySelector('.list'), |
| 414 this.fileContextMenu_); | 434 this.fileContextMenu_); |
| (...skipping 3281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3696 callback(this.preferences_); | 3716 callback(this.preferences_); |
| 3697 return; | 3717 return; |
| 3698 } | 3718 } |
| 3699 | 3719 |
| 3700 chrome.fileBrowserPrivate.getPreferences(function(prefs) { | 3720 chrome.fileBrowserPrivate.getPreferences(function(prefs) { |
| 3701 this.preferences_ = prefs; | 3721 this.preferences_ = prefs; |
| 3702 callback(prefs); | 3722 callback(prefs); |
| 3703 }.bind(this)); | 3723 }.bind(this)); |
| 3704 }; | 3724 }; |
| 3705 })(); | 3725 })(); |
| OLD | NEW |