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

Unified Diff: chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc

Issue 325633003: Add confirmation dialog when enabling a 3rd party IME. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/ui/webui/options/chromeos/cros_language_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc
index 76d1a8fb55600d2be26e57315abe17cd00d5e86f..0f55d6cb5a395a106ac4aa06f6db1d352448a7b2 100644
--- a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc
@@ -119,9 +119,11 @@ void CrosLanguageOptionsHandler::GetLocalizedValues(
input_method::InputMethodDescriptors ext_ime_descriptors;
manager->GetInputMethodExtensions(&ext_ime_descriptors);
- localized_strings->Set("extensionImeList",
- ConvertInputMethodDescriptosToIMEList(
- ext_ime_descriptors));
+
+ base::ListValue* ext_ime_list = ConvertInputMethodDescriptorsToIMEList(
+ ext_ime_descriptors);
Dan Beam 2014/06/09 21:37:36 indent off
kevers 2014/06/10 17:56:45 fixed
+ AddImeProvider(ext_ime_list);
+ localized_strings->Set("extensionImeList", ext_ime_list);
ComponentExtensionIMEManager* component_extension_manager =
input_method::InputMethodManager::Get()
@@ -129,7 +131,7 @@ void CrosLanguageOptionsHandler::GetLocalizedValues(
if (component_extension_manager->IsInitialized()) {
localized_strings->Set(
"componentExtensionImeList",
- ConvertInputMethodDescriptosToIMEList(
+ ConvertInputMethodDescriptorsToIMEList(
component_extension_manager->GetAllIMEAsInputMethodDescriptor()));
composition_extension_appended_ = true;
} else {
@@ -157,6 +159,7 @@ void CrosLanguageOptionsHandler::RegisterMessages() {
base::Unretained(this)));
}
+// static
base::ListValue* CrosLanguageOptionsHandler::GetInputMethodList(
const input_method::InputMethodDescriptors& descriptors) {
input_method::InputMethodManager* manager =
@@ -418,7 +421,7 @@ base::ListValue* CrosLanguageOptionsHandler::GetUILanguageList(
}
base::ListValue*
- CrosLanguageOptionsHandler::ConvertInputMethodDescriptosToIMEList(
+ CrosLanguageOptionsHandler::ConvertInputMethodDescriptorsToIMEList(
const input_method::InputMethodDescriptors& descriptors) {
scoped_ptr<base::ListValue> ime_ids_list(new base::ListValue());
for (size_t i = 0; i < descriptors.size(); ++i) {
@@ -519,7 +522,7 @@ void CrosLanguageOptionsHandler::OnImeComponentExtensionInitialized() {
DCHECK(manager->IsInitialized());
scoped_ptr<base::ListValue> ime_list(
- ConvertInputMethodDescriptosToIMEList(
+ ConvertInputMethodDescriptorsToIMEList(
manager->GetAllIMEAsInputMethodDescriptor()));
web_ui()->CallJavascriptFunction(
"options.LanguageOptions.onComponentManagerInitialized",
@@ -542,7 +545,7 @@ void CrosLanguageOptionsHandler::InitializePage() {
}
scoped_ptr<base::ListValue> ime_list(
- ConvertInputMethodDescriptosToIMEList(
+ ConvertInputMethodDescriptorsToIMEList(
component_extension_manager->GetAllIMEAsInputMethodDescriptor()));
web_ui()->CallJavascriptFunction(
"options.LanguageOptions.onComponentManagerInitialized",
@@ -550,5 +553,22 @@ void CrosLanguageOptionsHandler::InitializePage() {
composition_extension_appended_ = true;
}
+void CrosLanguageOptionsHandler::AddImeProvider(base::ListValue* list) {
+ Profile* profile = Profile::FromWebUI(web_ui());
+ ExtensionService* extension_service = profile->GetExtensionService();
+ for (size_t i = 0; i < list->GetSize(); i++) {
+ base::DictionaryValue* entry;
+ list->GetDictionary(i, &entry);
Dan Beam 2014/06/09 21:37:36 nit: \n
kevers 2014/06/10 17:56:45 Done.
+ std::string input_method_id;
+ entry->GetString("id", &input_method_id);
Dan Beam 2014/06/09 21:37:36 nit: \n
kevers 2014/06/10 17:56:44 Done.
+ std::string extension_id =
+ extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id);
+ const extensions::Extension* extension =
+ extension_service->GetExtensionById(extension_id, false);
+ if (extension)
+ entry->SetString("extensionName", extension->name());
+ }
+}
+
} // namespace options
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698