summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-16 08:47:01 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-16 08:47:01 +0000
commitf72d1333614fc8e89a294e8bd799d473d2999ca6 (patch)
tree79ac01133bd7855115579c432b3e72bd0a938d41 /chrome
parente9d43761072c343a1dfbe80628f9b0db6a8b04e4 (diff)
downloadchromium_src-f72d1333614fc8e89a294e8bd799d473d2999ca6.zip
chromium_src-f72d1333614fc8e89a294e8bd799d473d2999ca6.tar.gz
chromium_src-f72d1333614fc8e89a294e8bd799d473d2999ca6.tar.bz2
Fix a bug where users were able to remove a language used for displaying Chromium OS.
Users shoulnd't be able to remove such a language. In the C++ version, we disabled the "Remove" button to prevent the action, but in the DOMUI version, we'll show a warning instead, per suggestions from UX designers. BUG=chromium-os:5702 TEST=manually Review URL: http://codereview.chromium.org/3122018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd4
-rw-r--r--chrome/browser/chromeos/dom_ui/language_options_handler.cc4
-rw-r--r--chrome/browser/resources/options/chromeos_language_options.js10
3 files changed, 17 insertions, 1 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index cfae607..729828b 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -8657,6 +8657,10 @@ Keep your key file in a safe place. You will need it to create new versions of y
desc="Warning invoked when the user tries to remove the last language">
Please add another language before removing this one.
</message>
+ <message name="IDS_OPTIONS_SETTINGS_LANGUAGES_THIS_LANGUAGE_IS_CURRENTLY_IN_USE"
+ desc="Warning invoked when the user tries to remove the language used for displaying Chrome OS">
+ This language is currently in use for displaying <ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph>.
+ </message>
<message name="IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_INSTRUCTIONS"
desc="Explanatory message about how to add and order languages">
Add languages and drag to order them based on your preference.
diff --git a/chrome/browser/chromeos/dom_ui/language_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_options_handler.cc
index 11e006b..7037cea 100644
--- a/chrome/browser/chromeos/dom_ui/language_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/language_options_handler.cc
@@ -83,6 +83,10 @@ void LanguageOptionsHandler::GetLocalizedValues(
l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)));
localized_strings->SetString("restart_required",
l10n_util::GetStringUTF16(IDS_OPTIONS_RESTART_REQUIRED));
+ localized_strings->SetString("this_language_is_currently_in_use",
+ l10n_util::GetStringFUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_THIS_LANGUAGE_IS_CURRENTLY_IN_USE,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)));
// GetSupportedInputMethods() never return NULL.
scoped_ptr<InputMethodDescriptors> descriptors(
diff --git a/chrome/browser/resources/options/chromeos_language_options.js b/chrome/browser/resources/options/chromeos_language_options.js
index e0cca3e..61a1fc4 100644
--- a/chrome/browser/resources/options/chromeos_language_options.js
+++ b/chrome/browser/resources/options/chromeos_language_options.js
@@ -390,13 +390,21 @@ cr.define('options', function() {
handleRemoveButtonClick_: function(e) {
var languageOptionsList = $('language-options-list');
var languageCode = languageOptionsList.getSelectedLanguageCode();
- // Disable input methods associated with |languageCode|.
+ // Don't allow removing the language if it's as UI language.
+ if (languageCode == templateData.currentUiLanguageCode) {
+ // TODO(satorux): Show the message in a nicer way. See above.
+ alert(localStrings.getString('this_language_is_currently_in_use'));
+ return;
+ }
+ // Don't allow removing the language if cerntain conditions are met.
+ // See removePreloadEnginesByLanguageCode_() for details.
if (!this.removePreloadEnginesByLanguageCode_(languageCode)) {
// TODO(satorux): Show the message in a nicer way once we get a mock
// from UX. crosbug.com/5546.
alert(localStrings.getString('please_add_another_language'));
return;
}
+ // Disable input methods associated with |languageCode|.
languageOptionsList.removeSelectedLanguage();
},