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

Side by Side Diff: chrome/browser/chromeos/login/ui/login_display_host_impl.cc

Issue 312453002: Migrates Japanese IME IDs and stop migrating Chinese IME IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/login_display_host_impl.h" 5 #include "chrome/browser/chromeos/login/ui/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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const char kWebUIInitPostpone[] = "postpone"; 126 const char kWebUIInitPostpone[] = "postpone";
127 127
128 // The delay of triggering initialization of the device policy subsystem 128 // The delay of triggering initialization of the device policy subsystem
129 // after the login screen is initialized. This makes sure that device policy 129 // after the login screen is initialized. This makes sure that device policy
130 // network requests are made while the system is idle waiting for user input. 130 // network requests are made while the system is idle waiting for user input.
131 const int64 kPolicyServiceInitializationDelayMilliseconds = 100; 131 const int64 kPolicyServiceInitializationDelayMilliseconds = 100;
132 132
133 // Determines the hardware keyboard from the given locale code 133 // Determines the hardware keyboard from the given locale code
134 // and the OEM layout information, and saves it to "Locale State". 134 // and the OEM layout information, and saves it to "Locale State".
135 // The information will be used in InputMethodUtil::GetHardwareInputMethodId(). 135 // The information will be used in InputMethodUtil::GetHardwareInputMethodId().
136 void DetermineAndSaveHardwareKeyboard(const std::string& locale, 136 void DetermineAndSaveHardwareKeyboard(const std::string& locale,
Nikita (slow) 2014/06/02 06:24:20 nit: How about moving this utility method somewher
Shu Chen 2014/06/02 09:49:17 OK. I've create crbug.com/379696 for it.
137 const std::string& oem_layout) { 137 const std::string& oem_layout) {
138 chromeos::input_method::InputMethodManager* manager = 138 chromeos::input_method::InputMethodManager* manager =
139 chromeos::input_method::InputMethodManager::Get(); 139 chromeos::input_method::InputMethodManager::Get();
140 std::string layout; 140 std::string layout;
141 if (!oem_layout.empty()) { 141 if (!oem_layout.empty()) {
142 // If the OEM layout information is provided, use it. 142 // If the OEM layout information is provided, use it.
143 layout = oem_layout; 143 layout = oem_layout;
144 } else { 144 } else {
145 // Otherwise, determine the hardware keyboard from the locale. 145 // Otherwise, determine the hardware keyboard from the locale.
146 std::vector<std::string> input_method_ids; 146 std::vector<std::string> input_method_ids;
147 if (manager->GetInputMethodUtil()->GetInputMethodIdsFromLanguageCode( 147 if (manager->GetInputMethodUtil()->GetInputMethodIdsFromLanguageCode(
148 locale, 148 locale,
149 chromeos::input_method::kKeyboardLayoutsOnly, 149 chromeos::input_method::kKeyboardLayoutsOnly,
150 &input_method_ids)) { 150 &input_method_ids)) {
151 // The output list |input_method_ids| is sorted by popularity, hence 151 // The output list |input_method_ids| is sorted by popularity, hence
152 // input_method_ids[0] now contains the most popular keyboard layout 152 // input_method_ids[0] now contains the most popular keyboard layout
153 // for the given locale. 153 // for the given locale.
154 layout = input_method_ids[0]; 154 layout = input_method_ids[0];
155 } 155 }
156 } 156 }
157 157
158 if (!layout.empty()) { 158 if (!layout.empty()) {
159 std::vector<std::string> layouts; 159 std::vector<std::string> layouts;
160 base::SplitString(layout, ',', &layouts); 160 base::SplitString(layout, ',', &layouts);
161 manager->MigrateXkbInputMethods(&layouts); 161 manager->MigrateInputMethods(&layouts);
162 162
163 PrefService* prefs = g_browser_process->local_state(); 163 PrefService* prefs = g_browser_process->local_state();
164 prefs->SetString(prefs::kHardwareKeyboardLayout, JoinString(layouts, ",")); 164 prefs->SetString(prefs::kHardwareKeyboardLayout, JoinString(layouts, ","));
165 165
166 // This asks the file thread to save the prefs (i.e. doesn't block). 166 // This asks the file thread to save the prefs (i.e. doesn't block).
167 // The latest values of Local State reside in memory so we can safely 167 // The latest values of Local State reside in memory so we can safely
168 // get the value of kHardwareKeyboardLayout even if the data is not 168 // get the value of kHardwareKeyboardLayout even if the data is not
169 // yet saved to disk. 169 // yet saved to disk.
170 prefs->CommitPendingWrite(); 170 prefs->CommitPendingWrite();
171 171
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 scoped_ptr<locale_util::SwitchLanguageCallback> callback( 1302 scoped_ptr<locale_util::SwitchLanguageCallback> callback(
1303 new locale_util::SwitchLanguageCallback( 1303 new locale_util::SwitchLanguageCallback(
1304 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass())))); 1304 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))));
1305 1305
1306 // Load locale keyboards here. Hardware layout would be automatically enabled. 1306 // Load locale keyboards here. Hardware layout would be automatically enabled.
1307 locale_util::SwitchLanguage( 1307 locale_util::SwitchLanguage(
1308 locale, true, true /* login_layouts_only */, callback.Pass()); 1308 locale, true, true /* login_layouts_only */, callback.Pass());
1309 } 1309 }
1310 1310
1311 } // namespace chromeos 1311 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/mock_input_method_manager.cc ('k') | chrome/browser/chromeos/preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698