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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 this.languageHelper_ = LanguageHelperImpl.getInstance(); | 61 this.languageHelper_ = LanguageHelperImpl.getInstance(); |
62 }, | 62 }, |
63 | 63 |
64 /** | 64 /** |
65 * Handler for clicking a language on the main page, which selects the | 65 * Handler for clicking a language on the main page, which selects the |
66 * language as the prospective UI language on Chrome OS and Windows. | 66 * language as the prospective UI language on Chrome OS and Windows. |
67 * @param {!{model: !{item: !LanguageState}}} e | 67 * @param {!{model: !{item: !LanguageState}}} e |
68 */ | 68 */ |
69 onLanguageTap_: function(e) { | 69 onLanguageTap_: function(e) { |
70 // Only change the UI language on platforms that allow it. | 70 // Only change the UI language on platforms that allow it. |
71 if (!cr.isChromeOS && !cr.isWindows) | 71 if ((!cr.isChromeOS && !cr.isWindows) || loadTimeData.getBoolean('isGuest')) |
72 return; | 72 return; |
73 | 73 |
74 // Set the prospective UI language. This won't take effect until a restart. | 74 // Set the prospective UI language. This won't take effect until a restart. |
75 if (e.model.item.language.supportsUI) | 75 if (e.model.item.language.supportsUI) |
76 this.languageHelper_.setUILanguage(e.model.item.language.code); | 76 this.languageHelper_.setUILanguage(e.model.item.language.code); |
77 }, | 77 }, |
78 | 78 |
79 /** | 79 /** |
80 * Handler for enabling or disabling spell check. | 80 * Handler for enabling or disabling spell check. |
81 * @param {!{target: Element, model: !{item: !LanguageState}}} e | 81 * @param {!{target: Element, model: !{item: !LanguageState}}} e |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 * @param {boolean} supportsUI Whether Chrome's UI can be shown in this | 275 * @param {boolean} supportsUI Whether Chrome's UI can be shown in this |
276 * language. | 276 * language. |
277 * @return {string} The class name for the language item. | 277 * @return {string} The class name for the language item. |
278 * @private | 278 * @private |
279 */ | 279 */ |
280 getLanguageItemClass_: function(languageCode, prospectiveUILanguage, | 280 getLanguageItemClass_: function(languageCode, prospectiveUILanguage, |
281 supportsUI) { | 281 supportsUI) { |
282 var classes = []; | 282 var classes = []; |
283 | 283 |
284 if (cr.isChromeOS || cr.isWindows) { | 284 if (cr.isChromeOS || cr.isWindows) { |
285 if (supportsUI) | 285 if (supportsUI && !loadTimeData.getBoolean('isGuest')) |
286 classes.push('list-button'); // Makes the item look "actionable". | 286 classes.push('list-button'); // Makes the item look "actionable". |
287 | 287 |
288 if (this.isProspectiveUILanguage_(languageCode, prospectiveUILanguage)) | 288 if (this.isProspectiveUILanguage_(languageCode, prospectiveUILanguage)) |
289 classes.push('selected'); | 289 classes.push('selected'); |
290 } | 290 } |
291 | 291 |
292 return classes.join(' '); | 292 return classes.join(' '); |
293 }, | 293 }, |
294 | 294 |
295 /** | 295 /** |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 * HACK(michaelpg): This is necessary to show the list when navigating to | 327 * HACK(michaelpg): This is necessary to show the list when navigating to |
328 * the sub-page. Remove this function when PolymerElements/neon-animation#60 | 328 * the sub-page. Remove this function when PolymerElements/neon-animation#60 |
329 * is fixed. | 329 * is fixed. |
330 * @param {string} tagName Name of the element containing the <iron-list>. | 330 * @param {string} tagName Name of the element containing the <iron-list>. |
331 */ | 331 */ |
332 forceRenderList_: function(tagName) { | 332 forceRenderList_: function(tagName) { |
333 this.$$(tagName).$$('iron-list').fire('iron-resize'); | 333 this.$$(tagName).$$('iron-list').fire('iron-resize'); |
334 }, | 334 }, |
335 }); | 335 }); |
336 })(); | 336 })(); |
OLD | NEW |