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 /** | 5 /** |
6 * Overrided metadata worker's path. | 6 * Overrided metadata worker's path. |
7 * @type {string} | 7 * @type {string} |
8 * @const | 8 * @const |
9 */ | 9 */ |
10 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; | 10 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; |
11 | 11 |
12 /** | 12 /** |
13 * @param {HTMLElement} container Container element. | 13 * @param {HTMLElement} container Container element. |
14 * @constructor | 14 * @constructor |
15 */ | 15 */ |
16 function AudioPlayer(container) { | 16 function AudioPlayer(container) { |
17 this.container_ = container; | 17 this.container_ = container; |
18 this.volumeManager_ = new VolumeManagerWrapper( | 18 this.volumeManager_ = new VolumeManagerWrapper( |
19 VolumeManagerWrapper.DriveEnabledStatus.DRIVE_ENABLED); | 19 VolumeManagerWrapper.DriveEnabledStatus.DRIVE_ENABLED); |
20 this.fileSystemMetadata_ = FileSystemMetadata.create( | 20 this.fileSystemMetadata_ = new FileSystemMetadata(this.volumeManager_); |
21 new MetadataProviderCache(), this.volumeManager_); | |
22 this.selectedEntry_ = null; | 21 this.selectedEntry_ = null; |
23 | 22 |
24 this.model_ = new AudioPlayerModel(); | 23 this.model_ = new AudioPlayerModel(); |
25 var observer = new PathObserver(this.model_, 'expanded'); | 24 var observer = new PathObserver(this.model_, 'expanded'); |
26 observer.open(function(newValue, oldValue) { | 25 observer.open(function(newValue, oldValue) { |
27 // Inverse arguments intentionally to match the Polymer way. | 26 // Inverse arguments intentionally to match the Polymer way. |
28 this.onModelExpandedChanged(oldValue, newValue); | 27 this.onModelExpandedChanged(oldValue, newValue); |
29 }.bind(this)); | 28 }.bind(this)); |
30 | 29 |
31 this.entries_ = []; | 30 this.entries_ = []; |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // TODO(yoshiki): Handle error in better way. | 424 // TODO(yoshiki): Handle error in better way. |
426 // TODO(yoshiki): implement artwork (metadata.thumbnail) | 425 // TODO(yoshiki): implement artwork (metadata.thumbnail) |
427 this.title = metadata.mediaTitle || this.getDefaultTitle(); | 426 this.title = metadata.mediaTitle || this.getDefaultTitle(); |
428 this.artist = error || metadata.mediaArtist || this.getDefaultArtist(); | 427 this.artist = error || metadata.mediaArtist || this.getDefaultArtist(); |
429 }; | 428 }; |
430 | 429 |
431 // Starts loading the audio player. | 430 // Starts loading the audio player. |
432 window.addEventListener('polymer-ready', function(e) { | 431 window.addEventListener('polymer-ready', function(e) { |
433 AudioPlayer.load(); | 432 AudioPlayer.load(); |
434 }); | 433 }); |
OLD | NEW |