Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6472)

Unified Diff: chrome/browser/resources/file_manager/audio_player/js/audio_player.js

Issue 185653014: [AudioPlayer] Fix a bug on changing 'expanded' status (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/audio_player/js/audio_player.js
diff --git a/chrome/browser/resources/file_manager/audio_player/js/audio_player.js b/chrome/browser/resources/file_manager/audio_player/js/audio_player.js
index f380e32590bbb21f95f8e199bf583d396ef2f328..4de427369369c11c4f907407d6c16f7af4c316f1 100644
--- a/chrome/browser/resources/file_manager/audio_player/js/audio_player.js
+++ b/chrome/browser/resources/file_manager/audio_player/js/audio_player.js
@@ -103,6 +103,8 @@ AudioPlayer.prototype.load = function(playlist) {
window.appState = JSON.parse(JSON.stringify(playlist)); // cloning
util.saveAppState();
+ this.isExpanded_ = this.model_.expanded;
+
// Resolving entries has to be done after the volume manager is initialized.
this.volumeManager_.ensureInitialized(function() {
util.URLsToEntries(playlist.items, function(entries) {
@@ -116,6 +118,10 @@ AudioPlayer.prototype.load = function(playlist) {
this.trackListItems_.splice(0);
+ // Makes it sure that the track list is now empty to the handler, before
+ // adding new tracks.
+ Platform.performMicrotaskCheckpoint();
hirono 2014/03/05 17:24:01 Just curious, what goes wrong without the line? I'
yoshiki 2014/03/05 18:30:41 Yes, that's correct.
hirono 2014/03/06 03:44:47 So how about removing this.trackListItems_ member
yoshiki 2014/03/06 08:25:07 Done
+
for (var i = 0; i != this.entries_.length; i++) {
var entry = this.entries_[i];
var onClick = this.select_.bind(this, i, false /* no restore */);
@@ -268,7 +274,7 @@ AudioPlayer.prototype.onResize_ = function(event) {
* @type {number}
* @const
*/
-AudioPlayer.HEADER_HEIGHT = 28;
+AudioPlayer.HEADER_HEIGHT = 33; // 32px + border 1px
/**
* Track height in pixels.
@@ -282,7 +288,7 @@ AudioPlayer.TRACK_HEIGHT = 44;
* @type {number}
* @const
*/
-AudioPlayer.CONTROLS_HEIGHT = 72;
+AudioPlayer.CONTROLS_HEIGHT = 73; // 72px + border 1px
/**
* Default number of items in the expanded mode.
@@ -315,6 +321,10 @@ AudioPlayer.prototype.onModelExpandedChanged = function(oldValue, newValue) {
if (this.isExpanded_ !== newValue) {
this.isExpanded_ = newValue;
this.syncHeight_();
+
+ // Saves new state.
+ window.appState.expanded = newValue;
+ util.saveAppState();
}
};

Powered by Google App Engine
This is Rietveld 408576698