OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // TODO(kochi): Generalize the notification as a component and put it | 5 // TODO(kochi): Generalize the notification as a component and put it |
6 // in js/cr/ui/notification.js . | 6 // in js/cr/ui/notification.js . |
7 | 7 |
8 cr.define('options', function() { | 8 cr.define('options', function() { |
9 const OptionsPage = options.OptionsPage; | 9 const OptionsPage = options.OptionsPage; |
10 const LanguageList = options.LanguageList; | 10 const LanguageList = options.LanguageList; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Listen to add language dialog ok button. | 86 // Listen to add language dialog ok button. |
87 var addLanguageOkButton = $('add-language-overlay-ok-button'); | 87 var addLanguageOkButton = $('add-language-overlay-ok-button'); |
88 addLanguageOkButton.addEventListener('click', | 88 addLanguageOkButton.addEventListener('click', |
89 this.handleAddLanguageOkButtonClick_.bind(this)); | 89 this.handleAddLanguageOkButtonClick_.bind(this)); |
90 | 90 |
91 // Show experimental features if enabled. | 91 // Show experimental features if enabled. |
92 if (templateData.experimentalSpellCheckFeatures == 'true') | 92 if (templateData.experimentalSpellCheckFeatures == 'true') |
93 $('auto-spell-correction-option').hidden = false; | 93 $('auto-spell-correction-option').hidden = false; |
94 | 94 |
95 // Handle spell check enable/disable. | 95 // Handle spell check enable/disable. |
96 if (!cr.isMac) { | 96 Preferences.getInstance().addEventListener(this.enableSpellCheckPref, |
97 Preferences.getInstance().addEventListener( | 97 this.updateEnableSpellCheck_.bind(this)); |
98 this.enableSpellCheckPref, | |
99 this.updateEnableSpellCheck_.bind(this)); | |
100 } | |
101 } | 98 } |
102 | 99 |
103 // Listen to user clicks on the "Change touch keyboard settings..." | 100 // Listen to user clicks on the "Change touch keyboard settings..." |
104 // button (if it exists). | 101 // button (if it exists). |
105 var virtualKeyboardButton = $('language-options-virtual-keyboard'); | 102 var virtualKeyboardButton = $('language-options-virtual-keyboard'); |
106 if (virtualKeyboardButton) { | 103 if (virtualKeyboardButton) { |
107 // TODO(yusukes): would be better to hide the button if no virtual | 104 // TODO(yusukes): would be better to hide the button if no virtual |
108 // keyboard is registered. | 105 // keyboard is registered. |
109 virtualKeyboardButton.onclick = function(e) { | 106 virtualKeyboardButton.onclick = function(e) { |
110 OptionsPage.navigateToPage('virtualKeyboards'); | 107 OptionsPage.navigateToPage('virtualKeyboards'); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 var match = document.location.hash.match(/\blang=([\w-]+)/); | 212 var match = document.location.hash.match(/\blang=([\w-]+)/); |
216 if (match) { | 213 if (match) { |
217 var specifiedLanguageCode = match[1]; | 214 var specifiedLanguageCode = match[1]; |
218 if (languageOptionsList.selectLanguageByCode(specifiedLanguageCode)) { | 215 if (languageOptionsList.selectLanguageByCode(specifiedLanguageCode)) { |
219 languageCode = specifiedLanguageCode; | 216 languageCode = specifiedLanguageCode; |
220 } | 217 } |
221 } | 218 } |
222 this.updateSelectedLanguageName_(languageCode); | 219 this.updateSelectedLanguageName_(languageCode); |
223 if (cr.isWindows || cr.isChromeOS) | 220 if (cr.isWindows || cr.isChromeOS) |
224 this.updateUiLanguageButton_(languageCode); | 221 this.updateUiLanguageButton_(languageCode); |
225 if (!cr.isMac) | 222 this.updateSpellCheckLanguageButton_(languageCode); |
226 this.updateSpellCheckLanguageButton_(languageCode); | |
227 if (cr.isChromeOS) | 223 if (cr.isChromeOS) |
228 this.updateInputMethodList_(languageCode); | 224 this.updateInputMethodList_(languageCode); |
229 this.updateLanguageListInAddLanguageOverlay_(); | 225 this.updateLanguageListInAddLanguageOverlay_(); |
230 }, | 226 }, |
231 | 227 |
232 /** | 228 /** |
233 * Handles languageOptionsList's save event. | 229 * Handles languageOptionsList's save event. |
234 * @param {Event} e Save event. | 230 * @param {Event} e Save event. |
235 * @private | 231 * @private |
236 */ | 232 */ |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 LanguageOptions.uiLanguageSaved = function() { | 802 LanguageOptions.uiLanguageSaved = function() { |
807 $('language-options-ui-language-button').style.display = 'none'; | 803 $('language-options-ui-language-button').style.display = 'none'; |
808 $('language-options-ui-notification-bar').style.display = 'block'; | 804 $('language-options-ui-notification-bar').style.display = 'block'; |
809 }; | 805 }; |
810 | 806 |
811 // Export | 807 // Export |
812 return { | 808 return { |
813 LanguageOptions: LanguageOptions | 809 LanguageOptions: LanguageOptions |
814 }; | 810 }; |
815 }); | 811 }); |
OLD | NEW |