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

Side by Side Diff: chrome/browser/chromeos/login/login_display_host_impl.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, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
53 #include "chrome/browser/lifetime/application_lifetime.h" 54 #include "chrome/browser/lifetime/application_lifetime.h"
54 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 55 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
55 #include "chrome/common/chrome_constants.h" 56 #include "chrome/common/chrome_constants.h"
56 #include "chrome/common/chrome_switches.h" 57 #include "chrome/common/chrome_switches.h"
57 #include "chrome/common/pref_names.h" 58 #include "chrome/common/pref_names.h"
58 #include "chromeos/audio/chromeos_sounds.h" 59 #include "chromeos/audio/chromeos_sounds.h"
59 #include "chromeos/chromeos_constants.h" 60 #include "chromeos/chromeos_constants.h"
60 #include "chromeos/chromeos_switches.h" 61 #include "chromeos/chromeos_switches.h"
61 #include "chromeos/dbus/dbus_thread_manager.h" 62 #include "chromeos/dbus/dbus_thread_manager.h"
62 #include "chromeos/dbus/session_manager_client.h" 63 #include "chromeos/dbus/session_manager_client.h"
64 #include "chromeos/ime/extension_ime_util.h"
63 #include "chromeos/ime/input_method_manager.h" 65 #include "chromeos/ime/input_method_manager.h"
64 #include "chromeos/login/login_state.h" 66 #include "chromeos/login/login_state.h"
65 #include "chromeos/settings/timezone_settings.h" 67 #include "chromeos/settings/timezone_settings.h"
66 #include "content/public/browser/notification_service.h" 68 #include "content/public/browser/notification_service.h"
67 #include "content/public/browser/notification_types.h" 69 #include "content/public/browser/notification_types.h"
68 #include "content/public/browser/web_contents.h" 70 #include "content/public/browser/web_contents.h"
69 #include "content/public/browser/web_contents_view.h" 71 #include "content/public/browser/web_contents_view.h"
70 #include "content/public/browser/web_ui.h" 72 #include "content/public/browser/web_ui.h"
71 #include "grit/browser_resources.h" 73 #include "grit/browser_resources.h"
72 #include "media/audio/sounds/sounds_manager.h" 74 #include "media/audio/sounds/sounds_manager.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // The delay of triggering initialization of the device policy subsystem 118 // The delay of triggering initialization of the device policy subsystem
117 // after the login screen is initialized. This makes sure that device policy 119 // after the login screen is initialized. This makes sure that device policy
118 // network requests are made while the system is idle waiting for user input. 120 // network requests are made while the system is idle waiting for user input.
119 const int64 kPolicyServiceInitializationDelayMilliseconds = 100; 121 const int64 kPolicyServiceInitializationDelayMilliseconds = 100;
120 122
121 // Determines the hardware keyboard from the given locale code 123 // Determines the hardware keyboard from the given locale code
122 // and the OEM layout information, and saves it to "Locale State". 124 // and the OEM layout information, and saves it to "Locale State".
123 // The information will be used in InputMethodUtil::GetHardwareInputMethodId(). 125 // The information will be used in InputMethodUtil::GetHardwareInputMethodId().
124 void DetermineAndSaveHardwareKeyboard(const std::string& locale, 126 void DetermineAndSaveHardwareKeyboard(const std::string& locale,
125 const std::string& oem_layout) { 127 const std::string& oem_layout) {
128 chromeos::input_method::InputMethodManager* manager =
129 chromeos::input_method::InputMethodManager::Get();
126 std::string layout; 130 std::string layout;
127 if (!oem_layout.empty()) { 131 if (!oem_layout.empty()) {
128 // If the OEM layout information is provided, use it. 132 // If the OEM layout information is provided, use it.
129 layout = oem_layout; 133 layout = oem_layout;
130 } else { 134 } else {
131 chromeos::input_method::InputMethodManager* manager =
132 chromeos::input_method::InputMethodManager::Get();
133 // Otherwise, determine the hardware keyboard from the locale. 135 // Otherwise, determine the hardware keyboard from the locale.
134 std::vector<std::string> input_method_ids; 136 std::vector<std::string> input_method_ids;
135 if (manager->GetInputMethodUtil()->GetInputMethodIdsFromLanguageCode( 137 if (manager->GetInputMethodUtil()->GetInputMethodIdsFromLanguageCode(
136 locale, 138 locale,
137 chromeos::input_method::kKeyboardLayoutsOnly, 139 chromeos::input_method::kKeyboardLayoutsOnly,
138 &input_method_ids)) { 140 &input_method_ids)) {
139 // The output list |input_method_ids| is sorted by popularity, hence 141 // The output list |input_method_ids| is sorted by popularity, hence
140 // input_method_ids[0] now contains the most popular keyboard layout 142 // input_method_ids[0] now contains the most popular keyboard layout
141 // for the given locale. 143 // for the given locale.
142 layout = input_method_ids[0]; 144 layout = input_method_ids[0];
143 } 145 }
144 } 146 }
145 147
146 if (!layout.empty()) { 148 if (!layout.empty()) {
149 std::vector<std::string> layouts;
150 base::SplitString(layout, ',', &layouts);
151 manager->MigrateXkbInputMethods(&layouts);
152
147 PrefService* prefs = g_browser_process->local_state(); 153 PrefService* prefs = g_browser_process->local_state();
148 prefs->SetString(prefs::kHardwareKeyboardLayout, layout); 154 prefs->SetString(prefs::kHardwareKeyboardLayout, JoinString(layouts, ","));
149 155
150 // This asks the file thread to save the prefs (i.e. doesn't block). 156 // This asks the file thread to save the prefs (i.e. doesn't block).
151 // The latest values of Local State reside in memory so we can safely 157 // The latest values of Local State reside in memory so we can safely
152 // get the value of kHardwareKeyboardLayout even if the data is not 158 // get the value of kHardwareKeyboardLayout even if the data is not
153 // yet saved to disk. 159 // yet saved to disk.
154 prefs->CommitPendingWrite(); 160 prefs->CommitPendingWrite();
155 161
156 chromeos::input_method::InputMethodManager* manager = 162 chromeos::input_method::InputMethodManager* manager =
Yuki 2014/03/04 04:04:45 Remove this line, otherwise use a different name o
Shu Chen 2014/03/04 04:45:02 Done.
157 chromeos::input_method::InputMethodManager::Get(); 163 chromeos::input_method::InputMethodManager::Get();
158 manager->GetInputMethodUtil()->UpdateHardwareLayoutCache(); 164 manager->GetInputMethodUtil()->UpdateHardwareLayoutCache();
159 manager->SetInputMethodLoginDefault(); 165 manager->SetInputMethodLoginDefault();
160 } 166 }
161 } 167 }
162 168
163 // A class to observe an implicit animation and invokes the callback after the 169 // A class to observe an implicit animation and invokes the callback after the
164 // animation is completed. 170 // animation is completed.
165 class AnimationObserver : public ui::ImplicitAnimationObserver { 171 class AnimationObserver : public ui::ImplicitAnimationObserver {
166 public: 172 public:
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 scoped_ptr<locale_util::SwitchLanguageCallback> callback( 1215 scoped_ptr<locale_util::SwitchLanguageCallback> callback(
1210 new locale_util::SwitchLanguageCallback( 1216 new locale_util::SwitchLanguageCallback(
1211 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); 1217 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))));
1212 1218
1213 // Load locale keyboards here. Hardware layout would be automatically enabled. 1219 // Load locale keyboards here. Hardware layout would be automatically enabled.
1214 locale_util::SwitchLanguage( 1220 locale_util::SwitchLanguage(
1215 locale, true, true /* login_layouts_only */, callback.Pass()); 1221 locale, true, true /* login_layouts_only */, callback.Pass());
1216 } 1222 }
1217 1223
1218 } // namespace chromeos 1224 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698