Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-power' is the settings subpage for power settings. | 7 * 'settings-power' is the settings subpage for power settings. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 Polymer({ | 10 Polymer({ |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 /** @override */ | 60 /** @override */ |
| 61 ready: function() { | 61 ready: function() { |
| 62 // enablePowerSettings comes from loadTimeData, so it will always be set | 62 // enablePowerSettings comes from loadTimeData, so it will always be set |
| 63 // before attached() is called. | 63 // before attached() is called. |
| 64 if (!this.enablePowerSettings) | 64 if (!this.enablePowerSettings) |
| 65 settings.navigateToPreviousRoute(); | 65 settings.navigateToPreviousRoute(); |
| 66 }, | 66 }, |
| 67 | 67 |
| 68 /** @override */ | 68 /** @override */ |
| 69 attached: function() { | 69 attached: function() { |
| 70 // Even when the row is hidden, the element can still be attached via | |
| 71 // search. | |
| 72 if (!this.enablePowerSettings) | |
| 73 return; | |
| 74 | |
| 70 this.addWebUIListener( | 75 this.addWebUIListener( |
| 71 'battery-status-changed', this.set.bind(this, 'batteryStatus_')); | 76 'battery-status-changed', this.set.bind(this, 'batteryStatus_')); |
| 72 this.addWebUIListener( | 77 this.addWebUIListener( |
| 73 'power-sources-changed', this.powerSourcesChanged_.bind(this)); | 78 'power-sources-changed', this.powerSourcesChanged_.bind(this)); |
| 74 settings.DevicePageBrowserProxyImpl.getInstance().updatePowerStatus(); | 79 settings.DevicePageBrowserProxyImpl.getInstance().updatePowerStatus(); |
|
Dan Beam
2017/03/15 00:30:58
i think you only want to wrap this line, but i'm n
Daniel Erat
2017/03/15 00:33:44
hopefully one of the other reviewers will have a s
michaelpg
2017/03/15 01:13:18
Nah, we should return early. Hopefully the comment
| |
| 75 }, | 80 }, |
| 76 | 81 |
| 77 /** | 82 /** |
| 78 * @param {!Array<!settings.PowerSource>|undefined} powerSources | 83 * @param {!Array<!settings.PowerSource>|undefined} powerSources |
| 79 * @param {boolean} calculating | 84 * @param {boolean} calculating |
| 80 * @return {string} The primary label for the power source row. | 85 * @return {string} The primary label for the power source row. |
| 81 * @private | 86 * @private |
| 82 */ | 87 */ |
| 83 computePowerSourceLabel_: function(powerSources, calculating) { | 88 computePowerSourceLabel_: function(powerSources, calculating) { |
| 84 return this.i18n( | 89 return this.i18n( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 /** | 139 /** |
| 135 * @param {*} lhs | 140 * @param {*} lhs |
| 136 * @param {*} rhs | 141 * @param {*} rhs |
| 137 * @return {boolean} | 142 * @return {boolean} |
| 138 * @private | 143 * @private |
| 139 */ | 144 */ |
| 140 isEqual_: function(lhs, rhs) { | 145 isEqual_: function(lhs, rhs) { |
| 141 return lhs === rhs; | 146 return lhs === rhs; |
| 142 }, | 147 }, |
| 143 }); | 148 }); |
| OLD | NEW |