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

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

Issue 419293002: IME refactoring: ChromeOS introduce input methods State. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 6 years, 4 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/ui/webui/chromeos/login/signin_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 DictionaryPrefUpdate updater(local_state, prefs::kUsersLRUInputMethod); 209 DictionaryPrefUpdate updater(local_state, prefs::kUsersLRUInputMethod);
210 210
211 base::DictionaryValue* const users_lru_input_methods = updater.Get(); 211 base::DictionaryValue* const users_lru_input_methods = updater.Get();
212 if (users_lru_input_methods != NULL) { 212 if (users_lru_input_methods != NULL) {
213 users_lru_input_methods->SetStringWithoutPathExpansion(username, ""); 213 users_lru_input_methods->SetStringWithoutPathExpansion(username, "");
214 } 214 }
215 return false; 215 return false;
216 } 216 }
217 217
218 if (!Contains(manager->GetActiveInputMethodIds(), input_method)) { 218 if (!Contains(manager->GetActiveIMEState()->GetActiveInputMethodIds(),
219 if (!manager->EnableInputMethod(input_method)) { 219 input_method)) {
220 if (!manager->GetActiveIMEState()->EnableInputMethod(input_method)) {
220 DLOG(ERROR) << "SigninScreenHandler::SetUserInputMethod('" << username 221 DLOG(ERROR) << "SigninScreenHandler::SetUserInputMethod('" << username
221 << "'): user input method '" << input_method 222 << "'): user input method '" << input_method
222 << "' is not enabled and enabling failed (ignored!)."; 223 << "' is not enabled and enabling failed (ignored!).";
223 } 224 }
224 } 225 }
225 manager->ChangeInputMethod(input_method); 226 manager->GetActiveIMEState()->ChangeInputMethod(input_method,
227 false /* show_message */);
226 228
227 return true; 229 return true;
228 } 230 }
229 231
230 } // namespace 232 } // namespace
231 233
232 // LoginScreenContext implementation ------------------------------------------ 234 // LoginScreenContext implementation ------------------------------------------
233 235
234 LoginScreenContext::LoginScreenContext() { 236 LoginScreenContext::LoginScreenContext() {
235 Init(); 237 Init();
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 1013
1012 const bool succeed = SetUserInputMethodImpl(username, manager); 1014 const bool succeed = SetUserInputMethodImpl(username, manager);
1013 1015
1014 // This is also a case when LRU layout is set only for a few local users, 1016 // This is also a case when LRU layout is set only for a few local users,
1015 // thus others need to be switched to default locale. 1017 // thus others need to be switched to default locale.
1016 // Otherwise they will end up using another user's locale to log in. 1018 // Otherwise they will end up using another user's locale to log in.
1017 if (!succeed) { 1019 if (!succeed) {
1018 DVLOG(0) << "SetUserInputMethod('" << username 1020 DVLOG(0) << "SetUserInputMethod('" << username
1019 << "'): failed to set user layout. Switching to default."; 1021 << "'): failed to set user layout. Switching to default.";
1020 1022
1021 manager->SetInputMethodLoginDefault(); 1023 manager->GetActiveIMEState()->SetInputMethodLoginDefault();
1022 } 1024 }
1023 } 1025 }
1024 1026
1025 1027
1026 void SigninScreenHandler::UserSettingsChanged() { 1028 void SigninScreenHandler::UserSettingsChanged() {
1027 DCHECK(gaia_screen_handler_); 1029 DCHECK(gaia_screen_handler_);
1028 GaiaContext context; 1030 GaiaContext context;
1029 if (delegate_) 1031 if (delegate_)
1030 context.has_users = !delegate_->GetUsers().empty(); 1032 context.has_users = !delegate_->GetUsers().empty();
1031 gaia_screen_handler_->UpdateGaia(context); 1033 gaia_screen_handler_->UpdateGaia(context);
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 return gaia_screen_handler_->frame_error(); 1497 return gaia_screen_handler_->frame_error();
1496 } 1498 }
1497 1499
1498 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { 1500 void SigninScreenHandler::OnCapsLockChanged(bool enabled) {
1499 caps_lock_enabled_ = enabled; 1501 caps_lock_enabled_ = enabled;
1500 if (page_is_ready()) 1502 if (page_is_ready())
1501 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); 1503 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_);
1502 } 1504 }
1503 1505
1504 } // namespace chromeos 1506 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698