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

Unified Diff: chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc

Issue 178343005: [IME] migrate the xkb ID to extension based xkb ID. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 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/chromeos/login/network_screen_handler.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
index 87f0abf6d146eefc655e49c14100fb850b25063c..ad83f47b7d7df0862b32970708db3e1cfbe388ff 100644
--- a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.h"
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_switches.h"
+#include "chromeos/ime/extension_ime_util.h"
#include "chromeos/ime/input_method_manager.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -391,7 +392,15 @@ base::ListValue* NetworkScreenHandler::GetInputMethods() {
input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
scoped_ptr<input_method::InputMethodDescriptors> input_methods(
manager->GetActiveInputMethods());
- std::string current_input_method_id = manager->GetCurrentInputMethod().id();
+ // Uses extension_ime_util::MaybeGetLegacyXkbId() to make sure the input
+ // method id is in legacy xkb id format (e.g. xkb:us::eng), instead of
+ // extension based xkd id format (e.g. _comp_ime_...xkb:us::eng).
+ // Same for the rests.
+ // TODO(shuchen): support wait for component extension loading, and then show
+ // OOBE window. So that extension_ime_util::MaybeGetLegacyXkbId() can be
+ // removed.
+ std::string current_input_method_id = extension_ime_util::MaybeGetLegacyXkbId(
+ manager->GetCurrentInputMethod().id());
const std::vector<std::string>& hardware_login_input_methods =
util->GetHardwareLoginInputMethodIds();
std::set<std::string> input_methods_added;
@@ -400,9 +409,11 @@ base::ListValue* NetworkScreenHandler::GetInputMethods() {
hardware_login_input_methods.begin();
i != hardware_login_input_methods.end();
++i) {
- input_methods_added.insert(*i);
+ // Makes sure the id is in legacy xkb id format.
+ const std::string id = extension_ime_util::MaybeGetLegacyXkbId(*i);
+ input_methods_added.insert(id);
const input_method::InputMethodDescriptor* ime =
- util->GetInputMethodDescriptorFromId(*i);
+ util->GetInputMethodDescriptorFromId(id);
DCHECK(ime != NULL);
// Do not crash in case of misconfiguration.
if (ime != NULL) {
@@ -413,7 +424,9 @@ base::ListValue* NetworkScreenHandler::GetInputMethods() {
bool optgroup_added = false;
for (size_t i = 0; i < input_methods->size(); ++i) {
- const std::string& ime_id = input_methods->at(i).id();
+ // Makes sure the id is in legacy xkb id format.
+ const std::string& ime_id = extension_ime_util::MaybeGetLegacyXkbId(
+ input_methods->at(i).id());
Yuki 2014/03/04 04:04:45 Please do not use std::vector::at() even though th
Shu Chen 2014/03/04 04:45:02 Done.
if (!InsertString(ime_id, input_methods_added))
continue;
if (!optgroup_added) {

Powered by Google App Engine
This is Rietveld 408576698