| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 * Repeat Button. | 6 * Repeat Button. |
| 7 * | 7 * |
| 8 * This is for repeat button in Control Panel for Audio Player. | 8 * This is for repeat button in Control Panel for Audio Player. |
| 9 */ | 9 */ |
| 10 Polymer({ | 10 Polymer({ |
| 11 is: 'repeat-button', | 11 is: 'repeat-button', |
| 12 | 12 |
| 13 hostAttributes: { |
| 14 role: 'button', |
| 15 tabindex: 0 |
| 16 }, |
| 17 |
| 18 behaviors: [ |
| 19 Polymer.IronButtonState, |
| 20 Polymer.IronControlState |
| 21 ], |
| 22 |
| 13 properties: { | 23 properties: { |
| 14 'repeatMode': { | 24 'repeatMode': { |
| 15 type: String, | 25 type: String, |
| 16 notify: true, | 26 notify: true, |
| 17 reflectToAttribute: true | 27 reflectToAttribute: true |
| 18 } | 28 } |
| 19 }, | 29 }, |
| 20 | 30 |
| 21 listeners: { | 31 listeners: { |
| 22 tap: '_tapHandler' | 32 tap: '_tapHandler' |
| 23 }, | 33 }, |
| 24 | 34 |
| 35 observers: [ |
| 36 '_focusedChanged(receivedFocusFromKeyboard)' |
| 37 ], |
| 38 |
| 39 _focusedChanged: function(receivedFocusFromKeyboard) { |
| 40 if (receivedFocusFromKeyboard) { |
| 41 this.classList.add('keyboard-focus'); |
| 42 } else { |
| 43 this.classList.remove('keyboard-focus'); |
| 44 } |
| 45 }, |
| 46 |
| 25 /** | 47 /** |
| 26 * Initialize member variables. | 48 * Initialize member variables. |
| 27 */ | 49 */ |
| 28 created: function() { | 50 created: function() { |
| 29 /** | 51 /** |
| 30 * @private {Array<string>} | 52 * @private {Array<string>} |
| 31 */ | 53 */ |
| 32 this.modeName_ = [ | 54 this.modeName_ = [ |
| 33 "no-repeat", | 55 "no-repeat", |
| 34 "repeat-all", | 56 "repeat-all", |
| (...skipping 21 matching lines...) Expand all Loading... |
| 56 | 78 |
| 57 /** | 79 /** |
| 58 * Whether or not the button is active, which means it should be toggled. | 80 * Whether or not the button is active, which means it should be toggled. |
| 59 * @param {string} mode Current mode name | 81 * @param {string} mode Current mode name |
| 60 * @return {boolean} True if the mode is repeat. | 82 * @return {boolean} True if the mode is repeat. |
| 61 */ | 83 */ |
| 62 isActive: function(mode) { | 84 isActive: function(mode) { |
| 63 return mode === "repeat-all" || mode === "repeat-one"; | 85 return mode === "repeat-all" || mode === "repeat-one"; |
| 64 }, | 86 }, |
| 65 }); | 87 }); |
| OLD | NEW |