OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 9 |
10 const OptionsPage = options.OptionsPage; | 10 const OptionsPage = options.OptionsPage; |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 405 |
406 /** | 406 /** |
407 * Handles remove button's click event. | 407 * Handles remove button's click event. |
408 * @param {Event} e Click event. | 408 * @param {Event} e Click event. |
409 */ | 409 */ |
410 handleRemoveButtonClick_: function(e) { | 410 handleRemoveButtonClick_: function(e) { |
411 var languageOptionsList = $('language-options-list'); | 411 var languageOptionsList = $('language-options-list'); |
412 var languageCode = languageOptionsList.getSelectedLanguageCode(); | 412 var languageCode = languageOptionsList.getSelectedLanguageCode(); |
413 // Don't allow removing the language if it's as UI language. | 413 // Don't allow removing the language if it's as UI language. |
414 if (languageCode == templateData.currentUiLanguageCode) { | 414 if (languageCode == templateData.currentUiLanguageCode) { |
415 // TODO(satorux): Show the message in a nicer way. See above. | 415 this.showNotification_( |
416 alert(localStrings.getString('this_language_is_currently_in_use')); | 416 localStrings.getString('this_language_is_currently_in_use'), |
| 417 localStrings.getString('ok_button')); |
417 return; | 418 return; |
418 } | 419 } |
419 // Disable input methods associated with |languageCode|. | 420 // Disable input methods associated with |languageCode|. |
420 // Don't allow removing the language if cerntain conditions are met. | 421 // Don't allow removing the language if cerntain conditions are met. |
421 // See removePreloadEnginesByLanguageCode_() for details. | 422 // See removePreloadEnginesByLanguageCode_() for details. |
422 if (!this.removePreloadEnginesByLanguageCode_(languageCode)) { | 423 if (!this.removePreloadEnginesByLanguageCode_(languageCode)) { |
423 this.showNotification_( | 424 this.showNotification_( |
424 localStrings.getString('please_add_another_language'), | 425 localStrings.getString('please_add_another_language'), |
425 localStrings.getString('ok_button')); | 426 localStrings.getString('ok_button')); |
426 return; | 427 return; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 $('language-options-ui-language-button').style.display = 'none'; | 623 $('language-options-ui-language-button').style.display = 'none'; |
623 $('language-options-ui-notification-bar').style.display = 'block'; | 624 $('language-options-ui-notification-bar').style.display = 'block'; |
624 }; | 625 }; |
625 | 626 |
626 // Export | 627 // Export |
627 return { | 628 return { |
628 LanguageOptions: LanguageOptions | 629 LanguageOptions: LanguageOptions |
629 }; | 630 }; |
630 | 631 |
631 }); | 632 }); |
OLD | NEW |