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" |
11 #include "ash/desktop_background/user_wallpaper_delegate.h" | 11 #include "ash/desktop_background/user_wallpaper_delegate.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/debug/trace_event.h" | 16 #include "base/debug/trace_event.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
19 #include "base/strings/string_split.h" | |
19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
20 #include "base/threading/thread_restrictions.h" | 21 #include "base/threading/thread_restrictions.h" |
21 #include "base/time/time.h" | 22 #include "base/time/time.h" |
22 #include "base/values.h" | 23 #include "base/values.h" |
23 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/browser_shutdown.h" | 25 #include "chrome/browser/browser_shutdown.h" |
25 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
26 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
27 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 28 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
28 #include "chrome/browser/chromeos/base/locale_util.h" | 29 #include "chrome/browser/chromeos/base/locale_util.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
54 #include "chrome/browser/lifetime/application_lifetime.h" | 55 #include "chrome/browser/lifetime/application_lifetime.h" |
55 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 56 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
56 #include "chrome/common/chrome_constants.h" | 57 #include "chrome/common/chrome_constants.h" |
57 #include "chrome/common/chrome_switches.h" | 58 #include "chrome/common/chrome_switches.h" |
58 #include "chrome/common/pref_names.h" | 59 #include "chrome/common/pref_names.h" |
59 #include "chromeos/audio/chromeos_sounds.h" | 60 #include "chromeos/audio/chromeos_sounds.h" |
60 #include "chromeos/chromeos_constants.h" | 61 #include "chromeos/chromeos_constants.h" |
61 #include "chromeos/chromeos_switches.h" | 62 #include "chromeos/chromeos_switches.h" |
62 #include "chromeos/dbus/dbus_thread_manager.h" | 63 #include "chromeos/dbus/dbus_thread_manager.h" |
63 #include "chromeos/dbus/session_manager_client.h" | 64 #include "chromeos/dbus/session_manager_client.h" |
65 #include "chromeos/ime/extension_ime_util.h" | |
64 #include "chromeos/ime/input_method_manager.h" | 66 #include "chromeos/ime/input_method_manager.h" |
65 #include "chromeos/login/login_state.h" | 67 #include "chromeos/login/login_state.h" |
66 #include "chromeos/settings/timezone_settings.h" | 68 #include "chromeos/settings/timezone_settings.h" |
67 #include "content/public/browser/notification_service.h" | 69 #include "content/public/browser/notification_service.h" |
68 #include "content/public/browser/notification_types.h" | 70 #include "content/public/browser/notification_types.h" |
69 #include "content/public/browser/web_contents.h" | 71 #include "content/public/browser/web_contents.h" |
70 #include "content/public/browser/web_contents_view.h" | 72 #include "content/public/browser/web_contents_view.h" |
71 #include "content/public/browser/web_ui.h" | 73 #include "content/public/browser/web_ui.h" |
72 #include "grit/browser_resources.h" | 74 #include "grit/browser_resources.h" |
73 #include "media/audio/sounds/sounds_manager.h" | 75 #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; | 122 const int64 kPolicyServiceInitializationDelayMilliseconds = 100; |
121 | 123 |
122 // Determines the hardware keyboard from the given locale code | 124 // Determines the hardware keyboard from the given locale code |
123 // and the OEM layout information, and saves it to "Locale State". | 125 // and the OEM layout information, and saves it to "Locale State". |
124 // The information will be used in InputMethodUtil::GetHardwareInputMethodId(). | 126 // The information will be used in InputMethodUtil::GetHardwareInputMethodId(). |
125 void DetermineAndSaveHardwareKeyboard(const std::string& locale, | 127 void DetermineAndSaveHardwareKeyboard(const std::string& locale, |
126 const std::string& oem_layout) { | 128 const std::string& oem_layout) { |
127 std::string layout; | 129 std::string layout; |
128 if (!oem_layout.empty()) { | 130 if (!oem_layout.empty()) { |
129 // If the OEM layout information is provided, use it. | 131 // If the OEM layout information is provided, use it. |
130 layout = oem_layout; | 132 std::vector<std::string> layouts; |
133 base::SplitString(oem_layout, ',', &layouts); | |
134 layout = chromeos::extension_ime_util::GetInputMethodIDByKeyboardLayout( | |
135 layouts[0]); | |
Seigo Nonaka
2014/02/28 08:00:00
Please use all listed layouts.
And I think putting
Shu Chen
2014/02/28 08:24:19
Done.
| |
131 } else { | 136 } else { |
132 chromeos::input_method::InputMethodManager* manager = | 137 chromeos::input_method::InputMethodManager* manager = |
133 chromeos::input_method::InputMethodManager::Get(); | 138 chromeos::input_method::InputMethodManager::Get(); |
134 // Otherwise, determine the hardware keyboard from the locale. | 139 // Otherwise, determine the hardware keyboard from the locale. |
135 std::vector<std::string> input_method_ids; | 140 std::vector<std::string> input_method_ids; |
136 if (manager->GetInputMethodUtil()->GetInputMethodIdsFromLanguageCode( | 141 if (manager->GetInputMethodUtil()->GetInputMethodIdsFromLanguageCode( |
137 locale, | 142 locale, |
138 chromeos::input_method::kKeyboardLayoutsOnly, | 143 chromeos::input_method::kKeyboardLayoutsOnly, |
139 &input_method_ids)) { | 144 &input_method_ids)) { |
140 // The output list |input_method_ids| is sorted by popularity, hence | 145 // 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( | 1218 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
1214 new locale_util::SwitchLanguageCallback( | 1219 new locale_util::SwitchLanguageCallback( |
1215 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); | 1220 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); |
1216 | 1221 |
1217 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1222 // Load locale keyboards here. Hardware layout would be automatically enabled. |
1218 locale_util::SwitchLanguage( | 1223 locale_util::SwitchLanguage( |
1219 locale, true, true /* login_layouts_only */, callback.Pass()); | 1224 locale, true, true /* login_layouts_only */, callback.Pass()); |
1220 } | 1225 } |
1221 | 1226 |
1222 } // namespace chromeos | 1227 } // namespace chromeos |
OLD | NEW |