| 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 1bd75e7b7de5aac89aa643f313e103db3aa9ab48..d2312ca41f10df5a46074d5d1725da4adc5a2c3a 100644
|
| --- a/chrome/browser/resources/options/language_options.js
|
| +++ b/chrome/browser/resources/options/language_options.js
|
| @@ -426,14 +426,6 @@ cr.define('options', function() {
|
| },
|
|
|
| /**
|
| - * Happens when a user changes back to the language they're currently using.
|
| - */
|
| - currentLocaleWasReselected: function() {
|
| - this.updateUiLanguageButton_(
|
| - loadTimeData.getString('currentUiLanguageCode'));
|
| - },
|
| -
|
| - /**
|
| * Handles languageOptionsList's save event.
|
| * @param {Event} e Save event.
|
| * @private
|
| @@ -853,7 +845,12 @@ cr.define('options', function() {
|
| this.savePreloadEnginesPref_();
|
| },
|
|
|
| - handleAddLanguageOkButtonClick_: function() {
|
| + /**
|
| + * Handles clicks on the "OK" button of the "Add language" dialog.
|
| + * @param {Event} e Click event.
|
| + * @private
|
| + */
|
| + handleAddLanguageOkButtonClick_: function(e) {
|
| var languagesSelect = $('add-language-overlay-language-list');
|
| var selectedIndex = languagesSelect.selectedIndex;
|
| if (selectedIndex >= 0) {
|
| @@ -1192,6 +1189,39 @@ cr.define('options', function() {
|
| delayedHide();
|
| },
|
|
|
| + /**
|
| + * Chrome callback for when the UI language preference is saved.
|
| + * @param {string} languageCode The newly selected language to use.
|
| + * @private
|
| + */
|
| + uiLanguageSaved_: function(languageCode) {
|
| + this.prospectiveUiLanguageCode_ = languageCode;
|
| +
|
| + // If the user is no longer on the same language code, ignore.
|
| + if ($('language-options-list').getSelectedLanguageCode() != languageCode)
|
| + return;
|
| +
|
| + // Special case for when a user changes to a different language, and
|
| + // changes back to the same language without having restarted Chrome or
|
| + // logged in/out of ChromeOS.
|
| + if (languageCode == loadTimeData.getString('currentUiLanguageCode')) {
|
| + this.updateUiLanguageButton_(languageCode);
|
| + return;
|
| + }
|
| +
|
| + // Otherwise, show a notification telling the user that their changes will
|
| + // only take effect after restart.
|
| + showMutuallyExclusiveNodes([$('language-options-ui-language-button'),
|
| + $('language-options-ui-notification-bar')],
|
| + 1);
|
| + },
|
| +
|
| + /**
|
| + * A handler for when dictionary for |languageCode| begins downloading.
|
| + * @param {string} languageCode The language of the dictionary that just
|
| + * began downloading.
|
| + * @private
|
| + */
|
| onDictionaryDownloadBegin_: function(languageCode) {
|
| this.spellcheckDictionaryDownloadStatus_[languageCode] =
|
| DOWNLOAD_STATUS.IN_PROGRESS;
|
| @@ -1202,6 +1232,12 @@ cr.define('options', function() {
|
| }
|
| },
|
|
|
| + /**
|
| + * A handler for when dictionary for |languageCode| successfully downloaded.
|
| + * @param {string} languageCode The language of the dictionary that
|
| + * succeeded downloading.
|
| + * @private
|
| + */
|
| onDictionaryDownloadSuccess_: function(languageCode) {
|
| delete this.spellcheckDictionaryDownloadStatus_[languageCode];
|
| this.spellcheckDictionaryDownloadFailures_ = 0;
|
| @@ -1212,6 +1248,12 @@ cr.define('options', function() {
|
| }
|
| },
|
|
|
| + /**
|
| + * A handler for when dictionary for |languageCode| fails to download.
|
| + * @param {string} languageCode The language of the dictionary that failed
|
| + * to download.
|
| + * @private
|
| + */
|
| onDictionaryDownloadFailure_: function(languageCode) {
|
| this.spellcheckDictionaryDownloadStatus_[languageCode] =
|
| DOWNLOAD_STATUS.FAILED;
|
| @@ -1267,29 +1309,8 @@ cr.define('options', function() {
|
| }
|
| }
|
|
|
| - /**
|
| - * Chrome callback for when the UI language preference is saved.
|
| - * @param {string} languageCode The newly selected language to use.
|
| - */
|
| LanguageOptions.uiLanguageSaved = function(languageCode) {
|
| - this.getInstance().prospectiveUiLanguageCode_ = languageCode;
|
| -
|
| - // If the user is no longer on the same language code, ignore.
|
| - if ($('language-options-list').getSelectedLanguageCode() != languageCode)
|
| - return;
|
| -
|
| - // Special case for when a user changes to a different language, and changes
|
| - // back to the same language without having restarted Chrome or logged
|
| - // in/out of ChromeOS.
|
| - if (languageCode == loadTimeData.getString('currentUiLanguageCode')) {
|
| - LanguageOptions.getInstance().currentLocaleWasReselected();
|
| - return;
|
| - }
|
| -
|
| - // Otherwise, show a notification telling the user that their changes will
|
| - // only take effect after restart.
|
| - showMutuallyExclusiveNodes([$('language-options-ui-language-button'),
|
| - $('language-options-ui-notification-bar')], 1);
|
| + LanguageOptions.getInstance().uiLanguageSaved_(languageCode);
|
| };
|
|
|
| LanguageOptions.onDictionaryDownloadBegin = function(languageCode) {
|
|
|