| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 254 |
| 255 // -------------------------------------------------------------------------- | 255 // -------------------------------------------------------------------------- |
| 256 // Miscellaneous FileManager's states. | 256 // Miscellaneous FileManager's states. |
| 257 | 257 |
| 258 /** | 258 /** |
| 259 * Queue for ordering FileManager's initialization process. | 259 * Queue for ordering FileManager's initialization process. |
| 260 * @type {!AsyncUtil.Group} | 260 * @type {!AsyncUtil.Group} |
| 261 * @private | 261 * @private |
| 262 */ | 262 */ |
| 263 this.initializeQueue_ = new AsyncUtil.Group(); | 263 this.initializeQueue_ = new AsyncUtil.Group(); |
| 264 | |
| 265 /** | |
| 266 * Indicates whether cloud import is enabled. This is initialized in | |
| 267 * #initSettings. | |
| 268 * @private {boolean} | |
| 269 */ | |
| 270 this.importEnabled_ = true; | |
| 271 } | 264 } |
| 272 | 265 |
| 273 FileManager.prototype = /** @struct */ { | 266 FileManager.prototype = /** @struct */ { |
| 274 __proto__: cr.EventTarget.prototype, | 267 __proto__: cr.EventTarget.prototype, |
| 275 /** | 268 /** |
| 276 * @return {DirectoryModel} | 269 * @return {DirectoryModel} |
| 277 */ | 270 */ |
| 278 get directoryModel() { | 271 get directoryModel() { |
| 279 return this.directoryModel_; | 272 return this.directoryModel_; |
| 280 }, | 273 }, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 */ | 360 */ |
| 368 get tracker() { | 361 get tracker() { |
| 369 return this.tracker_; | 362 return this.tracker_; |
| 370 } | 363 } |
| 371 }; | 364 }; |
| 372 | 365 |
| 373 // Anonymous "namespace". | 366 // Anonymous "namespace". |
| 374 (function() { | 367 (function() { |
| 375 FileManager.prototype.initSettings_ = function(callback) { | 368 FileManager.prototype.initSettings_ = function(callback) { |
| 376 this.appStateController_ = new AppStateController(this.dialogType); | 369 this.appStateController_ = new AppStateController(this.dialogType); |
| 377 var whenViewOptionsLoaded = | 370 this.appStateController_.loadInitialViewOptions().then(callback); |
| 378 this.appStateController_.loadInitialViewOptions(); | |
| 379 var whenImportFlagLoaded = importer.importEnabled().then( | |
| 380 function(enabled) { | |
| 381 this.importEnabled_ = enabled; | |
| 382 }.bind(this)); | |
| 383 | |
| 384 Promise.all([ | |
| 385 whenViewOptionsLoaded, | |
| 386 whenImportFlagLoaded | |
| 387 ]).then(callback); | |
| 388 }; | 371 }; |
| 389 | 372 |
| 390 /** | 373 /** |
| 391 * One time initialization for the file system and related things. | 374 * One time initialization for the file system and related things. |
| 392 * | 375 * |
| 393 * @param {function()} callback Completion callback. | 376 * @param {function()} callback Completion callback. |
| 394 * @private | 377 * @private |
| 395 */ | 378 */ |
| 396 FileManager.prototype.initFileSystemUI_ = function(callback) { | 379 FileManager.prototype.initFileSystemUI_ = function(callback) { |
| 397 this.ui_.listContainer.startBatchUpdates(); | 380 this.ui_.listContainer.startBatchUpdates(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 this.toolbarController_ = new ToolbarController( | 420 this.toolbarController_ = new ToolbarController( |
| 438 this.ui_.toolbar, | 421 this.ui_.toolbar, |
| 439 this.ui_.dialogNavigationList, | 422 this.ui_.dialogNavigationList, |
| 440 assert(this.ui_.locationLine), | 423 assert(this.ui_.locationLine), |
| 441 this.selectionHandler_, | 424 this.selectionHandler_, |
| 442 this.directoryModel_); | 425 this.directoryModel_); |
| 443 this.emptyFolderController_ = new EmptyFolderController( | 426 this.emptyFolderController_ = new EmptyFolderController( |
| 444 this.ui_.emptyFolder, | 427 this.ui_.emptyFolder, |
| 445 this.directoryModel_); | 428 this.directoryModel_); |
| 446 | 429 |
| 447 importer.importEnabled().then( | 430 if (this.dialogType === DialogType.FULL_PAGE) { |
| 448 function(enabled) { | 431 importer.importEnabled().then( |
| 449 if (enabled) { | 432 function(enabled) { |
| 450 this.importController_ = new importer.ImportController( | 433 if (enabled) { |
| 451 new importer.RuntimeControllerEnvironment( | 434 this.importController_ = new importer.ImportController( |
| 452 this, | 435 new importer.RuntimeControllerEnvironment( |
| 453 assert(this.selectionHandler_)), | 436 this, |
| 454 assert(this.mediaScanner_), | 437 assert(this.selectionHandler_)), |
| 455 assert(this.mediaImportHandler_), | 438 assert(this.mediaScanner_), |
| 456 new importer.RuntimeCommandWidget(), | 439 assert(this.mediaImportHandler_), |
| 457 assert(this.tracker_)); | 440 new importer.RuntimeCommandWidget(), |
| 458 } | 441 assert(this.tracker_)); |
| 459 }.bind(this)); | 442 } |
| 443 }.bind(this)); |
| 444 } |
| 460 | 445 |
| 461 assert(this.fileFilter_); | 446 assert(this.fileFilter_); |
| 462 assert(this.namingController_); | 447 assert(this.namingController_); |
| 463 assert(this.appStateController_); | 448 assert(this.appStateController_); |
| 464 assert(this.taskController_); | 449 assert(this.taskController_); |
| 465 this.mainWindowComponent_ = new MainWindowComponent( | 450 this.mainWindowComponent_ = new MainWindowComponent( |
| 466 this.dialogType, | 451 this.dialogType, |
| 467 this.ui_, | 452 this.ui_, |
| 468 this.volumeManager_, | 453 this.volumeManager_, |
| 469 this.directoryModel_, | 454 this.directoryModel_, |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 out += this.initializeQueue_.pendingTasks[key].toString() + '\n'; | 1305 out += this.initializeQueue_.pendingTasks[key].toString() + '\n'; |
| 1321 }.bind(this)); | 1306 }.bind(this)); |
| 1322 | 1307 |
| 1323 out += '2. VolumeManagerWrapper\n' + | 1308 out += '2. VolumeManagerWrapper\n' + |
| 1324 this.volumeManager_.toString() + '\n'; | 1309 this.volumeManager_.toString() + '\n'; |
| 1325 | 1310 |
| 1326 out += 'End of debug information.'; | 1311 out += 'End of debug information.'; |
| 1327 console.log(out); | 1312 console.log(out); |
| 1328 }; | 1313 }; |
| 1329 })(); | 1314 })(); |
| OLD | NEW |