Chromium Code Reviews| 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 'settings-languages-page' is the settings page | 6 * @fileoverview 'settings-languages-page' is the settings page |
| 7 * for language and input method settings. | 7 * for language and input method settings. |
| 8 */ | 8 */ |
| 9 (function() { | 9 (function() { |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 /** | 269 /** |
| 270 * Opens the Manage Input Methods page. | 270 * Opens the Manage Input Methods page. |
| 271 * @private | 271 * @private |
| 272 */ | 272 */ |
| 273 onManageInputMethodsTap_: function() { | 273 onManageInputMethodsTap_: function() { |
| 274 assert(cr.isChromeOS); | 274 assert(cr.isChromeOS); |
| 275 settings.navigateTo(settings.Route.INPUT_METHODS); | 275 settings.navigateTo(settings.Route.INPUT_METHODS); |
| 276 }, | 276 }, |
| 277 | 277 |
| 278 /** | 278 /** |
| 279 * Handler for clicking an input method on the main page, which sets it as | 279 * Handler for tap and <Enter> events on an input method on the main page, |
| 280 * the current input method. | 280 * which sets it as the current input method. |
| 281 * @param {!{model: !{item: !chrome.languageSettingsPrivate.InputMethod}, | 281 * @param {!{model: !{item: !chrome.languageSettingsPrivate.InputMethod}, |
| 282 * target: !{tagName: string}}} e | 282 * target: !{tagName: string}, |
| 283 * type: string, | |
| 284 * key: (string|undefined)}} e | |
| 283 */ | 285 */ |
| 284 onInputMethodTap_: function(e) { | 286 onInputMethodTap_: function(e) { |
| 285 assert(cr.isChromeOS); | 287 assert(cr.isChromeOS); |
| 286 | 288 |
| 287 // Taps on the paper-icon-button are handled in onInputMethodOptionsTap_. | 289 // Taps on the paper-icon-button are handled in onInputMethodOptionsTap_. |
| 288 if (e.target.tagName == 'PAPER-ICON-BUTTON') | 290 if (e.target.tagName == 'PAPER-ICON-BUTTON') |
| 289 return; | 291 return; |
| 290 | 292 |
| 293 // Ignore key presses other than <Enter>. | |
| 294 if (e.type == 'keypress' && e.key != 'Enter') | |
| 295 return; | |
| 296 | |
| 291 // Set the input method. | 297 // Set the input method. |
| 292 this.languageHelper.setCurrentInputMethod(e.model.item.id); | 298 this.languageHelper.setCurrentInputMethod(e.model.item.id); |
| 293 }, | 299 }, |
| 294 | 300 |
| 295 /** | 301 /** |
| 296 * Opens the input method extension's options page in a new tab (or focuses | 302 * Opens the input method extension's options page in a new tab (or focuses |
| 297 * an existing instance of the IME's options). | 303 * an existing instance of the IME's options). |
| 298 * @param {!{model: !{item: chrome.languageSettingsPrivate.InputMethod}}} e | 304 * @param {!{model: !{item: chrome.languageSettingsPrivate.InputMethod}}} e |
| 299 * @private | 305 * @private |
| 300 */ | 306 */ |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 * @private | 498 * @private |
| 493 */ | 499 */ |
| 494 onRestartTap_: function() { | 500 onRestartTap_: function() { |
| 495 <if expr="chromeos"> | 501 <if expr="chromeos"> |
| 496 settings.LifetimeBrowserProxyImpl.getInstance().signOutAndRestart(); | 502 settings.LifetimeBrowserProxyImpl.getInstance().signOutAndRestart(); |
| 497 </if> | 503 </if> |
| 498 <if expr="not chromeos"> | 504 <if expr="not chromeos"> |
| 499 settings.LifetimeBrowserProxyImpl.getInstance().restart(); | 505 settings.LifetimeBrowserProxyImpl.getInstance().restart(); |
| 500 </if> | 506 </if> |
| 501 }, | 507 }, |
| 508 | |
| 509 /** | |
| 510 * Toggles the expand button within the element being listened to. | |
| 511 * @param {!Event} e | |
| 512 * @private | |
| 513 */ | |
| 514 toggleExpandButton_: function(e) { | |
| 515 // The expand button handles toggling itself. | |
| 516 var expandButtonTag = 'CR-EXPAND-BUTTON'; | |
| 517 if (e.target.tagName == expandButtonTag) | |
| 518 return; | |
| 519 | |
| 520 /** @type {!CrExpandButtonElement} */ | |
| 521 var expandButton = e.currentTarget.querySelector(expandButtonTag); | |
|
stevenjb
2016/11/28 17:49:16
nit: 'var expandButton =' on prev line?
michaelpg
2016/12/01 23:19:13
meh... i find that less readable. @type above var
stevenjb
2016/12/01 23:45:33
*shrug*
| |
| 522 assert(expandButton); | |
| 523 expandButton.expanded = !expandButton.expanded; | |
| 524 }, | |
| 502 }); | 525 }); |
| 503 })(); | 526 })(); |
| OLD | NEW |