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

Unified Diff: chrome/browser/resources/options/language_options.js

Issue 13509006: Add UX for languages that don't have any associated input method (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove deprecated test Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
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 e93b48525f39d42fc1e5c6a3c1a97af609b0155b..37251356929bed6ad66d995bb01202f9b3450188 100644
--- a/chrome/browser/resources/options/language_options.js
+++ b/chrome/browser/resources/options/language_options.js
@@ -385,6 +385,9 @@ cr.define('options', function() {
var languageCode = languageCodes[i];
var inputMethodIds = this.languageCodeToInputMethodIdsMap_[
languageCode];
+ if (!inputMethodIds)
+ continue;
+
// Check if we have active input methods associated with the language.
for (var j = 0; j < inputMethodIds.length; j++) {
var inputMethodId = inputMethodIds[j];
@@ -579,6 +582,9 @@ cr.define('options', function() {
}
}
+ $('language-options-input-method-none').hidden =
+ (languageCode in this.languageCodeToInputMethodIdsMap_);
+
if (focusInputMethodId == 'add') {
$('language-options-add-button').focus();
}
@@ -798,6 +804,11 @@ cr.define('options', function() {
// associated with the language code.
var enginesToBeRemovedSet = {};
var inputMethodIds = this.languageCodeToInputMethodIdsMap_[languageCode];
+
+ // If this language doesn't have any input methods, it can be deleted.
+ if (!inputMethodIds)
+ return true;
+
for (var i = 0; i < inputMethodIds.length; i++) {
enginesToBeRemovedSet[inputMethodIds[i]] = true;
}
@@ -815,6 +826,9 @@ cr.define('options', function() {
// we don't remove this time.
var inputMethodIdsForAnotherLanguage =
this.languageCodeToInputMethodIdsMap_[languageCodes[i]];
+ if (!inputMethodIdsForAnotherLanguage)
+ continue;
+
for (var j = 0; j < inputMethodIdsForAnotherLanguage.length; j++) {
var inputMethodId = inputMethodIdsForAnotherLanguage[j];
if (inputMethodId in enginesToBeRemovedSet) {

Powered by Google App Engine
This is Rietveld 408576698