Index: chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
index 5a41b15ef0156f77d7599952704fe86993c176f9..7078f78b3667a1bbfe21688bca16270913ae8a01 100644 |
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
@@ -10,8 +10,10 @@ |
#include "base/bind.h" |
#include "base/location.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/prefs/pref_service.h" |
#include "base/strings/string_util.h" |
#include "base/strings/stringprintf.h" |
+#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chromeos/input_method/candidate_window_controller.h" |
#include "chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.h" |
#include "chrome/browser/chromeos/input_method/input_method_engine_ibus.h" |
@@ -668,6 +670,24 @@ void InputMethodManagerImpl::SetEnabledExtensionImes( |
} |
} |
+void InputMethodManagerImpl::SetInputMethodDefault() { |
+ // Set up keyboards. For example, when |locale| is "en-US", enable US qwerty |
+ // and US dvorak keyboard layouts. |
+ if (g_browser_process && g_browser_process->local_state()) { |
+ const std::string locale = g_browser_process->GetApplicationLocale(); |
+ // If the preferred keyboard for the login screen has been saved, use it. |
+ PrefService* prefs = g_browser_process->local_state(); |
+ std::string initial_input_method_id = |
+ prefs->GetString(chromeos::language_prefs::kPreferredKeyboardLayout); |
+ if (initial_input_method_id.empty()) { |
+ // If kPreferredKeyboardLayout is not specified, use the hardware layout. |
+ initial_input_method_id = |
+ GetInputMethodUtil()->GetHardwareInputMethodId(); |
+ } |
+ EnableLayouts(locale, initial_input_method_id); |
+ } |
+} |
+ |
bool InputMethodManagerImpl::SwitchToNextInputMethod() { |
// Sanity checks. |
if (active_input_method_ids_.empty()) { |