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 cr.exportPath('settings'); | 9 cr.exportPath('settings'); |
10 | 10 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } | 347 } |
348 }, | 348 }, |
349 | 349 |
350 /** | 350 /** |
351 * Opens the Custom Dictionary page. | 351 * Opens the Custom Dictionary page. |
352 * @private | 352 * @private |
353 */ | 353 */ |
354 onEditDictionaryTap_: function() { | 354 onEditDictionaryTap_: function() { |
355 assert(!cr.isMac); | 355 assert(!cr.isMac); |
356 settings.navigateTo(settings.Route.EDIT_DICTIONARY); | 356 settings.navigateTo(settings.Route.EDIT_DICTIONARY); |
357 this.forceRenderList_('settings-edit-dictionary-page'); | |
358 }, | 357 }, |
359 | 358 |
360 /** | 359 /** |
361 * Checks whether the prospective UI language (the pref that indicates what | 360 * Checks whether the prospective UI language (the pref that indicates what |
362 * language to use in Chrome) matches the current language. This pref is used | 361 * language to use in Chrome) matches the current language. This pref is used |
363 * only on Chrome OS and Windows; we don't control the UI language elsewhere. | 362 * only on Chrome OS and Windows; we don't control the UI language elsewhere. |
364 * @param {string} languageCode The language code identifying a language. | 363 * @param {string} languageCode The language code identifying a language. |
365 * @param {string} prospectiveUILanguage The prospective UI language. | 364 * @param {string} prospectiveUILanguage The prospective UI language. |
366 * @return {boolean} True if the given language matches the prospective UI | 365 * @return {boolean} True if the given language matches the prospective UI |
367 * pref (which may be different from the actual UI language). | 366 * pref (which may be different from the actual UI language). |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 getInputMethodName_: function(id) { | 452 getInputMethodName_: function(id) { |
454 assert(cr.isChromeOS); | 453 assert(cr.isChromeOS); |
455 var inputMethod = this.languages.inputMethods.enabled.find( | 454 var inputMethod = this.languages.inputMethods.enabled.find( |
456 function(inputMethod) { | 455 function(inputMethod) { |
457 return inputMethod.id == id; | 456 return inputMethod.id == id; |
458 }); | 457 }); |
459 return inputMethod ? inputMethod.displayName : ''; | 458 return inputMethod ? inputMethod.displayName : ''; |
460 }, | 459 }, |
461 | 460 |
462 /** | 461 /** |
463 * HACK(michaelpg): This is necessary to show the list when navigating to | |
464 * the sub-page. Remove this function when PolymerElements/neon-animation#60 | |
465 * is fixed. | |
466 * @param {string} tagName Name of the element containing the <iron-list>. | |
467 */ | |
468 forceRenderList_: function(tagName) { | |
469 this.$$(tagName).$$('iron-list').fire('iron-resize'); | |
470 }, | |
471 | |
472 /** | |
473 * @param {!Event} e | 462 * @param {!Event} e |
474 * @private | 463 * @private |
475 */ | 464 */ |
476 onDotsTap_: function(e) { | 465 onDotsTap_: function(e) { |
477 // Set a copy of the LanguageState object since it is not data-bound to the | 466 // Set a copy of the LanguageState object since it is not data-bound to the |
478 // languages model directly. | 467 // languages model directly. |
479 this.detailLanguage_ = /** @type {!LanguageState} */(Object.assign( | 468 this.detailLanguage_ = /** @type {!LanguageState} */(Object.assign( |
480 {}, | 469 {}, |
481 /** @type {!{model: !{item: !LanguageState}}} */(e).model.item)); | 470 /** @type {!{model: !{item: !LanguageState}}} */(e).model.item)); |
482 | 471 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 if (e.target.tagName == expandButtonTag) | 537 if (e.target.tagName == expandButtonTag) |
549 return; | 538 return; |
550 | 539 |
551 /** @type {!CrExpandButtonElement} */ | 540 /** @type {!CrExpandButtonElement} */ |
552 var expandButton = e.currentTarget.querySelector(expandButtonTag); | 541 var expandButton = e.currentTarget.querySelector(expandButtonTag); |
553 assert(expandButton); | 542 assert(expandButton); |
554 expandButton.expanded = !expandButton.expanded; | 543 expandButton.expanded = !expandButton.expanded; |
555 }, | 544 }, |
556 }); | 545 }); |
557 })(); | 546 })(); |
OLD | NEW |