| 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-ui' implements the UI for the Settings page. | 7 * 'settings-ui' implements the UI for the Settings page. |
| 8 * | 8 * |
| 9 * Example: | 9 * Example: |
| 10 * | 10 * |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 settings.initializeRouteFromUrl(); | 78 settings.initializeRouteFromUrl(); |
| 79 }, | 79 }, |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * @override | 82 * @override |
| 83 * @suppress {es5Strict} Object literals cannot contain duplicate keys in ES5 | 83 * @suppress {es5Strict} Object literals cannot contain duplicate keys in ES5 |
| 84 * strict mode. | 84 * strict mode. |
| 85 */ | 85 */ |
| 86 ready: function() { | 86 ready: function() { |
| 87 // Lazy-create the drawer the first time it is opened or swiped into view. | 87 // Lazy-create the drawer the first time it is opened or swiped into view. |
| 88 listenOnce(this.$.drawer, 'open-changed', function() { | 88 listenOnce(this.$.drawer, 'open-changed', () => { |
| 89 this.$.drawerTemplate.if = true; | 89 this.$.drawerTemplate.if = true; |
| 90 }.bind(this)); | 90 }); |
| 91 | 91 |
| 92 window.addEventListener('popstate', function(e) { | 92 window.addEventListener('popstate', e => { |
| 93 this.$.drawer.closeDrawer(); | 93 this.$.drawer.closeDrawer(); |
| 94 }.bind(this)); | 94 }); |
| 95 | 95 |
| 96 CrPolicyStrings = { | 96 CrPolicyStrings = { |
| 97 controlledSettingExtension: | 97 controlledSettingExtension: |
| 98 loadTimeData.getString('controlledSettingExtension'), | 98 loadTimeData.getString('controlledSettingExtension'), |
| 99 controlledSettingPolicy: | 99 controlledSettingPolicy: |
| 100 loadTimeData.getString('controlledSettingPolicy'), | 100 loadTimeData.getString('controlledSettingPolicy'), |
| 101 controlledSettingRecommendedMatches: | 101 controlledSettingRecommendedMatches: |
| 102 loadTimeData.getString('controlledSettingRecommendedMatches'), | 102 loadTimeData.getString('controlledSettingRecommendedMatches'), |
| 103 controlledSettingRecommendedDiffers: | 103 controlledSettingRecommendedDiffers: |
| 104 loadTimeData.getString('controlledSettingRecommendedDiffers'), | 104 loadTimeData.getString('controlledSettingRecommendedDiffers'), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 130 // </if> | 130 // </if> |
| 131 | 131 |
| 132 this.showAndroidApps_ = loadTimeData.valueExists('androidAppsVisible') && | 132 this.showAndroidApps_ = loadTimeData.valueExists('androidAppsVisible') && |
| 133 loadTimeData.getBoolean('androidAppsVisible'); | 133 loadTimeData.getBoolean('androidAppsVisible'); |
| 134 this.showMultidevice_ = | 134 this.showMultidevice_ = |
| 135 loadTimeData.valueExists('enableMultideviceSettings') && | 135 loadTimeData.valueExists('enableMultideviceSettings') && |
| 136 loadTimeData.getBoolean('enableMultideviceSettings'); | 136 loadTimeData.getBoolean('enableMultideviceSettings'); |
| 137 this.havePlayStoreApp_ = loadTimeData.valueExists('havePlayStoreApp') && | 137 this.havePlayStoreApp_ = loadTimeData.valueExists('havePlayStoreApp') && |
| 138 loadTimeData.getBoolean('havePlayStoreApp'); | 138 loadTimeData.getBoolean('havePlayStoreApp'); |
| 139 | 139 |
| 140 this.addEventListener('show-container', function() { | 140 this.addEventListener('show-container', () => { |
| 141 this.$.container.style.visibility = 'visible'; | 141 this.$.container.style.visibility = 'visible'; |
| 142 }.bind(this)); | 142 }); |
| 143 | 143 |
| 144 this.addEventListener('hide-container', function() { | 144 this.addEventListener('hide-container', () => { |
| 145 this.$.container.style.visibility = 'hidden'; | 145 this.$.container.style.visibility = 'hidden'; |
| 146 }.bind(this)); | 146 }); |
| 147 }, | 147 }, |
| 148 | 148 |
| 149 /** @private {?IntersectionObserver} */ | 149 /** @private {?IntersectionObserver} */ |
| 150 intersectionObserver_: null, | 150 intersectionObserver_: null, |
| 151 | 151 |
| 152 /** @override */ | 152 /** @override */ |
| 153 attached: function() { | 153 attached: function() { |
| 154 document.documentElement.classList.remove('loading'); | 154 document.documentElement.classList.remove('loading'); |
| 155 | 155 |
| 156 setTimeout(function() { | 156 setTimeout(function() { |
| 157 chrome.send( | 157 chrome.send( |
| 158 'metricsHandler:recordTime', | 158 'metricsHandler:recordTime', |
| 159 ['Settings.TimeUntilInteractive', window.performance.now()]); | 159 ['Settings.TimeUntilInteractive', window.performance.now()]); |
| 160 }); | 160 }); |
| 161 | 161 |
| 162 // Preload bold Roboto so it doesn't load and flicker the first time used. | 162 // Preload bold Roboto so it doesn't load and flicker the first time used. |
| 163 document.fonts.load('bold 12px Roboto'); | 163 document.fonts.load('bold 12px Roboto'); |
| 164 settings.setGlobalScrollTarget(this.$.container); | 164 settings.setGlobalScrollTarget(this.$.container); |
| 165 | 165 |
| 166 // Setup drop shadow logic. | 166 // Setup drop shadow logic. |
| 167 var callback = function(entries) { | 167 var callback = entries => { |
| 168 this.$.dropShadow.classList.toggle( | 168 this.$.dropShadow.classList.toggle( |
| 169 'has-shadow', entries[entries.length - 1].intersectionRatio == 0); | 169 'has-shadow', entries[entries.length - 1].intersectionRatio == 0); |
| 170 }.bind(this); | 170 }; |
| 171 | 171 |
| 172 this.intersectionObserver_ = new IntersectionObserver( | 172 this.intersectionObserver_ = new IntersectionObserver( |
| 173 callback, | 173 callback, |
| 174 /** @type {IntersectionObserverInit} */ ({ | 174 /** @type {IntersectionObserverInit} */ ({ |
| 175 root: this.$.container, | 175 root: this.$.container, |
| 176 threshold: 0, | 176 threshold: 0, |
| 177 })); | 177 })); |
| 178 this.intersectionObserver_.observe(this.$.intersectionProbe); | 178 this.intersectionObserver_.observe(this.$.intersectionProbe); |
| 179 }, | 179 }, |
| 180 | 180 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 onMenuButtonTap_: function() { | 252 onMenuButtonTap_: function() { |
| 253 this.$.drawer.toggle(); | 253 this.$.drawer.toggle(); |
| 254 }, | 254 }, |
| 255 | 255 |
| 256 /** @private */ | 256 /** @private */ |
| 257 onMenuClosed_: function() { | 257 onMenuClosed_: function() { |
| 258 // Add tab index so that the container can be focused. | 258 // Add tab index so that the container can be focused. |
| 259 this.$.container.setAttribute('tabindex', '-1'); | 259 this.$.container.setAttribute('tabindex', '-1'); |
| 260 this.$.container.focus(); | 260 this.$.container.focus(); |
| 261 | 261 |
| 262 listenOnce(this.$.container, ['blur', 'pointerdown'], function() { | 262 listenOnce(this.$.container, ['blur', 'pointerdown'], () => { |
| 263 this.$.container.removeAttribute('tabindex'); | 263 this.$.container.removeAttribute('tabindex'); |
| 264 }.bind(this)); | 264 }); |
| 265 }, | 265 }, |
| 266 | 266 |
| 267 /** @private */ | 267 /** @private */ |
| 268 directionDelegateChanged_: function() { | 268 directionDelegateChanged_: function() { |
| 269 this.$.drawer.align = this.directionDelegate.isRtl() ? 'right' : 'left'; | 269 this.$.drawer.align = this.directionDelegate.isRtl() ? 'right' : 'left'; |
| 270 }, | 270 }, |
| 271 }); | 271 }); |
| OLD | NEW |