| 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 'settings-device-page' is the settings page for device and | 6 * @fileoverview 'settings-device-page' is the settings page for device and |
| 7 * peripheral settings. | 7 * peripheral settings. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-device-page', | 10 is: 'settings-device-page', |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return loadTimeData.getBoolean('enablePowerSettings'); | 50 return loadTimeData.getBoolean('enablePowerSettings'); |
| 51 }, | 51 }, |
| 52 readOnly: true, | 52 readOnly: true, |
| 53 }, | 53 }, |
| 54 | 54 |
| 55 /** @private {!Map<string, string>} */ | 55 /** @private {!Map<string, string>} */ |
| 56 focusConfig_: { | 56 focusConfig_: { |
| 57 type: Object, | 57 type: Object, |
| 58 value: function() { | 58 value: function() { |
| 59 var map = new Map(); | 59 var map = new Map(); |
| 60 map.set(settings.Route.POINTERS.path, '#pointersRow .subpage-arrow'); | 60 if (settings.routes.POINTERS) |
| 61 map.set(settings.Route.KEYBOARD.path, '#keyboardRow .subpage-arrow'); | 61 map.set(settings.routes.POINTERS.path, '#pointersRow .subpage-arrow'); |
| 62 map.set(settings.Route.STYLUS.path, '#stylusRow .subpage-arrow'); | 62 if (settings.routes.KEYBOARD) |
| 63 map.set(settings.Route.DISPLAY.path, '#displayRow .subpage-arrow'); | 63 map.set(settings.routes.KEYBOARD.path, '#keyboardRow .subpage-arrow'); |
| 64 map.set(settings.Route.STORAGE.path, '#storageRow .subpage-arrow'); | 64 if (settings.routes.STYLUS) |
| 65 map.set(settings.Route.POWER.path, '#powerRow .subpage-arrow'); | 65 map.set(settings.routes.STYLUS.path, '#stylusRow .subpage-arrow'); |
| 66 if (settings.routes.DISPLAY) |
| 67 map.set(settings.routes.DISPLAY.path, '#displayRow .subpage-arrow'); |
| 68 if (settings.routes.STORAGE) |
| 69 map.set(settings.routes.STORAGE.path, '#storageRow .subpage-arrow'); |
| 70 if (settings.routes.POWER) |
| 71 map.set(settings.routes.POWER.path, '#powerRow .subpage-arrow'); |
| 66 return map; | 72 return map; |
| 67 }, | 73 }, |
| 68 }, | 74 }, |
| 69 }, | 75 }, |
| 70 | 76 |
| 71 observers: [ | 77 observers: [ |
| 72 'pointersChanged_(hasMouse_, hasTouchpad_)', | 78 'pointersChanged_(hasMouse_, hasTouchpad_)', |
| 73 ], | 79 ], |
| 74 | 80 |
| 75 /** @override */ | 81 /** @override */ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 97 if (this.hasTouchpad_) | 103 if (this.hasTouchpad_) |
| 98 return this.i18n('touchpadTitle'); | 104 return this.i18n('touchpadTitle'); |
| 99 return ''; | 105 return ''; |
| 100 }, | 106 }, |
| 101 | 107 |
| 102 /** | 108 /** |
| 103 * Handler for tapping the mouse and touchpad settings menu item. | 109 * Handler for tapping the mouse and touchpad settings menu item. |
| 104 * @private | 110 * @private |
| 105 */ | 111 */ |
| 106 onPointersTap_: function() { | 112 onPointersTap_: function() { |
| 107 settings.navigateTo(settings.Route.POINTERS); | 113 settings.navigateTo(settings.routes.POINTERS); |
| 108 }, | 114 }, |
| 109 | 115 |
| 110 /** | 116 /** |
| 111 * Handler for tapping the Keyboard settings menu item. | 117 * Handler for tapping the Keyboard settings menu item. |
| 112 * @private | 118 * @private |
| 113 */ | 119 */ |
| 114 onKeyboardTap_: function() { | 120 onKeyboardTap_: function() { |
| 115 settings.navigateTo(settings.Route.KEYBOARD); | 121 settings.navigateTo(settings.routes.KEYBOARD); |
| 116 }, | 122 }, |
| 117 | 123 |
| 118 /** | 124 /** |
| 119 * Handler for tapping the Keyboard settings menu item. | 125 * Handler for tapping the Keyboard settings menu item. |
| 120 * @private | 126 * @private |
| 121 */ | 127 */ |
| 122 onStylusTap_: function() { | 128 onStylusTap_: function() { |
| 123 settings.navigateTo(settings.Route.STYLUS); | 129 settings.navigateTo(settings.routes.STYLUS); |
| 124 }, | 130 }, |
| 125 | 131 |
| 126 /** | 132 /** |
| 127 * Handler for tapping the Display settings menu item. | 133 * Handler for tapping the Display settings menu item. |
| 128 * @private | 134 * @private |
| 129 */ | 135 */ |
| 130 onDisplayTap_: function() { | 136 onDisplayTap_: function() { |
| 131 settings.navigateTo(settings.Route.DISPLAY); | 137 settings.navigateTo(settings.routes.DISPLAY); |
| 132 }, | 138 }, |
| 133 | 139 |
| 134 /** | 140 /** |
| 135 * Handler for tapping the Storage settings menu item. | 141 * Handler for tapping the Storage settings menu item. |
| 136 * @private | 142 * @private |
| 137 */ | 143 */ |
| 138 onStorageTap_: function() { | 144 onStorageTap_: function() { |
| 139 settings.navigateTo(settings.Route.STORAGE); | 145 settings.navigateTo(settings.routes.STORAGE); |
| 140 }, | 146 }, |
| 141 | 147 |
| 142 /** | 148 /** |
| 143 * Handler for tapping the Power settings menu item. | 149 * Handler for tapping the Power settings menu item. |
| 144 * @private | 150 * @private |
| 145 */ | 151 */ |
| 146 onPowerTap_: function() { | 152 onPowerTap_: function() { |
| 147 settings.navigateTo(settings.Route.POWER); | 153 settings.navigateTo(settings.routes.POWER); |
| 148 }, | 154 }, |
| 149 | 155 |
| 150 /** @protected */ | 156 /** @protected */ |
| 151 currentRouteChanged: function() { | 157 currentRouteChanged: function() { |
| 152 this.checkPointerSubpage_(); | 158 this.checkPointerSubpage_(); |
| 153 }, | 159 }, |
| 154 | 160 |
| 155 /** | 161 /** |
| 156 * @param {boolean} hasMouse | 162 * @param {boolean} hasMouse |
| 157 * @param {boolean} hasTouchpad | 163 * @param {boolean} hasTouchpad |
| 158 * @private | 164 * @private |
| 159 */ | 165 */ |
| 160 pointersChanged_: function(hasMouse, hasTouchpad) { | 166 pointersChanged_: function(hasMouse, hasTouchpad) { |
| 161 this.$.pointersRow.hidden = !hasMouse && !hasTouchpad; | 167 this.$.pointersRow.hidden = !hasMouse && !hasTouchpad; |
| 162 this.checkPointerSubpage_(); | 168 this.checkPointerSubpage_(); |
| 163 }, | 169 }, |
| 164 | 170 |
| 165 /** | 171 /** |
| 166 * Leaves the pointer subpage if all pointing devices are detached. | 172 * Leaves the pointer subpage if all pointing devices are detached. |
| 167 * @private | 173 * @private |
| 168 */ | 174 */ |
| 169 checkPointerSubpage_: function() { | 175 checkPointerSubpage_: function() { |
| 170 // Check that the properties have explicitly been set to false. | 176 // Check that the properties have explicitly been set to false. |
| 171 if (this.hasMouse_ === false && this.hasTouchpad_ === false && | 177 if (this.hasMouse_ === false && this.hasTouchpad_ === false && |
| 172 settings.getCurrentRoute() == settings.Route.POINTERS) { | 178 settings.getCurrentRoute() == settings.routes.POINTERS) { |
| 173 settings.navigateTo(settings.Route.DEVICE); | 179 settings.navigateTo(settings.routes.DEVICE); |
| 174 } | 180 } |
| 175 }, | 181 }, |
| 176 }); | 182 }); |
| OLD | NEW |