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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/login/ui/user_adding_screen_input_methods_controller.h"
7 #include "components/user_manager/user_manager.h"
11 UserAddingScreenInputMethodsController::UserAddingScreenInputMethodsController(
12 UserAddingScreen
* screen
)
13 : screen_(screen
), active_user_on_show_(NULL
) {
14 screen_
->AddObserver(this);
17 UserAddingScreenInputMethodsController::
18 ~UserAddingScreenInputMethodsController() {
19 screen_
->RemoveObserver(this);
22 void UserAddingScreenInputMethodsController::OnUserAddingStarted() {
23 active_user_on_show_
= user_manager::UserManager::Get()->GetActiveUser();
24 input_method::InputMethodManager
* imm
=
25 input_method::InputMethodManager::Get();
26 saved_ime_state_
= imm
->GetActiveIMEState();
27 imm
->SetState(saved_ime_state_
->Clone());
28 imm
->GetActiveIMEState()->EnableLockScreenLayouts();
31 void UserAddingScreenInputMethodsController::OnUserAddingFinished() {
32 if (user_manager::UserManager::Get()->GetActiveUser() == active_user_on_show_
)
33 input_method::InputMethodManager::Get()->SetState(saved_ime_state_
);
35 saved_ime_state_
= NULL
;
38 } // namespace chromeos