OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Handler of device event. | 6 * Handler of device event. |
7 * @constructor | 7 * @constructor |
8 * @extends {cr.EventTarget} | 8 * @extends {cr.EventTarget} |
9 */ | 9 */ |
10 function DeviceHandler() { | 10 function DeviceHandler() { |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 function(volumeManager) { | 416 function(volumeManager) { |
417 if (!metadata.volumeId) { | 417 if (!metadata.volumeId) { |
418 return Promise.reject('No volume id associated with event.'); | 418 return Promise.reject('No volume id associated with event.'); |
419 } | 419 } |
420 return volumeManager.volumeInfoList.whenVolumeInfoReady( | 420 return volumeManager.volumeInfoList.whenVolumeInfoReady( |
421 metadata.volumeId); | 421 metadata.volumeId); |
422 }) | 422 }) |
423 .then( | 423 .then( |
424 /** | 424 /** |
425 * @param {!VolumeInfo} volumeInfo | 425 * @param {!VolumeInfo} volumeInfo |
426 * @return {Promise<DirectoryEntry>} The root directory | 426 * @return {!Promise<!DirectoryEntry>} The root directory |
427 * of the volume. | 427 * of the volume. |
428 */ | 428 */ |
429 function(volumeInfo) { | 429 function(volumeInfo) { |
430 return importer.importEnabled() | 430 return importer.importEnabled() |
431 .then( | 431 .then( |
432 /** @param {boolean} enabled */ | 432 /** @param {boolean} enabled */ |
433 function(enabled) { | 433 function(enabled) { |
434 if (enabled && importer.isEligibleVolume(volumeInfo)) { | 434 if (enabled && importer.isEligibleVolume(volumeInfo)) { |
435 return volumeInfo.resolveDisplayRoot(); | 435 return volumeInfo.resolveDisplayRoot(); |
436 } | 436 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 * @param {string} volumeId | 536 * @param {string} volumeId |
537 * @param {string} path | 537 * @param {string} path |
538 * @private | 538 * @private |
539 */ | 539 */ |
540 DeviceHandler.prototype.openMediaDirectory_ = function(volumeId, path) { | 540 DeviceHandler.prototype.openMediaDirectory_ = function(volumeId, path) { |
541 var event = new Event(DeviceHandler.VOLUME_NAVIGATION_REQUESTED); | 541 var event = new Event(DeviceHandler.VOLUME_NAVIGATION_REQUESTED); |
542 event.volumeId = volumeId; | 542 event.volumeId = volumeId; |
543 event.filePath = path; | 543 event.filePath = path; |
544 this.dispatchEvent(event); | 544 this.dispatchEvent(event); |
545 }; | 545 }; |
OLD | NEW |