Chromium Code Reviews| Index: chrome/browser/resources/options/language_options.js |
| diff --git a/chrome/browser/resources/options/language_options.js b/chrome/browser/resources/options/language_options.js |
| index dc58e76d5b350c7933a76aa7a8a2c92aed13d052..4378ed62f6fac00deac8f6952bfcb240997402eb 100644 |
| --- a/chrome/browser/resources/options/language_options.js |
| +++ b/chrome/browser/resources/options/language_options.js |
| @@ -125,21 +125,19 @@ cr.define('options', function() { |
| } |
| if (cr.isChromeOS) { |
| - // Listen to user clicks on the add language list. |
| - var addLanguageList = $('add-language-overlay-language-list'); |
| - addLanguageList.addEventListener( |
| - 'click', |
| - this.handleAddLanguageListClick_.bind(this)); |
| + // Listen to user click on the extension ime button. |
| $('language-options-extension-ime-button').addEventListener( |
| 'click', |
| this.handleExtensionImeButtonClick_.bind(this)); |
| - } else { |
| - // Listen to add language dialog ok button. |
| - var addLanguageOkButton = $('add-language-overlay-ok-button'); |
| - addLanguageOkButton.addEventListener( |
| - 'click', |
| - this.handleAddLanguageOkButtonClick_.bind(this)); |
| + } |
| + |
|
Dan Beam
2013/02/01 19:38:10
so this is available on CrOS now? seems like it wa
Seigo Nonaka
2013/02/04 06:10:45
Yes. Before UI didn't have OK button because all i
|
| + // Listen to add language dialog ok button. |
| + var addLanguageOkButton = $('add-language-overlay-ok-button'); |
|
Dan Beam
2013/02/01 19:38:11
nit: inline `addLanguageOkButton` IMO
Seigo Nonaka
2013/02/04 06:10:45
Done.
|
| + addLanguageOkButton.addEventListener( |
| + 'click', |
| + this.handleAddLanguageOkButtonClick_.bind(this)); |
|
Dan Beam
2013/02/01 19:38:11
nit: 'click', this.handleAddLanguageOkButtonClick_
Seigo Nonaka
2013/02/04 06:10:45
Done.
|
| + if (!cr.isChromeOS) { |
| // Show experimental features if enabled. |
| if (loadTimeData.getBoolean('enableSpellingAutoCorrect')) |
| $('auto-spell-correction-option').hidden = false; |
| @@ -662,34 +660,6 @@ cr.define('options', function() { |
| }, |
| /** |
| - * Handles add language list's click event. |
| - * @param {Event} e Click event. |
| - */ |
| - handleAddLanguageListClick_: function(e) { |
| - var languageOptionsList = $('language-options-list'); |
| - var languageCode = e.target.languageCode; |
| - // languageCode can be undefined, if click was made on some random |
| - // place in the overlay, rather than a button. Ignore it. |
| - if (!languageCode) { |
| - return; |
| - } |
| - languageOptionsList.addLanguage(languageCode); |
| - var inputMethodIds = this.languageCodeToInputMethodIdsMap_[languageCode]; |
| - // Enable the first input method for the language added. |
| - if (inputMethodIds && inputMethodIds[0] && |
| - // Don't add the input method it's already present. This can |
| - // happen if the same input method is shared among multiple |
| - // languages (ex. English US keyboard is used for English US and |
| - // Filipino). |
| - this.preloadEngines_.indexOf(inputMethodIds[0]) == -1) { |
| - this.preloadEngines_.push(inputMethodIds[0]); |
| - this.updateCheckboxesFromPreloadEngines_(); |
| - this.savePreloadEnginesPref_(); |
| - } |
| - OptionsPage.closeOverlay(); |
| - }, |
| - |
| - /** |
| * Handles extension IME button. |
| */ |
| handleExtensionImeButtonClick_: function() { |
| @@ -728,6 +698,21 @@ cr.define('options', function() { |
| if (selectedIndex >= 0) { |
| var selection = languagesSelect.options[selectedIndex]; |
| $('language-options-list').addLanguage(String(selection.value)); |
| + if (cr.isChromeOS) { |
| + var inputMethodIds = |
| + this.languageCodeToInputMethodIdsMap_[selection.value]; |
| + // Enable the first input method for the language added. |
| + if (inputMethodIds && inputMethodIds[0] && |
| + // Don't add the input method it's already present. This can |
| + // happen if the same input method is shared among multiple |
| + // languages (ex. English US keyboard is used for English US and |
| + // Filipino). |
| + this.preloadEngines_.indexOf(inputMethodIds[0]) == -1) { |
| + this.preloadEngines_.push(inputMethodIds[0]); |
| + this.updateCheckboxesFromPreloadEngines_(); |
| + this.savePreloadEnginesPref_(); |
| + } |
| + } |
| OptionsPage.closeOverlay(); |
| } |
| }, |