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 document.addEventListener('DOMContentLoaded', function() { | 5 document.addEventListener('DOMContentLoaded', function() { |
6 // Test harness sets the search string to prevent the automatic load. | 6 // Test harness sets the search string to prevent the automatic load. |
7 // It calls AudioPlayer.load() explicitly after initializing | 7 // It calls AudioPlayer.load() explicitly after initializing |
8 // the |chrome| variable with an appropriate mock object. | 8 // the |chrome| variable with an appropriate mock object. |
9 if (!document.location.search) { | 9 if (!document.location.search) { |
10 AudioPlayer.load(); | 10 AudioPlayer.load(); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 380 |
381 /** | 381 /** |
382 * Set the correct player window height. | 382 * Set the correct player window height. |
383 * @private | 383 * @private |
384 */ | 384 */ |
385 AudioPlayer.prototype.syncHeight_ = function() { | 385 AudioPlayer.prototype.syncHeight_ = function() { |
386 var expandedListHeight = | 386 var expandedListHeight = |
387 Math.min(this.urls_.length, 3) * AudioPlayer.TRACK_HEIGHT; | 387 Math.min(this.urls_.length, 3) * AudioPlayer.TRACK_HEIGHT; |
388 this.trackList_.style.height = expandedListHeight + 'px'; | 388 this.trackList_.style.height = expandedListHeight + 'px'; |
389 | 389 |
| 390 var targetClientHeight = AudioPlayer.CONTROLS_HEIGHT + |
| 391 (this.isCompact_() ? |
| 392 AudioPlayer.TRACK_HEIGHT : |
| 393 AudioPlayer.HEADER_HEIGHT + expandedListHeight); |
| 394 |
390 chrome.mediaPlayerPrivate.setWindowHeight( | 395 chrome.mediaPlayerPrivate.setWindowHeight( |
391 (this.isCompact_() ? | 396 targetClientHeight - this.container_.clientHeight); |
392 AudioPlayer.TRACK_HEIGHT : | |
393 AudioPlayer.HEADER_HEIGHT + expandedListHeight) + | |
394 AudioPlayer.CONTROLS_HEIGHT); | |
395 }; | 397 }; |
396 | 398 |
397 | 399 |
398 /** | 400 /** |
399 * Create a TrackInfo object encapsulating the information about one track. | 401 * Create a TrackInfo object encapsulating the information about one track. |
400 * | 402 * |
401 * @param {HTMLElement} container Container element. | 403 * @param {HTMLElement} container Container element. |
402 * @param {string} url Track url. | 404 * @param {string} url Track url. |
403 * @param {function} onClick Click handler. | 405 * @param {function} onClick Click handler. |
404 * @constructor | 406 * @constructor |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 * Restore the Save the play state from the location hash. | 540 * Restore the Save the play state from the location hash. |
539 */ | 541 */ |
540 FullWindowAudioControls.prototype.restorePlayState = function() { | 542 FullWindowAudioControls.prototype.restorePlayState = function() { |
541 if (this.restoreWhenLoaded_) { | 543 if (this.restoreWhenLoaded_) { |
542 this.restoreWhenLoaded_ = false; // This should only work once. | 544 this.restoreWhenLoaded_ = false; // This should only work once. |
543 if (this.decodeStateFromLocation()) | 545 if (this.decodeStateFromLocation()) |
544 return; | 546 return; |
545 } | 547 } |
546 this.play(); | 548 this.play(); |
547 }; | 549 }; |
OLD | NEW |