Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/resources/settings/languages_page/languages_page.js

Issue 2231153002: MD Settings: Checks the event target in the language tap event handler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/languages_page/languages_page.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.classList.toString().includes('dropdown-'))
michaelpg 2016/08/10 18:24:16 className for a string?
Moe 2016/08/10 20:14:48 Done.
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
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 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/languages_page/languages_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698