Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/resources/options2/language_options.js

Issue 10827141: Move handling of dialog preferences to Preferences class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix my rushed copy & paste :( Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 */ var OptionsPage = options.OptionsPage; 9 /** @const */ var OptionsPage = options.OptionsPage;
10 /** @const */ var LanguageList = options.LanguageList; 10 /** @const */ var LanguageList = options.LanguageList;
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 622
623 /** 623 /**
624 * Handles spellCheckLanguageButton click. 624 * Handles spellCheckLanguageButton click.
625 * @param {Event} e Click event. 625 * @param {Event} e Click event.
626 * @private 626 * @private
627 */ 627 */
628 handleSpellCheckLanguageButtonClick_: function(e) { 628 handleSpellCheckLanguageButtonClick_: function(e) {
629 var languageCode = e.target.languageCode; 629 var languageCode = e.target.languageCode;
630 // Save the preference. 630 // Save the preference.
631 Preferences.setStringPref(this.spellCheckDictionaryPref, 631 Preferences.setStringPref(this.spellCheckDictionaryPref,
632 languageCode); 632 languageCode,
633 true);
633 chrome.send('spellCheckLanguageChange', [languageCode]); 634 chrome.send('spellCheckLanguageChange', [languageCode]);
634 }, 635 },
635 636
636 /** 637 /**
637 * Checks whether it's possible to remove the language specified by 638 * Checks whether it's possible to remove the language specified by
638 * languageCode and returns true if possible. This function returns false 639 * languageCode and returns true if possible. This function returns false
639 * if the removal causes the number of preload engines to be zero. 640 * if the removal causes the number of preload engines to be zero.
640 * 641 *
641 * @param {string} languageCode Language code (ex. "fr"). 642 * @param {string} languageCode Language code (ex. "fr").
642 * @return {boolean} Returns true on success. 643 * @return {boolean} Returns true on success.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 // engines to be zero. 684 // engines to be zero.
684 return (newPreloadEngines.length > 0); 685 return (newPreloadEngines.length > 0);
685 }, 686 },
686 687
687 /** 688 /**
688 * Saves the preload engines preference. 689 * Saves the preload engines preference.
689 * @private 690 * @private
690 */ 691 */
691 savePreloadEnginesPref_: function() { 692 savePreloadEnginesPref_: function() {
692 Preferences.setStringPref(this.preloadEnginesPref, 693 Preferences.setStringPref(this.preloadEnginesPref,
693 this.preloadEngines_.join(',')); 694 this.preloadEngines_.join(','),
695 true);
694 }, 696 },
695 697
696 /** 698 /**
697 * Updates the checkboxes in the input method list from the preload 699 * Updates the checkboxes in the input method list from the preload
698 * engines preference. 700 * engines preference.
699 * @private 701 * @private
700 */ 702 */
701 updateCheckboxesFromPreloadEngines_: function() { 703 updateCheckboxesFromPreloadEngines_: function() {
702 // Convert the list into a dictonary for simpler lookup. 704 // Convert the list into a dictonary for simpler lookup.
703 var dictionary = {}; 705 var dictionary = {};
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 // only take effect after restart. 853 // only take effect after restart.
852 showMutuallyExclusiveNodes([$('language-options-ui-language-button'), 854 showMutuallyExclusiveNodes([$('language-options-ui-language-button'),
853 $('language-options-ui-notification-bar')], 1); 855 $('language-options-ui-notification-bar')], 1);
854 }; 856 };
855 857
856 // Export 858 // Export
857 return { 859 return {
858 LanguageOptions: LanguageOptions 860 LanguageOptions: LanguageOptions
859 }; 861 };
860 }); 862 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698