| 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 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-display' is the settings subpage for display settings. | 7 * 'settings-display' is the settings subpage for display settings. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** |
| 11 * The types of Night Light automatic schedule. The values of the enum values |
| 12 * are synced with the pref "prefs.ash.night_light.schedule_type". |
| 13 * @enum {number} |
| 14 */ |
| 15 var NightLightScheduleType = { |
| 16 NEVER: 0, |
| 17 SUNSET_TO_SUNRISE: 1, |
| 18 CUSTOM: 2, |
| 19 }; |
| 20 |
| 10 cr.define('settings.display', function() { | 21 cr.define('settings.display', function() { |
| 11 var systemDisplayApi = /** @type {!SystemDisplay} */ (chrome.system.display); | 22 var systemDisplayApi = /** @type {!SystemDisplay} */ (chrome.system.display); |
| 12 | 23 |
| 13 return { | 24 return { |
| 14 systemDisplayApi: systemDisplayApi, | 25 systemDisplayApi: systemDisplayApi, |
| 15 }; | 26 }; |
| 16 }); | 27 }); |
| 17 | 28 |
| 18 Polymer({ | 29 Polymer({ |
| 19 is: 'settings-display', | 30 is: 'settings-display', |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 value: function() { | 97 value: function() { |
| 87 return loadTimeData.getBoolean('nightLightFeatureEnabled'); | 98 return loadTimeData.getBoolean('nightLightFeatureEnabled'); |
| 88 } | 99 } |
| 89 }, | 100 }, |
| 90 | 101 |
| 91 /** @private */ | 102 /** @private */ |
| 92 unifiedDesktopMode_: { | 103 unifiedDesktopMode_: { |
| 93 type: Boolean, | 104 type: Boolean, |
| 94 value: false, | 105 value: false, |
| 95 }, | 106 }, |
| 107 |
| 108 /** @private */ |
| 109 scheduleTypesList_: { |
| 110 type: Array, |
| 111 value: function() { |
| 112 return [{ |
| 113 name: loadTimeData.getString('displayNightLightScheduleNever'), |
| 114 value: NightLightScheduleType.NEVER }, { |
| 115 name: loadTimeData.getString( |
| 116 'displayNightLightScheduleSunsetToSunRise'), |
| 117 value: NightLightScheduleType.SUNSET_TO_SUNRISE }, { |
| 118 name: loadTimeData.getString('displayNightLightScheduleCustom'), |
| 119 value: NightLightScheduleType.CUSTOM }]; |
| 120 }, |
| 121 }, |
| 122 |
| 123 /** @private */ |
| 124 shouldOpenCustomScheduleCollapse_: { |
| 125 type: Boolean, |
| 126 value: false, |
| 127 }, |
| 96 }, | 128 }, |
| 97 | 129 |
| 130 observers: [ |
| 131 'onScheduleTypeChanged_(prefs.ash.night_light.schedule_type.*)', |
| 132 ], |
| 133 |
| 98 /** @private {number} Selected mode index received from chrome. */ | 134 /** @private {number} Selected mode index received from chrome. */ |
| 99 currentSelectedModeIndex_: -1, | 135 currentSelectedModeIndex_: -1, |
| 100 | 136 |
| 101 /** | 137 /** |
| 102 * Listener for chrome.system.display.onDisplayChanged events. | 138 * Listener for chrome.system.display.onDisplayChanged events. |
| 103 * @type {function(void)|undefined} | 139 * @type {function(void)|undefined} |
| 104 * @private | 140 * @private |
| 105 */ | 141 */ |
| 106 displayChangedListener_: undefined, | 142 displayChangedListener_: undefined, |
| 107 | 143 |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 this.$.displayLayout.updateDisplays(this.displays, this.layouts); | 561 this.$.displayLayout.updateDisplays(this.displays, this.layouts); |
| 526 }, | 562 }, |
| 527 | 563 |
| 528 /** @private */ | 564 /** @private */ |
| 529 setPropertiesCallback_: function() { | 565 setPropertiesCallback_: function() { |
| 530 if (chrome.runtime.lastError) { | 566 if (chrome.runtime.lastError) { |
| 531 console.error( | 567 console.error( |
| 532 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); | 568 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); |
| 533 } | 569 } |
| 534 }, | 570 }, |
| 571 |
| 572 /** @private */ |
| 573 onScheduleTypeChanged_: function() { |
| 574 this.shouldOpenCustomScheduleCollapse_ = |
| 575 this.getPref('ash.night_light.schedule_type').value == |
| 576 NightLightScheduleType.CUSTOM; |
| 577 }, |
| 535 }); | 578 }); |
| OLD | NEW |