| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 5 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/audio/sounds.h" | 9 #include "ash/audio/sounds.h" |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "chrome/browser/lifetime/application_lifetime.h" | 54 #include "chrome/browser/lifetime/application_lifetime.h" |
| 55 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 55 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 56 #include "chrome/common/chrome_constants.h" | 56 #include "chrome/common/chrome_constants.h" |
| 57 #include "chrome/common/chrome_switches.h" | 57 #include "chrome/common/chrome_switches.h" |
| 58 #include "chrome/common/pref_names.h" | 58 #include "chrome/common/pref_names.h" |
| 59 #include "chromeos/audio/chromeos_sounds.h" | 59 #include "chromeos/audio/chromeos_sounds.h" |
| 60 #include "chromeos/chromeos_constants.h" | 60 #include "chromeos/chromeos_constants.h" |
| 61 #include "chromeos/chromeos_switches.h" | 61 #include "chromeos/chromeos_switches.h" |
| 62 #include "chromeos/dbus/dbus_thread_manager.h" | 62 #include "chromeos/dbus/dbus_thread_manager.h" |
| 63 #include "chromeos/dbus/session_manager_client.h" | 63 #include "chromeos/dbus/session_manager_client.h" |
| 64 #include "chromeos/ime/extension_ime_util.h" |
| 64 #include "chromeos/ime/input_method_manager.h" | 65 #include "chromeos/ime/input_method_manager.h" |
| 65 #include "chromeos/login/login_state.h" | 66 #include "chromeos/login/login_state.h" |
| 66 #include "chromeos/settings/timezone_settings.h" | 67 #include "chromeos/settings/timezone_settings.h" |
| 67 #include "content/public/browser/notification_service.h" | 68 #include "content/public/browser/notification_service.h" |
| 68 #include "content/public/browser/notification_types.h" | 69 #include "content/public/browser/notification_types.h" |
| 69 #include "content/public/browser/web_contents.h" | 70 #include "content/public/browser/web_contents.h" |
| 70 #include "content/public/browser/web_contents_view.h" | 71 #include "content/public/browser/web_contents_view.h" |
| 71 #include "content/public/browser/web_ui.h" | 72 #include "content/public/browser/web_ui.h" |
| 72 #include "grit/browser_resources.h" | 73 #include "grit/browser_resources.h" |
| 73 #include "media/audio/sounds/sounds_manager.h" | 74 #include "media/audio/sounds/sounds_manager.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 const int64 kPolicyServiceInitializationDelayMilliseconds = 100; | 121 const int64 kPolicyServiceInitializationDelayMilliseconds = 100; |
| 121 | 122 |
| 122 // Determines the hardware keyboard from the given locale code | 123 // Determines the hardware keyboard from the given locale code |
| 123 // and the OEM layout information, and saves it to "Locale State". | 124 // and the OEM layout information, and saves it to "Locale State". |
| 124 // The information will be used in InputMethodUtil::GetHardwareInputMethodId(). | 125 // The information will be used in InputMethodUtil::GetHardwareInputMethodId(). |
| 125 void DetermineAndSaveHardwareKeyboard(const std::string& locale, | 126 void DetermineAndSaveHardwareKeyboard(const std::string& locale, |
| 126 const std::string& oem_layout) { | 127 const std::string& oem_layout) { |
| 127 std::string layout; | 128 std::string layout; |
| 128 if (!oem_layout.empty()) { | 129 if (!oem_layout.empty()) { |
| 129 // If the OEM layout information is provided, use it. | 130 // If the OEM layout information is provided, use it. |
| 130 layout = oem_layout; | 131 layout = chromeos::extension_ime_util::GetInputMethodIDByKeyboardLayout( |
| 132 oem_layout); |
| 131 } else { | 133 } else { |
| 132 chromeos::input_method::InputMethodManager* manager = | 134 chromeos::input_method::InputMethodManager* manager = |
| 133 chromeos::input_method::InputMethodManager::Get(); | 135 chromeos::input_method::InputMethodManager::Get(); |
| 134 // Otherwise, determine the hardware keyboard from the locale. | 136 // Otherwise, determine the hardware keyboard from the locale. |
| 135 std::vector<std::string> input_method_ids; | 137 std::vector<std::string> input_method_ids; |
| 136 if (manager->GetInputMethodUtil()->GetInputMethodIdsFromLanguageCode( | 138 if (manager->GetInputMethodUtil()->GetInputMethodIdsFromLanguageCode( |
| 137 locale, | 139 locale, |
| 138 chromeos::input_method::kKeyboardLayoutsOnly, | 140 chromeos::input_method::kKeyboardLayoutsOnly, |
| 139 &input_method_ids)) { | 141 &input_method_ids)) { |
| 140 // The output list |input_method_ids| is sorted by popularity, hence | 142 // The output list |input_method_ids| is sorted by popularity, hence |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 1215 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
| 1214 new locale_util::SwitchLanguageCallback( | 1216 new locale_util::SwitchLanguageCallback( |
| 1215 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); | 1217 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); |
| 1216 | 1218 |
| 1217 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1219 // Load locale keyboards here. Hardware layout would be automatically enabled. |
| 1218 locale_util::SwitchLanguage( | 1220 locale_util::SwitchLanguage( |
| 1219 locale, true, true /* login_layouts_only */, callback.Pass()); | 1221 locale, true, true /* login_layouts_only */, callback.Pass()); |
| 1220 } | 1222 } |
| 1221 | 1223 |
| 1222 } // namespace chromeos | 1224 } // namespace chromeos |
| OLD | NEW |