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 */ | 8 */ |
9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; | 9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Run asynchronously after an event of model change is delivered. | 57 // Run asynchronously after an event of model change is delivered. |
58 setTimeout(function() { | 58 setTimeout(function() { |
59 this.errorString_ = ''; | 59 this.errorString_ = ''; |
60 this.offlineString_ = ''; | 60 this.offlineString_ = ''; |
61 chrome.fileManagerPrivate.getStrings(function(strings) { | 61 chrome.fileManagerPrivate.getStrings(function(strings) { |
62 container.ownerDocument.title = strings['AUDIO_PLAYER_TITLE']; | 62 container.ownerDocument.title = strings['AUDIO_PLAYER_TITLE']; |
63 this.errorString_ = strings['AUDIO_ERROR']; | 63 this.errorString_ = strings['AUDIO_ERROR']; |
64 this.offlineString_ = strings['AUDIO_OFFLINE']; | 64 this.offlineString_ = strings['AUDIO_OFFLINE']; |
65 AudioPlayer.TrackInfo.DEFAULT_ARTIST = | 65 AudioPlayer.TrackInfo.DEFAULT_ARTIST = |
66 strings['AUDIO_PLAYER_DEFAULT_ARTIST']; | 66 strings['AUDIO_PLAYER_DEFAULT_ARTIST']; |
| 67 // Pass translated labels to the AudioPlayerElement. |
| 68 this.player_.ariaLabels = { |
| 69 volumeSlider: strings['AUDIO_PLAYER_OPEN_VOLUME_SLIDER_BUTTON_LABEL'], |
| 70 shuffle: strings['AUDIO_PLAYER_SHUFFLE_BUTTON_LABEL'], |
| 71 repeat: strings['AUDIO_PLAYER_REPEAT_BUTTON_LABEL'], |
| 72 previous: strings['MEDIA_PLAYER_PREVIOUS_BUTTON_LABEL'], |
| 73 play: strings['MEDIA_PLAYER_PLAY_BUTTON_LABEL'], |
| 74 pause: strings['MEDIA_PLAYER_PAUSE_BUTTON_LABEL'], |
| 75 next: strings['MEDIA_PLAYER_NEXT_BUTTON_LABEL'], |
| 76 volume: strings['AUDIO_PLAYER_OPEN_VOLUME_SLIDER_BUTTON_LABEL'], |
| 77 playList: strings['AUDIO_PLAYER_OPEN_PLAY_LIST_BUTTON_LABEL'], |
| 78 seekSlider: strings['MEDIA_PLAYER_SEEK_SLIDER_LABEL'] |
| 79 }; |
67 }.bind(this)); | 80 }.bind(this)); |
68 | 81 |
69 this.volumeManager_.addEventListener('externally-unmounted', | 82 this.volumeManager_.addEventListener('externally-unmounted', |
70 this.onExternallyUnmounted_.bind(this)); | 83 this.onExternallyUnmounted_.bind(this)); |
71 | 84 |
72 window.addEventListener('resize', this.onResize_.bind(this)); | 85 window.addEventListener('resize', this.onResize_.bind(this)); |
73 document.addEventListener('keydown', this.onKeyDown_.bind(this)); | 86 document.addEventListener('keydown', this.onKeyDown_.bind(this)); |
74 | 87 |
75 // Show the window after DOM is processed. | 88 // Show the window after DOM is processed. |
76 var currentWindow = chrome.app.window.current(); | 89 var currentWindow = chrome.app.window.current(); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } | 331 } |
319 }; | 332 }; |
320 | 333 |
321 /* Keep the below constants in sync with the CSS. */ | 334 /* Keep the below constants in sync with the CSS. */ |
322 | 335 |
323 /** | 336 /** |
324 * Window header size in pixels. | 337 * Window header size in pixels. |
325 * @type {number} | 338 * @type {number} |
326 * @const | 339 * @const |
327 */ | 340 */ |
328 AudioPlayer.HEADER_HEIGHT = 33; // 32px + border 1px | 341 AudioPlayer.HEADER_HEIGHT = 36; // 32px + border 4px |
329 | 342 |
330 /** | 343 /** |
331 * Track height in pixels. | 344 * Track height in pixels. |
332 * @type {number} | 345 * @type {number} |
333 * @const | 346 * @const |
334 */ | 347 */ |
335 AudioPlayer.TRACK_HEIGHT = 44; | 348 AudioPlayer.TRACK_HEIGHT = 48; |
336 | 349 |
337 /** | 350 /** |
338 * Controls bar height in pixels. | 351 * Controls bar height in pixels. |
339 * @type {number} | 352 * @type {number} |
340 * @const | 353 * @const |
341 */ | 354 */ |
342 AudioPlayer.CONTROLS_HEIGHT = 73; // 72px + border 1px | 355 AudioPlayer.CONTROLS_HEIGHT = 96; |
343 | 356 |
344 /** | 357 /** |
345 * Default number of items in the expanded mode. | 358 * Default number of items in the expanded mode. |
346 * @type {number} | 359 * @type {number} |
347 * @const | 360 * @const |
348 */ | 361 */ |
349 AudioPlayer.DEFAULT_EXPANDED_ITEMS = 5; | 362 AudioPlayer.DEFAULT_EXPANDED_ITEMS = 5; |
350 | 363 |
351 /** | 364 /** |
352 * Minimum size of the window in the expanded mode in pixels. | 365 * Minimum size of the window in the expanded mode in pixels. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 // TODO(yoshiki): Handle error in better way. | 466 // TODO(yoshiki): Handle error in better way. |
454 // TODO(yoshiki): implement artwork (metadata.thumbnail) | 467 // TODO(yoshiki): implement artwork (metadata.thumbnail) |
455 this.title = metadata.mediaTitle || this.getDefaultTitle(); | 468 this.title = metadata.mediaTitle || this.getDefaultTitle(); |
456 this.artist = error || metadata.mediaArtist || this.getDefaultArtist(); | 469 this.artist = error || metadata.mediaArtist || this.getDefaultArtist(); |
457 }; | 470 }; |
458 | 471 |
459 // Starts loading the audio player. | 472 // Starts loading the audio player. |
460 window.addEventListener('DOMContentLoaded', function(e) { | 473 window.addEventListener('DOMContentLoaded', function(e) { |
461 AudioPlayer.load(); | 474 AudioPlayer.load(); |
462 }); | 475 }); |
OLD | NEW |