| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 var BatterySettings = Polymer({ | 5 var BatterySettings = Polymer({ |
| 6 is: 'battery-settings', | 6 is: 'battery-settings', |
| 7 | 7 |
| 8 behaviors: [Polymer.NeonAnimatableBehavior], |
| 9 |
| 8 properties: { | 10 properties: { |
| 9 /** The system's battery percentage. */ | 11 /** The system's battery percentage. */ |
| 10 batteryPercent: Number, | 12 batteryPercent: Number, |
| 11 | 13 |
| 12 /** | 14 /** |
| 13 * A string representing a value in the | 15 * A string representing a value in the |
| 14 * PowerSupplyProperties_BatteryState enumeration. | 16 * PowerSupplyProperties_BatteryState enumeration. |
| 15 */ | 17 */ |
| 16 batteryState: { | 18 batteryState: { |
| 17 type: String, | 19 type: String, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 }, | 64 }, |
| 63 | 65 |
| 64 /** The ID of the current power source, or the empty string. */ | 66 /** The ID of the current power source, or the empty string. */ |
| 65 selectedPowerSourceId: String, | 67 selectedPowerSourceId: String, |
| 66 | 68 |
| 67 /** A string representing the time left until the battery is discharged. */ | 69 /** A string representing the time left until the battery is discharged. */ |
| 68 timeUntilEmpty: String, | 70 timeUntilEmpty: String, |
| 69 | 71 |
| 70 /** A string representing the time left until the battery is at 100%. */ | 72 /** A string representing the time left until the battery is at 100%. */ |
| 71 timeUntilFull: String, | 73 timeUntilFull: String, |
| 72 | |
| 73 /** The title for the settings section. */ | |
| 74 title: { | |
| 75 type: String, | |
| 76 value: 'Power', | |
| 77 }, | |
| 78 }, | 74 }, |
| 79 | 75 |
| 80 observers: [ | 76 observers: [ |
| 81 'powerSourcesChanged(powerSourceOptions.*)', | 77 'powerSourcesChanged(powerSourceOptions.*)', |
| 82 ], | 78 ], |
| 83 | 79 |
| 84 initialize: function() { | 80 initialize: function() { |
| 85 if (!this.initialized) { | 81 if (!this.initialized) { |
| 86 chrome.send('requestPowerInfo'); | 82 chrome.send('requestPowerInfo'); |
| 87 this.initialized = true; | 83 this.initialized = true; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 }, | 148 }, |
| 153 | 149 |
| 154 canBecomeSource: function(source, selectedId, powerSourceOptionsChange) { | 150 canBecomeSource: function(source, selectedId, powerSourceOptionsChange) { |
| 155 if (!source.connected || !this.isDualRole(source)) | 151 if (!source.connected || !this.isDualRole(source)) |
| 156 return false; | 152 return false; |
| 157 return !this.powerSourceOptions.some(function(source) { | 153 return !this.powerSourceOptions.some(function(source) { |
| 158 return source.connected && source.type == 'DedicatedCharger'; | 154 return source.connected && source.type == 'DedicatedCharger'; |
| 159 }); | 155 }); |
| 160 }, | 156 }, |
| 161 }); | 157 }); |
| OLD | NEW |