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

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

Issue 1432393003: Revert of AudioPlayer: Update volume controls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 Polymer({ 5 Polymer({
6 is: 'audio-player', 6 is: 'audio-player',
7 7
8 properties: { 8 properties: {
9 /** 9 /**
10 * Flag whether the audio is playing or paused. True if playing, or false 10 * Flag whether the audio is playing or paused. True if playing, or false
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 /** 51 /**
52 * Whether the expanded button is ON. 52 * Whether the expanded button is ON.
53 */ 53 */
54 expanded: { 54 expanded: {
55 type: Boolean, 55 type: Boolean,
56 observer: 'expandedChanged' 56 observer: 'expandedChanged'
57 }, 57 },
58 58
59 /** 59 /**
60 * Whether the volume slider is shown.
61 */
62 volumeSliderShown: {
63 type: Boolean,
64 observer: 'volumeSliderShownChanged'
65 },
66
67 /**
68 * Track index of the current track. 60 * Track index of the current track.
69 */ 61 */
70 currentTrackIndex: { 62 currentTrackIndex: {
71 type: Number, 63 type: Number,
72 observer: 'currentTrackIndexChanged' 64 observer: 'currentTrackIndexChanged'
73 }, 65 },
74 66
75 /** 67 /**
76 * Model object of the Audio Player. 68 * Model object of the Audio Player.
77 * @type {AudioPlayerModel} 69 * @type {AudioPlayerModel}
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 128
137 /** 129 /**
138 * Handles change event for expanded state of track list. 130 * Handles change event for expanded state of track list.
139 */ 131 */
140 expandedChanged: function(expanded) { 132 expandedChanged: function(expanded) {
141 if (this.model) 133 if (this.model)
142 this.model.expanded = expanded; 134 this.model.expanded = expanded;
143 }, 135 },
144 136
145 /** 137 /**
146 * Handles change event for volumeSliderShown state.
147 */
148 volumeSliderShownChanged: function(volumeSliderShown) {
149 if (this.model)
150 this.model.volumeSliderShown = volumeSliderShown;
151 },
152
153 /**
154 * Initializes an element. This method is called automatically when the 138 * Initializes an element. This method is called automatically when the
155 * element is ready. 139 * element is ready.
156 */ 140 */
157 ready: function() { 141 ready: function() {
158 this.addEventListener('keydown', this.onKeyDown_.bind(this)); 142 this.addEventListener('keydown', this.onKeyDown_.bind(this));
159 143
160 this.$.audioController.addEventListener('dragging-changed', 144 this.$.audioController.addEventListener('dragging-changed',
161 this.onDraggingChanged_.bind(this)); 145 this.onDraggingChanged_.bind(this));
162 146
163 this.$.audio.volume = 0; // Temporary initial volume. 147 this.$.audio.volume = 0; // Temporary initial volume.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 * @param {AudioPlayerModel} newModel New model. 215 * @param {AudioPlayerModel} newModel New model.
232 * @param {AudioPlayerModel} oldModel Old model. 216 * @param {AudioPlayerModel} oldModel Old model.
233 */ 217 */
234 modelChanged: function(newModel, oldModel) { 218 modelChanged: function(newModel, oldModel) {
235 // Setting up the UI 219 // Setting up the UI
236 if (newModel !== oldModel && newModel) { 220 if (newModel !== oldModel && newModel) {
237 this.shuffle = newModel.shuffle; 221 this.shuffle = newModel.shuffle;
238 this.repeat = newModel.repeat; 222 this.repeat = newModel.repeat;
239 this.volume = newModel.volume; 223 this.volume = newModel.volume;
240 this.expanded = newModel.expanded; 224 this.expanded = newModel.expanded;
241 this.volumeSliderShown = newModel.volumeSliderShown;
242 } 225 }
243 }, 226 },
244 227
245 /** 228 /**
246 * Invoked when time is changed. 229 * Invoked when time is changed.
247 * @param {number} newValue new time (in ms). 230 * @param {number} newValue new time (in ms).
248 * @param {number} oldValue old time (in ms). 231 * @param {number} oldValue old time (in ms).
249 */ 232 */
250 timeChanged: function(newValue, oldValue) { 233 timeChanged: function(newValue, oldValue) {
251 // Ignores updates from the audio element. 234 // Ignores updates from the audio element.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 461
479 /** 462 /**
480 * Computes volume value for audio element. (should be in [0.0, 1.0]) 463 * Computes volume value for audio element. (should be in [0.0, 1.0])
481 * @param {number} volume Volume which is set in the UI. ([0, 100]) 464 * @param {number} volume Volume which is set in the UI. ([0, 100])
482 * @return {number} 465 * @return {number}
483 */ 466 */
484 computeAudioVolume_: function(volume) { 467 computeAudioVolume_: function(volume) {
485 return volume / 100; 468 return volume / 100;
486 } 469 }
487 }); 470 });
OLDNEW
« no previous file with comments | « ui/file_manager/audio_player/elements/audio_player.html ('k') | ui/file_manager/audio_player/elements/compiled_resources.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698