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 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 // Make sure the event comes from tapping the language itself and not the | |
| 63 // options menu trigger or menu items. | |
| 64 if (Polymer.dom(e).localTarget.className.includes('dropdown-')) | |
|
Dan Beam
2016/08/10 20:45:26
why are you just checking that dropdown- exists in
Moe
2016/08/10 23:58:32
Made this a regex. It should be a more precise mat
| |
| 65 return; | |
| 66 | |
| 62 // Only change the UI language on platforms that allow it. | 67 // Only change the UI language on platforms that allow it. |
| 63 if ((!cr.isChromeOS && !cr.isWindows) || loadTimeData.getBoolean('isGuest')) | 68 if ((!cr.isChromeOS && !cr.isWindows) || loadTimeData.getBoolean('isGuest')) |
| 64 return; | 69 return; |
| 65 | 70 |
| 66 // Set the prospective UI language. This won't take effect until a restart. | 71 // Set the prospective UI language. This won't take effect until a restart. |
| 67 if (e.model.item.language.supportsUI) | 72 |
| 68 this.languageHelper_.setUILanguage(e.model.item.language.code); | 73 var tapEvent = /** @type {!{model: !{item: !LanguageState}}} */(e); |
| 74 if (tapEvent.model.item.language.supportsUI) | |
| 75 this.languageHelper_.setUILanguage(tapEvent.model.item.language.code); | |
| 69 }, | 76 }, |
| 70 | 77 |
| 71 /** | 78 /** |
| 72 * Handler for enabling or disabling spell check. | 79 * Handler for enabling or disabling spell check. |
| 73 * @param {!{target: Element, model: !{item: !LanguageState}}} e | 80 * @param {!{target: Element, model: !{item: !LanguageState}}} e |
| 74 */ | 81 */ |
| 75 onSpellCheckChange_: function(e) { | 82 onSpellCheckChange_: function(e) { |
| 76 this.languageHelper_.toggleSpellCheck(e.model.item.language.code, | 83 this.languageHelper_.toggleSpellCheck(e.model.item.language.code, |
| 77 e.target.checked); | 84 e.target.checked); |
| 78 }, | 85 }, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 * HACK(michaelpg): This is necessary to show the list when navigating to | 326 * HACK(michaelpg): This is necessary to show the list when navigating to |
| 320 * the sub-page. Remove this function when PolymerElements/neon-animation#60 | 327 * the sub-page. Remove this function when PolymerElements/neon-animation#60 |
| 321 * is fixed. | 328 * is fixed. |
| 322 * @param {string} tagName Name of the element containing the <iron-list>. | 329 * @param {string} tagName Name of the element containing the <iron-list>. |
| 323 */ | 330 */ |
| 324 forceRenderList_: function(tagName) { | 331 forceRenderList_: function(tagName) { |
| 325 this.$$(tagName).$$('iron-list').fire('iron-resize'); | 332 this.$$(tagName).$$('iron-list').fire('iron-resize'); |
| 326 }, | 333 }, |
| 327 }); | 334 }); |
| 328 })(); | 335 })(); |
| OLD | NEW |