Index: chrome/browser/chromeos/input_method/input_method_util.cc |
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc |
index 6946a8b59bd787791343836784b99b25b4ca2264..75603f1e7923885c8b45556e9a4cda0331336e17 100644 |
--- a/chrome/browser/chromeos/input_method/input_method_util.cc |
+++ b/chrome/browser/chromeos/input_method/input_method_util.cc |
@@ -614,25 +614,37 @@ std::string InputMethodUtil::GetLanguageDefaultInputMethodId( |
return std::string(); |
} |
-std::string InputMethodUtil::GetHardwareInputMethodId() const { |
- const std::string input_method_id = delegate_->GetHardwareKeyboardLayout(); |
- |
- if (input_method_id.empty()) { |
+void InputMethodUtil::UpdateHardwareLayoutCache() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ hardware_layouts_.clear(); |
+ hardware_login_layouts_.clear(); |
+ Tokenize(delegate_->GetHardwareKeyboardLayouts(), ",", &hardware_layouts_); |
+ |
+ for (size_t i = 0; i < hardware_layouts_.size(); ++i) { |
+ if (IsLoginKeyboard(hardware_layouts_[i])) |
+ hardware_login_layouts_.push_back(hardware_layouts_[i]); |
+ } |
+ if (hardware_layouts_.empty()) { |
// This is totally fine if it's empty. The hardware keyboard layout is |
// not stored if startup_manifest.json (OEM customization data) is not |
// present (ex. Cr48 doen't have that file). |
- return GetFallbackInputMethodDescriptor().id(); |
+ hardware_layouts_.push_back(GetFallbackInputMethodDescriptor().id()); |
} |
- return input_method_id; |
-} |
-std::string InputMethodUtil::GetHardwareLoginInputMethodId() const { |
- const std::string input_method_id = GetHardwareInputMethodId(); |
+ if (hardware_login_layouts_.empty()) |
+ hardware_login_layouts_.push_back(GetFallbackInputMethodDescriptor().id()); |
+} |
- if (!IsLoginKeyboard(input_method_id)) |
- return GetFallbackInputMethodDescriptor().id(); |
+const std::vector<std::string>& |
+ InputMethodUtil::GetHardwareInputMethodIds() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ return hardware_layouts_; |
+} |
- return input_method_id; |
+const std::vector<std::string>& |
+ InputMethodUtil::GetHardwareLoginInputMethodIds() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ return hardware_login_layouts_; |
} |
bool InputMethodUtil::IsLoginKeyboard(const std::string& input_method_id) |