| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // the URL hash (ex. lang_add=ja). Used for automated testing. | 70 // the URL hash (ex. lang_add=ja). Used for automated testing. |
| 71 var match = document.location.hash.match(/\blang_add=([\w-]+)/); | 71 var match = document.location.hash.match(/\blang_add=([\w-]+)/); |
| 72 if (match) { | 72 if (match) { |
| 73 var addLanguageCode = match[1]; | 73 var addLanguageCode = match[1]; |
| 74 $('language-options-list').addLanguage(addLanguageCode); | 74 $('language-options-list').addLanguage(addLanguageCode); |
| 75 } else { | 75 } else { |
| 76 OptionsPage.navigateToPage('addLanguage'); | 76 OptionsPage.navigateToPage('addLanguage'); |
| 77 } | 77 } |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 if (cr.isChromeOS && !cr.isTouch) { | 80 if (cr.isChromeOS) { |
| 81 // Listen to user clicks on the add language list. | 81 // Listen to user clicks on the add language list. |
| 82 var addLanguageList = $('add-language-overlay-language-list'); | 82 var addLanguageList = $('add-language-overlay-language-list'); |
| 83 addLanguageList.addEventListener('click', | 83 addLanguageList.addEventListener('click', |
| 84 this.handleAddLanguageListClick_.bind(this)); | 84 this.handleAddLanguageListClick_.bind(this)); |
| 85 } else { | 85 } else { |
| 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 // Listen to user clicks on the "Change touch keyboard settings..." | 91 // Show experimental features if enabled. |
| 92 // button. | 92 if (templateData.experimentalSpellCheckFeatures == 'true') |
| 93 if (cr.isChromeOS && cr.isTouch) { | 93 $('auto-spell-correction-option').hidden = false; |
| 94 var virtualKeyboardButton = $('language-options-virtual-keyboard'); | |
| 95 // TODO(yusukes): would be better to hide the button if no virtual | |
| 96 // keyboard is registered. | |
| 97 virtualKeyboardButton.onclick = function(e) { | |
| 98 OptionsPage.navigateToPage('virtualKeyboards'); | |
| 99 }; | |
| 100 } else { | |
| 101 // Show experimental features if enabled. | |
| 102 if (templateData.experimentalSpellCheckFeatures == 'true') | |
| 103 $('auto-spell-correction-option').hidden = false; | |
| 104 } | |
| 105 } | |
| 106 | 94 |
| 107 if(!cr.isChromeOS) { | |
| 108 // Handle spell check enable/disable. | 95 // Handle spell check enable/disable. |
| 109 Preferences.getInstance().addEventListener(this.enableSpellCheckPref, | 96 Preferences.getInstance().addEventListener(this.enableSpellCheckPref, |
| 110 this.updateEnableSpellCheck_.bind(this)); | 97 this.updateEnableSpellCheck_.bind(this)); |
| 111 } | 98 } |
| 99 |
| 100 // Listen to user clicks on the "Change touch keyboard settings..." |
| 101 // button (if it exists). |
| 102 var virtualKeyboardButton = $('language-options-virtual-keyboard'); |
| 103 if (virtualKeyboardButton) { |
| 104 // TODO(yusukes): would be better to hide the button if no virtual |
| 105 // keyboard is registered. |
| 106 virtualKeyboardButton.onclick = function(e) { |
| 107 OptionsPage.navigateToPage('virtualKeyboards'); |
| 108 }; |
| 109 } |
| 112 }, | 110 }, |
| 113 | 111 |
| 114 // The preference is a boolean that enables/disables spell checking. | 112 // The preference is a boolean that enables/disables spell checking. |
| 115 enableSpellCheckPref: 'browser.enable_spellchecking', | 113 enableSpellCheckPref: 'browser.enable_spellchecking', |
| 116 // The preference is a CSV string that describes preload engines | 114 // The preference is a CSV string that describes preload engines |
| 117 // (i.e. active input methods). | 115 // (i.e. active input methods). |
| 118 preloadEnginesPref: 'settings.language.preload_engines', | 116 preloadEnginesPref: 'settings.language.preload_engines', |
| 119 // The list of preload engines, like ['mozc', 'pinyin']. | 117 // The list of preload engines, like ['mozc', 'pinyin']. |
| 120 preloadEngines_: [], | 118 preloadEngines_: [], |
| 121 // The preference is a string that describes the spell check | 119 // The preference is a string that describes the spell check |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 LanguageOptions.uiLanguageSaved = function() { | 802 LanguageOptions.uiLanguageSaved = function() { |
| 805 $('language-options-ui-language-button').style.display = 'none'; | 803 $('language-options-ui-language-button').style.display = 'none'; |
| 806 $('language-options-ui-notification-bar').style.display = 'block'; | 804 $('language-options-ui-notification-bar').style.display = 'block'; |
| 807 }; | 805 }; |
| 808 | 806 |
| 809 // Export | 807 // Export |
| 810 return { | 808 return { |
| 811 LanguageOptions: LanguageOptions | 809 LanguageOptions: LanguageOptions |
| 812 }; | 810 }; |
| 813 }); | 811 }); |
| OLD | NEW |