| 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 3691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4218 this.resolvePath(this.getCurrentDirectory() + '/' + filename, | 4218 this.resolvePath(this.getCurrentDirectory() + '/' + filename, |
| 4219 resolveCallback, resolveCallback); | 4219 resolveCallback, resolveCallback); |
| 4220 return; | 4220 return; |
| 4221 } | 4221 } |
| 4222 | 4222 |
| 4223 var files = []; | 4223 var files = []; |
| 4224 var selectedIndexes = this.currentList_.selectionModel.selectedIndexes; | 4224 var selectedIndexes = this.currentList_.selectionModel.selectedIndexes; |
| 4225 | 4225 |
| 4226 if (this.dialogType_ == FileManager.DialogType.SELECT_FOLDER && | 4226 if (this.dialogType_ == FileManager.DialogType.SELECT_FOLDER && |
| 4227 selectedIndexes.length == 0) { | 4227 selectedIndexes.length == 0) { |
| 4228 var url = this.getSearchOrCurrentDirectoryURL(); | 4228 var url = this.getCurrentDirectoryURL(); |
| 4229 var singleSelection = { | 4229 var singleSelection = { |
| 4230 urls: [url], | 4230 urls: [url], |
| 4231 multiple: false, | 4231 multiple: false, |
| 4232 filterIndex: this.getSelectedFilterIndex_(url) | 4232 filterIndex: this.getSelectedFilterIndex_(url) |
| 4233 }; | 4233 }; |
| 4234 this.selectFilesAndClose_(singleSelection); | 4234 this.selectFilesAndClose_(singleSelection); |
| 4235 return; | 4235 return; |
| 4236 } | 4236 } |
| 4237 | 4237 |
| 4238 // All other dialog types require at least one selected list item. | 4238 // All other dialog types require at least one selected list item. |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4575 function closeBanner() { | 4575 function closeBanner() { |
| 4576 self.cleanupGDataWelcome_(); | 4576 self.cleanupGDataWelcome_(); |
| 4577 // Stop showing the welcome banner. | 4577 // Stop showing the welcome banner. |
| 4578 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; | 4578 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; |
| 4579 } | 4579 } |
| 4580 | 4580 |
| 4581 return maybeShowBanner; | 4581 return maybeShowBanner; |
| 4582 }; | 4582 }; |
| 4583 })(); | 4583 })(); |
| 4584 | 4584 |
| OLD | NEW |