| 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         Preferences.getInstance().addEventListener(this.enableSpellCheckPref, |   96         if (!cr.isMac) { | 
|   97             this.updateEnableSpellCheck_.bind(this)); |   97           Preferences.getInstance().addEventListener( | 
 |   98               this.enableSpellCheckPref, | 
 |   99               this.updateEnableSpellCheck_.bind(this)); | 
 |  100         } | 
|   98       } |  101       } | 
|   99  |  102  | 
|  100       // Listen to user clicks on the "Change touch keyboard settings..." |  103       // Listen to user clicks on the "Change touch keyboard settings..." | 
|  101       // button (if it exists). |  104       // button (if it exists). | 
|  102       var virtualKeyboardButton = $('language-options-virtual-keyboard'); |  105       var virtualKeyboardButton = $('language-options-virtual-keyboard'); | 
|  103       if (virtualKeyboardButton) { |  106       if (virtualKeyboardButton) { | 
|  104         // TODO(yusukes): would be better to hide the button if no virtual |  107         // TODO(yusukes): would be better to hide the button if no virtual | 
|  105         // keyboard is registered. |  108         // keyboard is registered. | 
|  106         virtualKeyboardButton.onclick = function(e) { |  109         virtualKeyboardButton.onclick = function(e) { | 
|  107           OptionsPage.navigateToPage('virtualKeyboards'); |  110           OptionsPage.navigateToPage('virtualKeyboards'); | 
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  212       var match = document.location.hash.match(/\blang=([\w-]+)/); |  215       var match = document.location.hash.match(/\blang=([\w-]+)/); | 
|  213       if (match) { |  216       if (match) { | 
|  214         var specifiedLanguageCode = match[1]; |  217         var specifiedLanguageCode = match[1]; | 
|  215         if (languageOptionsList.selectLanguageByCode(specifiedLanguageCode)) { |  218         if (languageOptionsList.selectLanguageByCode(specifiedLanguageCode)) { | 
|  216           languageCode = specifiedLanguageCode; |  219           languageCode = specifiedLanguageCode; | 
|  217         } |  220         } | 
|  218       } |  221       } | 
|  219       this.updateSelectedLanguageName_(languageCode); |  222       this.updateSelectedLanguageName_(languageCode); | 
|  220       if (cr.isWindows || cr.isChromeOS) |  223       if (cr.isWindows || cr.isChromeOS) | 
|  221         this.updateUiLanguageButton_(languageCode); |  224         this.updateUiLanguageButton_(languageCode); | 
|  222       this.updateSpellCheckLanguageButton_(languageCode); |  225       if (!cr.isMac) | 
 |  226         this.updateSpellCheckLanguageButton_(languageCode); | 
|  223       if (cr.isChromeOS) |  227       if (cr.isChromeOS) | 
|  224         this.updateInputMethodList_(languageCode); |  228         this.updateInputMethodList_(languageCode); | 
|  225       this.updateLanguageListInAddLanguageOverlay_(); |  229       this.updateLanguageListInAddLanguageOverlay_(); | 
|  226     }, |  230     }, | 
|  227  |  231  | 
|  228     /** |  232     /** | 
|  229      * Handles languageOptionsList's save event. |  233      * Handles languageOptionsList's save event. | 
|  230      * @param {Event} e Save event. |  234      * @param {Event} e Save event. | 
|  231      * @private |  235      * @private | 
|  232      */ |  236      */ | 
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  802   LanguageOptions.uiLanguageSaved = function() { |  806   LanguageOptions.uiLanguageSaved = function() { | 
|  803     $('language-options-ui-language-button').style.display = 'none'; |  807     $('language-options-ui-language-button').style.display = 'none'; | 
|  804     $('language-options-ui-notification-bar').style.display = 'block'; |  808     $('language-options-ui-notification-bar').style.display = 'block'; | 
|  805   }; |  809   }; | 
|  806  |  810  | 
|  807   // Export |  811   // Export | 
|  808   return { |  812   return { | 
|  809     LanguageOptions: LanguageOptions |  813     LanguageOptions: LanguageOptions | 
|  810   }; |  814   }; | 
|  811 }); |  815 }); | 
| OLD | NEW |