| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 }, | 49 }, |
| 50 | 50 |
| 51 /** @override */ | 51 /** @override */ |
| 52 created: function() { | 52 created: function() { |
| 53 this.languageHelper_ = LanguageHelperImpl.getInstance(); | 53 this.languageHelper_ = LanguageHelperImpl.getInstance(); |
| 54 }, | 54 }, |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * Handler for clicking a language on the main page, which selects the | 57 * Handler for clicking a language on the main page, which selects the |
| 58 * language as the prospective UI language on Chrome OS and Windows. | 58 * language as the prospective UI language on Chrome OS and Windows. |
| 59 * @param {!{model: !{item: !LanguageState}}} e | 59 * @param {!Event} e The tap event. |
| 60 */ | 60 */ |
| 61 onLanguageTap_: function(e) { | 61 onLanguageTap_: function(e) { |
| 62 // Only change the UI language on platforms that allow it. | 62 // Only change the UI language on platforms that allow it. |
| 63 if ((!cr.isChromeOS && !cr.isWindows) || loadTimeData.getBoolean('isGuest')) | 63 if ((!cr.isChromeOS && !cr.isWindows) || loadTimeData.getBoolean('isGuest')) |
| 64 return; | 64 return; |
| 65 | 65 |
| 66 // Set the prospective UI language. This won't take effect until a restart. | 66 // Set the prospective UI language. This won't take effect until a restart. |
| 67 if (e.model.item.language.supportsUI) | 67 var tapEvent = /** @type {!{model: !{item: !LanguageState}}} */(e); |
| 68 this.languageHelper_.setUILanguage(e.model.item.language.code); | 68 if (tapEvent.model.item.language.supportsUI) |
| 69 this.languageHelper_.setUILanguage(tapEvent.model.item.language.code); |
| 69 }, | 70 }, |
| 70 | 71 |
| 71 /** | 72 /** |
| 73 * Stops tap events on the language options menu, its trigger, or its items |
| 74 * from bubbling up to the language itself. Tap events on the language are |
| 75 * handled in onLanguageTap_. |
| 76 * @param {!Event} e The tap event. |
| 77 */ |
| 78 stopPropagationHandler_: function(e) { |
| 79 e.stopPropagation(); |
| 80 }, |
| 81 |
| 82 /** |
| 72 * Handler for enabling or disabling spell check. | 83 * Handler for enabling or disabling spell check. |
| 73 * @param {!{target: Element, model: !{item: !LanguageState}}} e | 84 * @param {!{target: Element, model: !{item: !LanguageState}}} e |
| 74 */ | 85 */ |
| 75 onSpellCheckChange_: function(e) { | 86 onSpellCheckChange_: function(e) { |
| 76 this.languageHelper_.toggleSpellCheck(e.model.item.language.code, | 87 this.languageHelper_.toggleSpellCheck(e.model.item.language.code, |
| 77 e.target.checked); | 88 e.target.checked); |
| 78 }, | 89 }, |
| 79 | 90 |
| 80 /** @private */ | 91 /** @private */ |
| 81 onBackTap_: function() { | 92 onBackTap_: function() { |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 * HACK(michaelpg): This is necessary to show the list when navigating to | 330 * HACK(michaelpg): This is necessary to show the list when navigating to |
| 320 * the sub-page. Remove this function when PolymerElements/neon-animation#60 | 331 * the sub-page. Remove this function when PolymerElements/neon-animation#60 |
| 321 * is fixed. | 332 * is fixed. |
| 322 * @param {string} tagName Name of the element containing the <iron-list>. | 333 * @param {string} tagName Name of the element containing the <iron-list>. |
| 323 */ | 334 */ |
| 324 forceRenderList_: function(tagName) { | 335 forceRenderList_: function(tagName) { |
| 325 this.$$(tagName).$$('iron-list').fire('iron-resize'); | 336 this.$$(tagName).$$('iron-list').fire('iron-resize'); |
| 326 }, | 337 }, |
| 327 }); | 338 }); |
| 328 })(); | 339 })(); |
| OLD | NEW |