Chromium Code Reviews| Index: ui/file_manager/audio_player/js/audio_player.js |
| diff --git a/ui/file_manager/audio_player/js/audio_player.js b/ui/file_manager/audio_player/js/audio_player.js |
| index 1646ff1a135ab8395234f4aed7f98fceea8b38f0..e5b6fdddd947703e9094787e5f514b6402776260 100644 |
| --- a/ui/file_manager/audio_player/js/audio_player.js |
| +++ b/ui/file_manager/audio_player/js/audio_player.js |
| @@ -49,7 +49,11 @@ function AudioPlayer(container) { |
| /** @type {AudioPlayerElement} */ (document.querySelector('audio-player')); |
| // TODO(yoshiki): Move tracks into the model. |
| this.player_.tracks = []; |
| - this.player_.model = this.model_; |
| + this.model_.initialize(function() { |
| + this.player_.model = this.model_; |
| + if (this.player_.expanded) |
| + this.onModelExpandedChanged(false, true); |
|
yawano
2015/06/10 05:47:48
Can we remove this onModelExpanededChanged call if
fukino
2015/06/10 06:24:03
Done. Thank you for pointing this out!
|
| + }.bind(this)); |
| // Run asynchronously after an event of model change is delivered. |
| setTimeout(function() { |
| @@ -116,7 +120,7 @@ AudioPlayer.prototype.load = function(playlist) { |
| window.appState = JSON.parse(JSON.stringify(playlist)); // cloning |
| util.saveAppState(); |
| - this.isExpanded_ = this.model_.expanded; |
| + this.isExpanded_ = this.player_.expanded; |
| // Resolving entries has to be done after the volume manager is initialized. |
| this.volumeManager_.ensureInitialized(function() { |
| @@ -218,7 +222,7 @@ AudioPlayer.prototype.select_ = function(newTrack, time) { |
| this.currentTrackIndex_ = newTrack; |
| this.player_.currentTrackIndex = this.currentTrackIndex_; |
| - this.player_.audioController.time = time; |
| + this.player_.time = time; |
| // Run asynchronously after an event of current track change is delivered. |
| setTimeout(function() { |
| @@ -284,11 +288,11 @@ AudioPlayer.prototype.onResize_ = function(event) { |
| if (!this.isExpanded_ && |
| window.innerHeight >= AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { |
| this.isExpanded_ = true; |
| - this.model_.expanded = true; |
| + this.player_.expanded = true; |
| } else if (this.isExpanded_ && |
| window.innerHeight < AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { |
| this.isExpanded_ = false; |
| - this.model_.expanded = false; |
| + this.player_.expanded = false; |
| } |
| }; |
| @@ -383,7 +387,7 @@ AudioPlayer.prototype.onModelExpandedChanged = function(oldValue, newValue) { |
| AudioPlayer.prototype.syncHeight_ = function() { |
| var targetHeight; |
| - if (this.model_.expanded) { |
| + if (this.player_.expanded) { |
| // Expanded. |
| if (!this.lastExpandedHeight_ || |
| this.lastExpandedHeight_ < AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { |
| @@ -456,6 +460,6 @@ AudioPlayer.TrackInfo.prototype.setMetadata = function( |
| }; |
| // Starts loading the audio player. |
| -window.addEventListener('polymer-ready', function(e) { |
| +window.addEventListener('DOMContentLoaded', function(e) { |
| AudioPlayer.load(); |
| }); |