| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 return this.languageHelper_.getLanguage( | 221 return this.languageHelper_.getLanguage( |
| 222 this.languageHelper_.getProspectiveUILanguage()).displayName; | 222 this.languageHelper_.getProspectiveUILanguage()).displayName; |
| 223 }, | 223 }, |
| 224 | 224 |
| 225 /** | 225 /** |
| 226 * Returns either the "selected" class, if the language matches the | 226 * Returns either the "selected" class, if the language matches the |
| 227 * prospective UI language, or an empty string. Languages can only be | 227 * prospective UI language, or an empty string. Languages can only be |
| 228 * selected on Chrome OS and Windows. | 228 * selected on Chrome OS and Windows. |
| 229 * @param {string} languageCode The language code identifying a language. | 229 * @param {string} languageCode The language code identifying a language. |
| 230 * @param {string} prospectiveUILanguage The prospective UI language. | 230 * @param {string} prospectiveUILanguage The prospective UI language. |
| 231 * @param {boolean} supportsUI Whether Chrome's UI can be shown in this | |
| 232 * language. | |
| 233 * @return {string} The class name for the language item. | 231 * @return {string} The class name for the language item. |
| 234 * @private | 232 * @private |
| 235 */ | 233 */ |
| 236 getLanguageItemClass_: function(languageCode, prospectiveUILanguage, | 234 getLanguageItemClass_: function(languageCode, prospectiveUILanguage) { |
| 237 supportsUI) { | 235 if ((cr.isChromeOS || cr.isWindows) && |
| 238 var classes = []; | 236 this.isProspectiveUILanguage_(languageCode, prospectiveUILanguage)) { |
| 239 | 237 return 'selected'; |
| 240 if (cr.isChromeOS || cr.isWindows) { | |
| 241 if (supportsUI) | |
| 242 classes.push('list-button'); // Makes the item look "actionable". | |
| 243 | |
| 244 if (this.isProspectiveUILanguage_(languageCode, prospectiveUILanguage)) | |
| 245 classes.push('selected'); | |
| 246 } | 238 } |
| 247 | 239 return ''; |
| 248 return classes.join(' '); | |
| 249 }, | 240 }, |
| 250 | 241 |
| 251 /** | 242 /** |
| 252 * @param {string} id The input method ID. | 243 * @param {string} id The input method ID. |
| 253 * @param {string} currentId The ID of the currently enabled input method. | 244 * @param {string} currentId The ID of the currently enabled input method. |
| 254 * @return {boolean} True if the IDs match. | 245 * @return {boolean} True if the IDs match. |
| 255 * @private | 246 * @private |
| 256 */ | 247 */ |
| 257 isCurrentInputMethod_: function(id, currentId) { | 248 isCurrentInputMethod_: function(id, currentId) { |
| 258 assert(cr.isChromeOS); | 249 assert(cr.isChromeOS); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 283 * HACK(michaelpg): This is necessary to show the list when navigating to | 274 * HACK(michaelpg): This is necessary to show the list when navigating to |
| 284 * the sub-page. Remove this function when PolymerElements/neon-animation#60 | 275 * the sub-page. Remove this function when PolymerElements/neon-animation#60 |
| 285 * is fixed. | 276 * is fixed. |
| 286 * @param {string} tagName Name of the element containing the <iron-list>. | 277 * @param {string} tagName Name of the element containing the <iron-list>. |
| 287 */ | 278 */ |
| 288 forceRenderList_: function(tagName) { | 279 forceRenderList_: function(tagName) { |
| 289 this.$$(tagName).$$('iron-list').fire('iron-resize'); | 280 this.$$(tagName).$$('iron-list').fire('iron-resize'); |
| 290 }, | 281 }, |
| 291 }); | 282 }); |
| 292 })(); | 283 })(); |
| OLD | NEW |