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

Side by Side Diff: ui/file_manager/audio_player/js/audio_player.js

Issue 971723002: Files.app: Rename FileSystemMetadata with MetadataModel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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_ = new FileSystemMetadata(this.volumeManager_); 20 this.metadataModel_ = new MetadataModel.create(this.volumeManager_);
21 this.selectedEntry_ = null; 21 this.selectedEntry_ = null;
22 22
23 this.model_ = new AudioPlayerModel(); 23 this.model_ = new AudioPlayerModel();
24 var observer = new PathObserver(this.model_, 'expanded'); 24 var observer = new PathObserver(this.model_, 'expanded');
25 observer.open(function(newValue, oldValue) { 25 observer.open(function(newValue, oldValue) {
26 // Inverse arguments intentionally to match the Polymer way. 26 // Inverse arguments intentionally to match the Polymer way.
27 this.onModelExpandedChanged(oldValue, newValue); 27 this.onModelExpandedChanged(oldValue, newValue);
28 }.bind(this)); 28 }.bind(this));
29 29
30 this.entries_ = []; 30 this.entries_ = [];
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 this.selectedEntry_ = entry; 230 this.selectedEntry_ = entry;
231 }.bind(this)); 231 }.bind(this));
232 }; 232 };
233 233
234 /** 234 /**
235 * @param {FileEntry} entry Track file entry. 235 * @param {FileEntry} entry Track file entry.
236 * @param {function(object)} callback Callback. 236 * @param {function(object)} callback Callback.
237 * @private 237 * @private
238 */ 238 */
239 AudioPlayer.prototype.fetchMetadata_ = function(entry, callback) { 239 AudioPlayer.prototype.fetchMetadata_ = function(entry, callback) {
240 this.fileSystemMetadata_.get( 240 this.metadataModel_.get(
241 [entry], ['mediaTitle', 'mediaArtist', 'present']).then( 241 [entry], ['mediaTitle', 'mediaArtist', 'present']).then(
242 function(generation, metadata) { 242 function(generation, metadata) {
243 // Do nothing if another load happened since the metadata request. 243 // Do nothing if another load happened since the metadata request.
244 if (this.playlistGeneration_ == generation) 244 if (this.playlistGeneration_ == generation)
245 callback(metadata[0]); 245 callback(metadata[0]);
246 }.bind(this, this.playlistGeneration_)); 246 }.bind(this, this.playlistGeneration_));
247 }; 247 };
248 248
249 /** 249 /**
250 * Media error handler. 250 * Media error handler.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // TODO(yoshiki): Handle error in better way. 424 // TODO(yoshiki): Handle error in better way.
425 // TODO(yoshiki): implement artwork (metadata.thumbnail) 425 // TODO(yoshiki): implement artwork (metadata.thumbnail)
426 this.title = metadata.mediaTitle || this.getDefaultTitle(); 426 this.title = metadata.mediaTitle || this.getDefaultTitle();
427 this.artist = error || metadata.mediaArtist || this.getDefaultArtist(); 427 this.artist = error || metadata.mediaArtist || this.getDefaultArtist();
428 }; 428 };
429 429
430 // Starts loading the audio player. 430 // Starts loading the audio player.
431 window.addEventListener('polymer-ready', function(e) { 431 window.addEventListener('polymer-ready', function(e) {
432 AudioPlayer.load(); 432 AudioPlayer.load();
433 }); 433 });
OLDNEW
« no previous file with comments | « ui/file_manager/audio_player/audio_player.html ('k') | ui/file_manager/audio_player/js/audio_player_scripts.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698