| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 */ | 53 */ |
| 54 pageVisibility_: Object, | 54 pageVisibility_: Object, |
| 55 | 55 |
| 56 /** @private */ | 56 /** @private */ |
| 57 lastSearchQuery_: { | 57 lastSearchQuery_: { |
| 58 type: String, | 58 type: String, |
| 59 value: '', | 59 value: '', |
| 60 } | 60 } |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 listeners: { |
| 64 'refresh-pref': 'onRefreshPref_', |
| 65 }, |
| 66 |
| 63 /** @override */ | 67 /** @override */ |
| 64 created: function() { | 68 created: function() { |
| 65 settings.initializeRouteFromUrl(); | 69 settings.initializeRouteFromUrl(); |
| 66 }, | 70 }, |
| 67 | 71 |
| 68 /** | 72 /** |
| 69 * @override | 73 * @override |
| 70 * @suppress {es5Strict} Object literals cannot contain duplicate keys in ES5 | 74 * @suppress {es5Strict} Object literals cannot contain duplicate keys in ES5 |
| 71 * strict mode. | 75 * strict mode. |
| 72 */ | 76 */ |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 if (urlSearchQuery != searchField.getValue()) { | 141 if (urlSearchQuery != searchField.getValue()) { |
| 138 // Setting the search box value without triggering a 'search-changed' | 142 // Setting the search box value without triggering a 'search-changed' |
| 139 // event, to prevent an unnecessary duplicate entry in |window.history|. | 143 // event, to prevent an unnecessary duplicate entry in |window.history|. |
| 140 searchField.setValue(urlSearchQuery, true /* noEvent */); | 144 searchField.setValue(urlSearchQuery, true /* noEvent */); |
| 141 } | 145 } |
| 142 | 146 |
| 143 this.$.main.searchContents(urlSearchQuery); | 147 this.$.main.searchContents(urlSearchQuery); |
| 144 }, | 148 }, |
| 145 | 149 |
| 146 /** | 150 /** |
| 151 * @param {!CustomEvent} e |
| 152 * @private |
| 153 */ |
| 154 onRefreshPref_: function(e) { |
| 155 var prefName = /** @type {string} */(e.detail); |
| 156 return /** @type {SettingsPrefsElement} */(this.$.prefs).refresh(prefName); |
| 157 }, |
| 158 |
| 159 /** |
| 147 * Handles the 'search-changed' event fired from the toolbar. | 160 * Handles the 'search-changed' event fired from the toolbar. |
| 148 * @param {!Event} e | 161 * @param {!Event} e |
| 149 * @private | 162 * @private |
| 150 */ | 163 */ |
| 151 onSearchChanged_: function(e) { | 164 onSearchChanged_: function(e) { |
| 152 // Trim leading whitespace only, to prevent searching for empty string. This | 165 // Trim leading whitespace only, to prevent searching for empty string. This |
| 153 // still allows the user to search for 'foo bar', while taking a long pause | 166 // still allows the user to search for 'foo bar', while taking a long pause |
| 154 // after typing 'foo '. | 167 // after typing 'foo '. |
| 155 var query = e.detail.replace(/^\s+/, ''); | 168 var query = e.detail.replace(/^\s+/, ''); |
| 156 // Prevent duplicate history entries. | 169 // Prevent duplicate history entries. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 176 onMenuButtonTap_: function() { | 189 onMenuButtonTap_: function() { |
| 177 this.$$('app-drawer').toggle(); | 190 this.$$('app-drawer').toggle(); |
| 178 }, | 191 }, |
| 179 | 192 |
| 180 /** @private */ | 193 /** @private */ |
| 181 directionDelegateChanged_: function() { | 194 directionDelegateChanged_: function() { |
| 182 this.$$('app-drawer').align = this.directionDelegate.isRtl() ? | 195 this.$$('app-drawer').align = this.directionDelegate.isRtl() ? |
| 183 'right' : 'left'; | 196 'right' : 'left'; |
| 184 }, | 197 }, |
| 185 }); | 198 }); |
| OLD | NEW |