| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 /** @private */ | 88 /** @private */ |
| 89 onBackTap_: function() { | 89 onBackTap_: function() { |
| 90 this.$.pages.back(); | 90 this.$.pages.back(); |
| 91 }, | 91 }, |
| 92 | 92 |
| 93 /** | 93 /** |
| 94 * Opens the Manage Languages page. | 94 * Opens the Manage Languages page. |
| 95 * @private | 95 * @private |
| 96 */ | 96 */ |
| 97 onManageLanguagesTap_: function() { | 97 onManageLanguagesTap_: function() { |
| 98 this.$.pages.setSubpageChain(['manage-languages']); | 98 settings.navigateTo(settings.Route.MANAGE_LANGUAGES); |
| 99 this.forceRenderList_('settings-manage-languages-page'); | 99 this.forceRenderList_('settings-manage-languages-page'); |
| 100 }, | 100 }, |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * @param {number} index Index of the language in the list of languages. | 103 * @param {number} index Index of the language in the list of languages. |
| 104 * @param {!Object} change Polymer change object for languages.enabled.*. | 104 * @param {!Object} change Polymer change object for languages.enabled.*. |
| 105 * @return {boolean} True if the given language is the first one in the list | 105 * @return {boolean} True if the given language is the first one in the list |
| 106 * of languages. | 106 * of languages. |
| 107 * @private | 107 * @private |
| 108 */ | 108 */ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 this.languageHelper_.moveLanguage(e.model.item.language.code, 1); | 147 this.languageHelper_.moveLanguage(e.model.item.language.code, 1); |
| 148 }, | 148 }, |
| 149 | 149 |
| 150 /** | 150 /** |
| 151 * Opens the Language Detail page for the language. | 151 * Opens the Language Detail page for the language. |
| 152 * @param {!{model: !{item: !LanguageState}}} e | 152 * @param {!{model: !{item: !LanguageState}}} e |
| 153 * @private | 153 * @private |
| 154 */ | 154 */ |
| 155 onShowLanguageDetailTap_: function(e) { | 155 onShowLanguageDetailTap_: function(e) { |
| 156 this.detailLanguage_ = e.model.item; | 156 this.detailLanguage_ = e.model.item; |
| 157 this.$.pages.setSubpageChain(['language-detail']); | 157 settings.navigateTo(settings.Route.LANGUAGES_DETAIL); |
| 158 }, | 158 }, |
| 159 | 159 |
| 160 /** | 160 /** |
| 161 * Opens the Manage Input Methods page. | 161 * Opens the Manage Input Methods page. |
| 162 * @private | 162 * @private |
| 163 */ | 163 */ |
| 164 onManageInputMethodsTap_: function() { | 164 onManageInputMethodsTap_: function() { |
| 165 assert(cr.isChromeOS); | 165 assert(cr.isChromeOS); |
| 166 this.$.pages.setSubpageChain(['manage-input-methods']); | 166 settings.navigateTo(settings.Route.INPUT_METHODS); |
| 167 }, | 167 }, |
| 168 | 168 |
| 169 /** | 169 /** |
| 170 * Handler for clicking an input method on the main page, which sets it as | 170 * Handler for clicking an input method on the main page, which sets it as |
| 171 * the current input method. | 171 * the current input method. |
| 172 * @param {!{model: !{item: !chrome.languageSettingsPrivate.InputMethod}, | 172 * @param {!{model: !{item: !chrome.languageSettingsPrivate.InputMethod}, |
| 173 * target: !{tagName: string}}} e | 173 * target: !{tagName: string}}} e |
| 174 */ | 174 */ |
| 175 onInputMethodTap_: function(e) { | 175 onInputMethodTap_: function(e) { |
| 176 assert(cr.isChromeOS); | 176 assert(cr.isChromeOS); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 (enabledSpellCheckLanguages.length - 2).toLocaleString()); | 231 (enabledSpellCheckLanguages.length - 2).toLocaleString()); |
| 232 } | 232 } |
| 233 }, | 233 }, |
| 234 | 234 |
| 235 /** | 235 /** |
| 236 * Opens the Custom Dictionary page. | 236 * Opens the Custom Dictionary page. |
| 237 * @private | 237 * @private |
| 238 */ | 238 */ |
| 239 onEditDictionaryTap_: function() { | 239 onEditDictionaryTap_: function() { |
| 240 assert(!cr.isMac); | 240 assert(!cr.isMac); |
| 241 this.$.pages.setSubpageChain(['edit-dictionary']); | 241 settings.navigateTo(settings.Route.EDIT_DICTIONARY); |
| 242 this.forceRenderList_('settings-edit-dictionary-page'); | 242 this.forceRenderList_('settings-edit-dictionary-page'); |
| 243 }, | 243 }, |
| 244 | 244 |
| 245 /** | 245 /** |
| 246 * Checks whether the prospective UI language (the pref that indicates what | 246 * Checks whether the prospective UI language (the pref that indicates what |
| 247 * language to use in Chrome) matches the current language. This pref is only | 247 * language to use in Chrome) matches the current language. This pref is only |
| 248 * on Chrome OS and Windows; we don't control the UI language elsewhere. | 248 * on Chrome OS and Windows; we don't control the UI language elsewhere. |
| 249 * @param {string} languageCode The language code identifying a language. | 249 * @param {string} languageCode The language code identifying a language. |
| 250 * @param {string} prospectiveUILanguage The prospective UI language. | 250 * @param {string} prospectiveUILanguage The prospective UI language. |
| 251 * @return {boolean} True if the given language matches the prospective UI | 251 * @return {boolean} True if the given language matches the prospective UI |
| (...skipping 75 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 |