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

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

Issue 2305623003: Support to repeat one song in Audio Player. (Closed)
Patch Set: Created 4 years, 3 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 */ 8 */
9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; 9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js';
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 ['shuffle', 54 ['shuffle',
55 'repeat', 55 'repeat',
56 'volume', 56 'volume',
57 'playlist-expanded', 57 'playlist-expanded',
58 'track-info-expanded']; 58 'track-info-expanded'];
59 var storageKeys = KEYS_TO_SAVE_STATES.map(a => STORAGE_PREFIX + a); 59 var storageKeys = KEYS_TO_SAVE_STATES.map(a => STORAGE_PREFIX + a);
60 chrome.storage.local.get(storageKeys, function(results) { 60 chrome.storage.local.get(storageKeys, function(results) {
61 // Update the UI by loaded state. 61 // Update the UI by loaded state.
62 for (var storageKey in results) { 62 for (var storageKey in results) {
63 var key = storageKey.substr(STORAGE_PREFIX.length); 63 var key = storageKey.substr(STORAGE_PREFIX.length);
64 if(key === 'repeat' && typeof results[storageKey] === 'boolean') {
fukino 2016/09/02 12:11:48 Let's make new key 'repeat-mode' for the string va
harukam 2016/09/05 04:35:03 Acknowledged.
65 results[storageKey] = results[storageKey] ? "repeat-all" : "repeat-none" ;
66 }
64 this.player_[Polymer.CaseMap.dashToCamelCase(key)] = results[storageKey]; 67 this.player_[Polymer.CaseMap.dashToCamelCase(key)] = results[storageKey];
65 } 68 }
66 // Start listening to UI changes to write back the states to local storage. 69 // Start listening to UI changes to write back the states to local storage.
67 for (var i = 0; i < KEYS_TO_SAVE_STATES.length; i++) { 70 for (var i = 0; i < KEYS_TO_SAVE_STATES.length; i++) {
68 this.player_.addEventListener( 71 this.player_.addEventListener(
69 KEYS_TO_SAVE_STATES[i] + '-changed', 72 KEYS_TO_SAVE_STATES[i] + '-changed',
70 function(storageKey, event) { 73 function(storageKey, event) {
71 var objectToBeSaved = {}; 74 var objectToBeSaved = {};
72 objectToBeSaved[storageKey] = event.detail.value; 75 objectToBeSaved[storageKey] = event.detail.value;
73 chrome.storage.local.set(objectToBeSaved); 76 chrome.storage.local.set(objectToBeSaved);
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 // TODO(yoshiki): Handle error in better way. 611 // TODO(yoshiki): Handle error in better way.
609 this.title = metadata.mediaTitle || this.getDefaultTitle(); 612 this.title = metadata.mediaTitle || this.getDefaultTitle();
610 this.artist = error || metadata.mediaArtist || this.getDefaultArtist(); 613 this.artist = error || metadata.mediaArtist || this.getDefaultArtist();
611 this.artworkUrl = metadata.contentThumbnailUrl || ""; 614 this.artworkUrl = metadata.contentThumbnailUrl || "";
612 }; 615 };
613 616
614 // Starts loading the audio player. 617 // Starts loading the audio player.
615 window.addEventListener('DOMContentLoaded', function(e) { 618 window.addEventListener('DOMContentLoaded', function(e) {
616 AudioPlayer.load(); 619 AudioPlayer.load();
617 }); 620 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698