| 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 /** | 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 }); | 495 }); |
| 496 dm.addEventListener('scan-started', this.showSpinnerLater_.bind(this)); | 496 dm.addEventListener('scan-started', this.showSpinnerLater_.bind(this)); |
| 497 dm.addEventListener('scan-completed', this.showSpinner_.bind(this, false)); | 497 dm.addEventListener('scan-completed', this.showSpinner_.bind(this, false)); |
| 498 dm.addEventListener('scan-completed', | 498 dm.addEventListener('scan-completed', |
| 499 this.refreshCurrentDirectoryMetadata_.bind(this)); | 499 this.refreshCurrentDirectoryMetadata_.bind(this)); |
| 500 dm.addEventListener('rescan-completed', | 500 dm.addEventListener('rescan-completed', |
| 501 this.refreshCurrentDirectoryMetadata_.bind(this)); | 501 this.refreshCurrentDirectoryMetadata_.bind(this)); |
| 502 this.addEventListener('selection-summarized', | 502 this.addEventListener('selection-summarized', |
| 503 this.onSelectionSummarized_.bind(this)); | 503 this.onSelectionSummarized_.bind(this)); |
| 504 | 504 |
| 505 this.summarizeSelection_(); |
| 506 |
| 505 this.setupCurrentDirectory_(true /* page loading */); | 507 this.setupCurrentDirectory_(true /* page loading */); |
| 506 | 508 |
| 507 var stateChangeHandler = | 509 var stateChangeHandler = |
| 508 this.onNetworkStateOrGDataPreferencesChanged_.bind(this); | 510 this.onNetworkStateOrGDataPreferencesChanged_.bind(this); |
| 509 chrome.fileBrowserPrivate.onGDataPreferencesChanged.addListener( | 511 chrome.fileBrowserPrivate.onGDataPreferencesChanged.addListener( |
| 510 stateChangeHandler); | 512 stateChangeHandler); |
| 511 chrome.fileBrowserPrivate.onNetworkConnectionChanged.addListener( | 513 chrome.fileBrowserPrivate.onNetworkConnectionChanged.addListener( |
| 512 stateChangeHandler); | 514 stateChangeHandler); |
| 513 stateChangeHandler(); | 515 stateChangeHandler(); |
| 514 | 516 |
| 515 this.summarizeSelection_(); | |
| 516 | |
| 517 var sortField = | 517 var sortField = |
| 518 window.localStorage['sort-field-' + this.dialogType_] || | 518 window.localStorage['sort-field-' + this.dialogType_] || |
| 519 'modificationTime'; | 519 'modificationTime'; |
| 520 var sortDirection = | 520 var sortDirection = |
| 521 window.localStorage['sort-direction-' + this.dialogType_] || 'desc'; | 521 window.localStorage['sort-direction-' + this.dialogType_] || 'desc'; |
| 522 this.directoryModel_.sortFileList(sortField, sortDirection); | 522 this.directoryModel_.sortFileList(sortField, sortDirection); |
| 523 | 523 |
| 524 this.refocus(); | 524 this.refocus(); |
| 525 | 525 |
| 526 if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) | 526 if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) |
| (...skipping 3698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4225 this.resolvePath(this.getCurrentDirectory() + '/' + filename, | 4225 this.resolvePath(this.getCurrentDirectory() + '/' + filename, |
| 4226 resolveCallback, resolveCallback); | 4226 resolveCallback, resolveCallback); |
| 4227 return; | 4227 return; |
| 4228 } | 4228 } |
| 4229 | 4229 |
| 4230 var files = []; | 4230 var files = []; |
| 4231 var selectedIndexes = this.currentList_.selectionModel.selectedIndexes; | 4231 var selectedIndexes = this.currentList_.selectionModel.selectedIndexes; |
| 4232 | 4232 |
| 4233 if (this.dialogType_ == FileManager.DialogType.SELECT_FOLDER && | 4233 if (this.dialogType_ == FileManager.DialogType.SELECT_FOLDER && |
| 4234 selectedIndexes.length == 0) { | 4234 selectedIndexes.length == 0) { |
| 4235 var url = this.getSearchOrCurrentDirectoryURL(); | 4235 var url = this.getCurrentDirectoryURL(); |
| 4236 var singleSelection = { | 4236 var singleSelection = { |
| 4237 urls: [url], | 4237 urls: [url], |
| 4238 multiple: false, | 4238 multiple: false, |
| 4239 filterIndex: this.getSelectedFilterIndex_(url) | 4239 filterIndex: this.getSelectedFilterIndex_(url) |
| 4240 }; | 4240 }; |
| 4241 this.selectFilesAndClose_(singleSelection); | 4241 this.selectFilesAndClose_(singleSelection); |
| 4242 return; | 4242 return; |
| 4243 } | 4243 } |
| 4244 | 4244 |
| 4245 // All other dialog types require at least one selected list item. | 4245 // All other dialog types require at least one selected list item. |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4582 function closeBanner() { | 4582 function closeBanner() { |
| 4583 self.cleanupGDataWelcome_(); | 4583 self.cleanupGDataWelcome_(); |
| 4584 // Stop showing the welcome banner. | 4584 // Stop showing the welcome banner. |
| 4585 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; | 4585 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; |
| 4586 } | 4586 } |
| 4587 | 4587 |
| 4588 return maybeShowBanner; | 4588 return maybeShowBanner; |
| 4589 }; | 4589 }; |
| 4590 })(); | 4590 })(); |
| 4591 | 4591 |
| OLD | NEW |