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

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

Issue 2305623003: Support to repeat one song in Audio Player. (Closed)
Patch Set: Add a test for 3 repeat mode. 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * Repeat Button.
7 *
8 * This is for repeat button in Control Panel for Audio Player.
9 */
10 Polymer({
11 is: 'repeat-button',
12
13 properties: {
14 'repeatMode': {
15 type: String,
16 notify: true,
17 reflectToAttribute: true
18 }
19 },
20
21 listeners: {
22 tap: '_tapHandler'
23 },
24
25 /**
26 * Initialize member variables.
27 */
28 created: function() {
29 /**
30 * @private {Array<string>}
31 */
32 this.modeName_ = [
33 "no-repeat",
34 "repeat-all",
35 "repeat-one"
36 ];
37 },
38
39 _tapHandler: function() {
40 this.next_();
41 },
42
43 /**
44 * Change the mode into next one.
45 * @private
46 */
47 next_: function() {
48 this.index_ = this.index_ || this.modeName_.indexOf(this.repeatMode);
49 if(this.index_ === -1)
50 return;
51
52 var nextIndex = (this.index_ + 1) % this.modeName_.length;
53 this.repeatMode = this.modeName_[nextIndex];
54 this.index_ = nextIndex;
55 },
56
57 /**
58 * Whether or not the button is active, which means it should be toggled.
59 * @param {string} mode Current mode name
60 * @return {boolean} True if the mode is repeat.
61 */
62 isActive: function(mode) {
63 return mode === "repeat-all" || mode === "repeat-one";
64 },
65 });
OLDNEW
« no previous file with comments | « ui/file_manager/audio_player/elements/repeat_button.html ('k') | ui/file_manager/audio_player/js/audio_player.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698