| Index: ui/file_manager/audio_player/elements/track_list.js
|
| diff --git a/ui/file_manager/audio_player/elements/track_list.js b/ui/file_manager/audio_player/elements/track_list.js
|
| index 95894edfd8bc4f3fa654395f33a088949537b641..d1a030e4652d785364e0e65fbcaf147161580a52 100644
|
| --- a/ui/file_manager/audio_player/elements/track_list.js
|
| +++ b/ui/file_manager/audio_player/elements/track_list.js
|
| @@ -166,8 +166,15 @@ var TrackInfo;
|
| trackClicked: function(event) {
|
| var index = ~~event.currentTarget.getAttribute('index');
|
| var track = this.tracks[index];
|
| - if (track)
|
| - this.selectTrack(track);
|
| + if (track) {
|
| + if (event.target.classList.contains('icon')) {
|
| + // If the play icon on the track is clicked, change the current track
|
| + // and start playing it regardless of current play state.
|
| + this.selectTrack(track, true /* force to play */);
|
| + } else {
|
| + this.selectTrack(track, false /* force to play */);
|
| + }
|
| + }
|
| },
|
|
|
| /**
|
| @@ -250,8 +257,10 @@ var TrackInfo;
|
| * Sets the current track.
|
| * @param {!TrackInfo} track TrackInfo to be set as the current
|
| * track.
|
| + * @param {boolean} forceToPlay True if the track should be played
|
| + * regardless of the current play state (paused/played).
|
| */
|
| - selectTrack: function(track) {
|
| + selectTrack: function(track, forceToPlay) {
|
| var index = -1;
|
| for (var i = 0; i < this.tracks.length; i++) {
|
| if (this.tracks[i].url === track.url) {
|
| @@ -261,10 +270,13 @@ var TrackInfo;
|
| }
|
| if (index >= 0) {
|
| // TODO(yoshiki): Clean up the flow and the code around here.
|
| - if (this.currentTrackIndex == index)
|
| + if (this.currentTrackIndex === index) {
|
| this.replayCurrentTrack();
|
| - else
|
| + } else {
|
| this.currentTrackIndex = index;
|
| + if (forceToPlay)
|
| + this.fire('play');
|
| + }
|
| }
|
| },
|
|
|
|
|