| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 onBackTap_: function() { | 93 onBackTap_: function() { |
| 94 this.$.pages.back(); | 94 this.$.pages.back(); |
| 95 }, | 95 }, |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * Opens the Manage Languages page. | 98 * Opens the Manage Languages page. |
| 99 * @private | 99 * @private |
| 100 */ | 100 */ |
| 101 onManageLanguagesTap_: function() { | 101 onManageLanguagesTap_: function() { |
| 102 this.$.pages.setSubpageChain(['manage-languages']); | 102 this.$.pages.setSubpageChain(['manage-languages']); |
| 103 this.forceRenderList_('settings-manage-languages-page'); | |
| 104 }, | 103 }, |
| 105 | 104 |
| 106 /** | 105 /** |
| 107 * Opens the Language Detail page for the language. | 106 * Opens the Language Detail page for the language. |
| 108 * @param {!{model: !{item}}} e | 107 * @param {!{model: !{item}}} e |
| 109 * @private | 108 * @private |
| 110 */ | 109 */ |
| 111 onShowLanguageDetailTap_: function(e) { | 110 onShowLanguageDetailTap_: function(e) { |
| 112 this.$.languageSelector.select(e.model.item); | 111 this.$.languageSelector.select(e.model.item); |
| 113 this.$.pages.setSubpageChain(['language-detail']); | 112 this.$.pages.setSubpageChain(['language-detail']); |
| 114 }, | 113 }, |
| 115 | 114 |
| 116 <if expr="not is_macosx"> | 115 <if expr="not is_macosx"> |
| 117 /** | 116 /** |
| 118 * Opens the Custom Dictionary page. | 117 * Opens the Custom Dictionary page. |
| 119 * @private | 118 * @private |
| 120 */ | 119 */ |
| 121 onEditDictionaryTap_: function() { | 120 onEditDictionaryTap_: function() { |
| 122 this.$.pages.setSubpageChain(['edit-dictionary']); | 121 this.$.pages.setSubpageChain(['edit-dictionary']); |
| 123 this.forceRenderList_('settings-edit-dictionary-page'); | |
| 124 }, | 122 }, |
| 125 </if> | 123 </if> |
| 126 | 124 |
| 127 <if expr="chromeos or is_win"> | 125 <if expr="chromeos or is_win"> |
| 128 /** | 126 /** |
| 129 * Checks whether the prospective UI language (the pref that indicates what | 127 * Checks whether the prospective UI language (the pref that indicates what |
| 130 * language to use in Chrome) matches the current language. This pref is only | 128 * language to use in Chrome) matches the current language. This pref is only |
| 131 * on Chrome OS and Windows; we don't control the UI language elsewhere. | 129 * on Chrome OS and Windows; we don't control the UI language elsewhere. |
| 132 * @param {string} languageCode The language code identifying a language. | 130 * @param {string} languageCode The language code identifying a language. |
| 133 * @param {string} prospectiveUILanguage The prospective UI language. | 131 * @param {string} prospectiveUILanguage The prospective UI language. |
| 134 * @return {boolean} True if the given language matches the prospective UI | 132 * @return {boolean} True if the given language matches the prospective UI |
| 135 * pref (which may be different from the actual UI language). | 133 * pref (which may be different from the actual UI language). |
| 136 * @private | 134 * @private |
| 137 */ | 135 */ |
| 138 isProspectiveUILanguage_: function(languageCode, prospectiveUILanguage) { | 136 isProspectiveUILanguage_: function(languageCode, prospectiveUILanguage) { |
| 139 return languageCode == this.languageHelper_.getProspectiveUILanguage(); | 137 return languageCode == this.languageHelper_.getProspectiveUILanguage(); |
| 140 }, | 138 }, |
| 141 </if> | 139 </if> |
| 142 | 140 |
| 143 /** | 141 /** |
| 144 * @param {string} id The input method ID. | 142 * @param {string} id The input method ID. |
| 145 * @param {string} currentId The ID of the currently enabled input method. | 143 * @param {string} currentId The ID of the currently enabled input method. |
| 146 * @return {boolean} True if the IDs match. | 144 * @return {boolean} True if the IDs match. |
| 147 * @private | 145 * @private |
| 148 */ | 146 */ |
| 149 isCurrentInputMethod_: function(id, currentId) { | 147 isCurrentInputMethod_: function(id, currentId) { |
| 150 assert(cr.isChromeOS); | 148 assert(cr.isChromeOS); |
| 151 return id == currentId; | 149 return id == currentId; |
| 152 }, | 150 }, |
| 153 | |
| 154 /** | |
| 155 * HACK(michaelpg): This is necessary to show the list when navigating to | |
| 156 * the sub-page. Remove this function when PolymerElements/neon-animation#60 | |
| 157 * is fixed. | |
| 158 * @param {string} tagName Name of the element containing the <iron-list>. | |
| 159 */ | |
| 160 forceRenderList_: function(tagName) { | |
| 161 this.$$(tagName).$$('iron-list').fire('iron-resize'); | |
| 162 }, | |
| 163 }); | 151 }); |
| 164 })(); | 152 })(); |
| OLD | NEW |