Commit a5a81ef6 authored by alemate's avatar alemate Committed by Commit bot

ChromeOS: "Add New User" screen should enable all hardware keyboards.

"Add New User" screen should have enabled all hardware
keyboards, owner and system input methods.

BUG=365299
TEST=manual

Review URL: https://codereview.chromium.org/484353005

Cr-Commit-Position: refs/heads/master@{#296199}
parent 043a6152
......@@ -27,24 +27,10 @@ void PersistSystemInputMethod(const std::string& input_method) {
language_prefs::kPreferredKeyboardLayout, input_method);
}
// Update user LRU keyboard layout for login screen
static void SetUserLRUInputMethod(
const std::string& input_method,
const chromeos::input_method::InputMethodManager* const manager,
Profile* profile) {
// Skip if it's not a keyboard layout. Drop input methods including
// extension ones.
if (!manager->IsLoginKeyboard(input_method))
return;
PrefService* const local_state = g_browser_process->local_state();
if (profile == NULL)
return;
const std::string username = profile->GetProfileName();
if (base::SysInfo::IsRunningOnChromeOS() && !username.empty() &&
!local_state->ReadOnly()) {
static void SetUserLRUInputMethodPreference(const std::string& username,
const std::string& input_method,
PrefService* local_state) {
if (!username.empty() && !local_state->ReadOnly()) {
bool update_succeed = false;
{
// Updater may have side-effects, therefore we do not replace
......@@ -77,6 +63,25 @@ static void SetUserLRUInputMethod(
}
}
// Update user LRU keyboard layout for login screen
static void SetUserLRUInputMethod(
const std::string& input_method,
const chromeos::input_method::InputMethodManager* const manager,
Profile* profile) {
// Skip if it's not a keyboard layout. Drop input methods including
// extension ones.
if (!manager->IsLoginKeyboard(input_method))
return;
if (profile == NULL)
return;
PrefService* const local_state = g_browser_process->local_state();
SetUserLRUInputMethodPreference(
profile->GetProfileName(), input_method, local_state);
}
void PersistUserInputMethod(const std::string& input_method,
InputMethodManager* const manager) {
PrefService* user_prefs = NULL;
......@@ -146,5 +151,11 @@ void InputMethodPersistence::OnSessionStateChange(
ui_session_ = new_ui_session;
}
void SetUserLRUInputMethodPreferenceForTesting(const std::string& username,
const std::string& input_method,
PrefService* const local_state) {
SetUserLRUInputMethodPreference(username, input_method, local_state);
}
} // namespace input_method
} // namespace chromeos
......@@ -11,6 +11,8 @@
#include "base/compiler_specific.h"
#include "chromeos/ime/input_method_manager.h"
class PrefService;
namespace chromeos {
namespace input_method {
......@@ -39,6 +41,10 @@ class InputMethodPersistence : public InputMethodManager::Observer {
DISALLOW_COPY_AND_ASSIGN(InputMethodPersistence);
};
void SetUserLRUInputMethodPreferenceForTesting(const std::string& username,
const std::string& input_method,
PrefService* local_state);
} // namespace input_method
} // namespace chromeos
......
......@@ -67,6 +67,8 @@ class LoginManagerTest : public MixinBasedBrowserTest {
content::WebContents* web_contents() { return web_contents_; }
test::JSChecker& js_checker() { return js_checker_; }
private:
void InitializeWebContents();
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/input_method/input_method_persistence.h"
#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/chromeos/login/login_manager_test.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h"
#include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_switches.h"
#include "content/public/test/test_utils.h"
namespace chromeos {
namespace {
const char kTestUser1[] = "test-user1@gmail.com";
const char kTestUser2[] = "test-user2@gmail.com";
const char kTestUser3[] = "test-user3@gmail.com";
void Append_en_US_InputMethods(std::vector<std::string>* out) {
out->push_back("xkb:us::eng");
out->push_back("xkb:us:intl:eng");
out->push_back("xkb:us:altgr-intl:eng");
out->push_back("xkb:us:dvorak:eng");
out->push_back("xkb:us:colemak:eng");
chromeos::input_method::InputMethodManager::Get()->MigrateInputMethods(out);
}
class FocusPODWaiter {
public:
FocusPODWaiter() : focused_(false), runner_(new content::MessageLoopRunner) {
GetOobeUI()
->signin_screen_handler_for_test()
->SetFocusPODCallbackForTesting(
base::Bind(&FocusPODWaiter::OnFocusPOD, base::Unretained(this)));
}
~FocusPODWaiter() {
GetOobeUI()
->signin_screen_handler_for_test()
->SetFocusPODCallbackForTesting(base::Closure());
}
void OnFocusPOD() {
focused_ = true;
if (runner_.get())
base::MessageLoopForUI::current()->PostTask(
FROM_HERE,
base::Bind(&FocusPODWaiter::ExitMessageLoop, base::Unretained(this)));
}
void ExitMessageLoop() { runner_->Quit(); }
void Wait() {
if (focused_)
return;
runner_->Run();
GetOobeUI()
->signin_screen_handler_for_test()
->SetFocusPODCallbackForTesting(base::Closure());
runner_ = NULL;
}
private:
OobeUI* GetOobeUI() {
OobeUI* oobe_ui =
static_cast<chromeos::LoginDisplayHostImpl*>(
chromeos::LoginDisplayHostImpl::default_host())->GetOobeUI();
CHECK(oobe_ui);
return oobe_ui;
}
bool focused_;
scoped_refptr<content::MessageLoopRunner> runner_;
};
} // anonymous namespace
class LoginUIKeyboardTest : public chromeos::LoginManagerTest {
public:
LoginUIKeyboardTest() : LoginManagerTest(false) {}
virtual ~LoginUIKeyboardTest() {}
virtual void SetUpOnMainThread() OVERRIDE {
user_input_methods.push_back("xkb:fr::fra");
user_input_methods.push_back("xkb:de::ger");
chromeos::input_method::InputMethodManager::Get()->MigrateInputMethods(
&user_input_methods);
LoginManagerTest::SetUpOnMainThread();
}
// Should be called from PRE_ test so that local_state is saved to disk, and
// reloaded in the main test.
void InitUserLRUInputMethod() {
PrefService* local_state = g_browser_process->local_state();
input_method::SetUserLRUInputMethodPreferenceForTesting(
kTestUser1, user_input_methods[0], local_state);
input_method::SetUserLRUInputMethodPreferenceForTesting(
kTestUser2, user_input_methods[1], local_state);
}
protected:
std::vector<std::string> user_input_methods;
};
IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, PRE_CheckPODScreenDefault) {
RegisterUser(kTestUser1);
RegisterUser(kTestUser2);
StartupUtils::MarkOobeCompleted();
}
// Check default IME initialization, when there is no IME configuration in
// local_state.
IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, CheckPODScreenDefault) {
js_checker().ExpectEQ("$('pod-row').pods.length", 2);
std::vector<std::string> expected_input_methods;
Append_en_US_InputMethods(&expected_input_methods);
EXPECT_EQ(expected_input_methods,
input_method::InputMethodManager::Get()
->GetActiveIMEState()
->GetActiveInputMethodIds());
}
IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, PRE_CheckPODScreenWithUsers) {
RegisterUser(kTestUser1);
RegisterUser(kTestUser2);
InitUserLRUInputMethod();
StartupUtils::MarkOobeCompleted();
}
IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, CheckPODScreenWithUsers) {
js_checker().ExpectEQ("$('pod-row').pods.length", 2);
EXPECT_EQ(user_input_methods[0],
input_method::InputMethodManager::Get()
->GetActiveIMEState()
->GetCurrentInputMethod()
.id());
std::vector<std::string> expected_input_methods;
Append_en_US_InputMethods(&expected_input_methods);
// Active IM for the first user (active user POD).
expected_input_methods.push_back(user_input_methods[0]);
EXPECT_EQ(expected_input_methods,
input_method::InputMethodManager::Get()
->GetActiveIMEState()
->GetActiveInputMethodIds());
FocusPODWaiter waiter;
js_checker().Evaluate("$('pod-row').focusPod($('pod-row').pods[1])");
waiter.Wait();
EXPECT_EQ(user_input_methods[1],
input_method::InputMethodManager::Get()
->GetActiveIMEState()
->GetCurrentInputMethod()
.id());
}
class LoginUIKeyboardTestWithUsersAndOwner : public chromeos::LoginManagerTest {
public:
LoginUIKeyboardTestWithUsersAndOwner() : LoginManagerTest(false) {}
virtual ~LoginUIKeyboardTestWithUsersAndOwner() {}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
LoginManagerTest::SetUpCommandLine(command_line);
command_line->AppendSwitch(switches::kStubCrosSettings);
LoginManagerTest::SetUpCommandLine(command_line);
}
virtual void SetUpOnMainThread() OVERRIDE {
user_input_methods.push_back("xkb:fr::fra");
user_input_methods.push_back("xkb:de::ger");
user_input_methods.push_back("xkb:pl::pol");
chromeos::input_method::InputMethodManager::Get()->MigrateInputMethods(
&user_input_methods);
CrosSettings::Get()->SetString(kDeviceOwner, kTestUser3);
LoginManagerTest::SetUpOnMainThread();
}
// Should be called from PRE_ test so that local_state is saved to disk, and
// reloaded in the main test.
void InitUserLRUInputMethod() {
PrefService* local_state = g_browser_process->local_state();
input_method::SetUserLRUInputMethodPreferenceForTesting(
kTestUser1, user_input_methods[0], local_state);
input_method::SetUserLRUInputMethodPreferenceForTesting(
kTestUser2, user_input_methods[1], local_state);
input_method::SetUserLRUInputMethodPreferenceForTesting(
kTestUser3, user_input_methods[2], local_state);
local_state->SetString(language_prefs::kPreferredKeyboardLayout,
user_input_methods[2]);
}
void CheckGaiaKeyboard();
protected:
std::vector<std::string> user_input_methods;
};
void LoginUIKeyboardTestWithUsersAndOwner::CheckGaiaKeyboard() {
std::vector<std::string> expected_input_methods;
// kPreferredKeyboardLayout is now set to last focused POD.
expected_input_methods.push_back(user_input_methods[0]);
// Locale default input methods (the first one also is hardware IM).
Append_en_US_InputMethods(&expected_input_methods);
EXPECT_EQ(expected_input_methods,
input_method::InputMethodManager::Get()
->GetActiveIMEState()
->GetActiveInputMethodIds());
}
IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTestWithUsersAndOwner,
PRE_CheckPODScreenKeyboard) {
RegisterUser(kTestUser1);
RegisterUser(kTestUser2);
RegisterUser(kTestUser3);
InitUserLRUInputMethod();
StartupUtils::MarkOobeCompleted();
}
IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTestWithUsersAndOwner,
CheckPODScreenKeyboard) {
js_checker().ExpectEQ("$('pod-row').pods.length", 3);
std::vector<std::string> expected_input_methods;
// Owner input method.
expected_input_methods.push_back(user_input_methods[2]);
// Locale default input methods (the first one also is hardware IM).
Append_en_US_InputMethods(&expected_input_methods);
// Active IM for the first user (active user POD).
expected_input_methods.push_back(user_input_methods[0]);
EXPECT_EQ(expected_input_methods,
input_method::InputMethodManager::Get()
->GetActiveIMEState()
->GetActiveInputMethodIds());
// Switch to Gaia.
js_checker().Evaluate("$('add-user-button').click()");
OobeScreenWaiter(OobeDisplay::SCREEN_GAIA_SIGNIN).Wait();
CheckGaiaKeyboard();
// Switch back.
js_checker().Evaluate("$('cancel-add-user-button').click()");
OobeScreenWaiter(OobeDisplay::SCREEN_ACCOUNT_PICKER).Wait();
EXPECT_EQ(expected_input_methods,
input_method::InputMethodManager::Get()
->GetActiveIMEState()
->GetActiveInputMethodIds());
}
} // namespace chromeos
......@@ -12,6 +12,8 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
#include "chrome/browser/chromeos/policy/consumer_management_service.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
......@@ -22,6 +24,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/ime/input_method_manager.h"
#include "chromeos/settings/cros_settings_names.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_thread.h"
......@@ -105,6 +108,16 @@ void ClearDnsCache(IOThread* io_thread) {
io_thread->ClearHostCache();
}
void PushFrontIMIfNotExists(const std::string& input_method,
std::vector<std::string>* input_methods) {
if (input_method.empty())
return;
if (std::find(input_methods->begin(), input_methods->end(), input_method) ==
input_methods->end())
input_methods->insert(input_methods->begin(), input_method);
}
} // namespace
GaiaContext::GaiaContext()
......@@ -557,9 +570,37 @@ void GaiaScreenHandler::ShowGaiaScreenIfReady() {
else
Delegate()->LoadWallpaper(populated_email_);
input_method::InputMethodManager* imm =
input_method::InputMethodManager::Get();
scoped_refptr<input_method::InputMethodManager::State> gaia_ime_state =
imm->GetActiveIMEState()->Clone();
imm->SetState(gaia_ime_state);
// Set Least Recently Used input method for the user.
if (!populated_email_.empty())
signin_screen_handler_->SetUserInputMethod(populated_email_);
if (!populated_email_.empty()) {
signin_screen_handler_->SetUserInputMethod(populated_email_,
gaia_ime_state.get());
} else {
std::vector<std::string> input_methods =
imm->GetInputMethodUtil()->GetHardwareLoginInputMethodIds();
const std::string owner_im = signin_screen_handler_->GetUserLRUInputMethod(
user_manager::UserManager::Get()->GetOwnerEmail());
const std::string system_im = g_browser_process->local_state()->GetString(
language_prefs::kPreferredKeyboardLayout);
PushFrontIMIfNotExists(owner_im, &input_methods);
PushFrontIMIfNotExists(system_im, &input_methods);
gaia_ime_state->EnableLoginLayouts(
g_browser_process->GetApplicationLocale(), input_methods);
if (!system_im.empty()) {
gaia_ime_state->ChangeInputMethod(system_im, false /* show_message */);
} else if (!owner_im.empty()) {
gaia_ime_state->ChangeInputMethod(owner_im, false /* show_message */);
}
}
LoadAuthExtension(!gaia_silent_load_, false, false);
signin_screen_handler_->UpdateUIState(
......
......@@ -175,36 +175,16 @@ std::string GetNetworkName(const std::string& service_path) {
static bool SetUserInputMethodImpl(
const std::string& username,
chromeos::input_method::InputMethodManager* manager) {
PrefService* const local_state = g_browser_process->local_state();
const base::DictionaryValue* users_lru_input_methods =
local_state->GetDictionary(prefs::kUsersLRUInputMethod);
if (users_lru_input_methods == NULL) {
DLOG(WARNING) << "SetUserInputMethod('" << username
<< "'): no kUsersLRUInputMethod";
return false;
}
std::string input_method;
if (!users_lru_input_methods->GetStringWithoutPathExpansion(username,
&input_method)) {
DVLOG(0) << "SetUserInputMethod('" << username
<< "'): no input method for this user";
return false;
}
if (input_method.empty())
return false;
if (!manager->IsLoginKeyboard(input_method)) {
const std::string& user_input_method,
input_method::InputMethodManager::State* ime_state) {
if (!chromeos::input_method::InputMethodManager::Get()->IsLoginKeyboard(
user_input_method)) {
LOG(WARNING) << "SetUserInputMethod('" << username
<< "'): stored user LRU input method '" << input_method
<< "'): stored user LRU input method '" << user_input_method
<< "' is no longer Full Latin Keyboard Language"
<< " (entry dropped). Use hardware default instead.";
PrefService* const local_state = g_browser_process->local_state();
DictionaryPrefUpdate updater(local_state, prefs::kUsersLRUInputMethod);
base::DictionaryValue* const users_lru_input_methods = updater.Get();
......@@ -214,16 +194,14 @@ static bool SetUserInputMethodImpl(
return false;
}
if (!Contains(manager->GetActiveIMEState()->GetActiveInputMethodIds(),
input_method)) {
if (!manager->GetActiveIMEState()->EnableInputMethod(input_method)) {
if (!Contains(ime_state->GetActiveInputMethodIds(), user_input_method)) {
if (!ime_state->EnableInputMethod(user_input_method)) {
DLOG(ERROR) << "SigninScreenHandler::SetUserInputMethod('" << username
<< "'): user input method '" << input_method
<< "'): user input method '" << user_input_method
<< "' is not enabled and enabling failed (ignored!).";
}
}
manager->GetActiveIMEState()->ChangeInputMethod(input_method,
false /* show_message */);
ime_state->ChangeInputMethod(user_input_method, false /* show_message */);
return true;
}
......@@ -314,6 +292,9 @@ SigninScreenHandler::SigninScreenHandler(
}
SigninScreenHandler::~SigninScreenHandler() {
OobeUI* oobe_ui = GetOobeUI();
if (oobe_ui)
oobe_ui->RemoveObserver(this);
chromeos::input_method::ImeKeyboard* keyboard =
chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard();
if (keyboard)
......@@ -478,6 +459,11 @@ void SigninScreenHandler::UpdateState(ErrorScreenActor::ErrorReason reason) {
UpdateStateInternal(reason, false);
}
void SigninScreenHandler::SetFocusPODCallbackForTesting(
base::Closure callback) {
test_focus_pod_callback_ = callback;
}
// SigninScreenHandler, private: -----------------------------------------------
void SigninScreenHandler::ShowImpl() {
......@@ -486,6 +472,11 @@ void SigninScreenHandler::ShowImpl() {
return;
}
if (!ime_state_.get())
ime_state_ = input_method::InputMethodManager::Get()->GetActiveIMEState();
GetOobeUI()->AddObserver(this);
if (oobe_ui_ || is_enrolling_consumer_management_) {
// Shows new user sign-in for OOBE.
OnShowAddUser();
......@@ -794,6 +785,38 @@ void SigninScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterDictionaryPref(prefs::kUsersLRUInputMethod);
}
void SigninScreenHandler::OnCurrentScreenChanged(OobeUI::Screen current_screen,
OobeUI::Screen new_screen) {
if (new_screen == OobeUI::SCREEN_ACCOUNT_PICKER) {
// Restore active IME state if returning to user pod row screen.
input_method::InputMethodManager::Get()->SetState(ime_state_);
}
}
std::string SigninScreenHandler::GetUserLRUInputMethod(
const std::string& username) const {
PrefService* const local_state = g_browser_process->local_state();
const base::DictionaryValue* users_lru_input_methods =
local_state->GetDictionary(prefs::kUsersLRUInputMethod);
if (users_lru_input_methods == NULL) {
DLOG(WARNING) << "GetUserLRUInputMethod('" << username
<< "'): no kUsersLRUInputMethod";
return std::string();
}
std::string input_method;
if (!users_lru_input_methods->GetStringWithoutPathExpansion(username,
&input_method)) {
DVLOG(0) << "GetUserLRUInputMethod('" << username
<< "'): no input method for this user";
return std::string();
}
return input_method;
}
void SigninScreenHandler::HandleGetUsers() {
if (delegate_)
delegate_->HandleGetUsers();
......@@ -1000,7 +1023,9 @@ bool SigninScreenHandler::ShouldLoadGaia() const {
}
// Update keyboard layout to least recently used by the user.
void SigninScreenHandler::SetUserInputMethod(const std::string& username) {
void SigninScreenHandler::SetUserInputMethod(
const std::string& username,
input_method::InputMethodManager::State* ime_state) {
user_manager::UserManager* user_manager = user_manager::UserManager::Get();
if (user_manager->IsUserLoggedIn()) {
// We are on sign-in screen inside user session (adding new user to
......@@ -1010,10 +1035,12 @@ void SigninScreenHandler::SetUserInputMethod(const std::string& username) {
return;
}
chromeos::input_method::InputMethodManager* const manager =
chromeos::input_method::InputMethodManager::Get();
bool succeed = false;
const bool succeed = SetUserInputMethodImpl(username, manager);
const std::string input_method = GetUserLRUInputMethod(username);
if (!input_method.empty())
succeed = SetUserInputMethodImpl(username, input_method, ime_state);
// This is also a case when LRU layout is set only for a few local users,
// thus others need to be switched to default locale.
......@@ -1022,7 +1049,7 @@ void SigninScreenHandler::SetUserInputMethod(const std::string& username) {
DVLOG(0) << "SetUserInputMethod('" << username
<< "'): failed to set user layout. Switching to default.";
manager->GetActiveIMEState()->SetInputMethodLoginDefault();
ime_state->SetInputMethodLoginDefault();
}
}
......@@ -1325,12 +1352,14 @@ void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) {
}
void SigninScreenHandler::HandleFocusPod(const std::string& user_id) {
SetUserInputMethod(user_id);
SetUserInputMethod(user_id, ime_state_.get());
#if !defined(USE_ATHENA)
// TODO(dpolukhin): crbug.com/408734.
WallpaperManager::Get()->SetUserWallpaperDelayed(user_id);
#endif
ScreenlockBridge::Get()->SetFocusedUser(user_id);
if (!test_focus_pod_callback_.is_null())
test_focus_pod_callback_.Run();
}
void SigninScreenHandler::HandleHardlockPod(const std::string& user_id) {
......@@ -1431,9 +1460,13 @@ void SigninScreenHandler::CancelPasswordChangedFlowInternal() {
}
}
OobeUI* SigninScreenHandler::GetOobeUI() const {
return static_cast<OobeUI*>(web_ui()->GetController());
}
OobeUI::Screen SigninScreenHandler::GetCurrentScreen() const {
OobeUI::Screen screen = OobeUI::SCREEN_UNKNOWN;
OobeUI* oobe_ui = static_cast<OobeUI*>(web_ui()->GetController());
OobeUI* oobe_ui = GetOobeUI();
if (oobe_ui)
screen = oobe_ui->current_screen();
return screen;
......
......@@ -28,6 +28,7 @@
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chrome/browser/ui/webui/chromeos/touch_view_controller_delegate.h"
#include "chromeos/ime/ime_keyboard.h"
#include "chromeos/ime/input_method_manager.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/notification_observer.h"
......@@ -213,7 +214,8 @@ class SigninScreenHandler
public ScreenlockBridge::LockHandler,
public NetworkStateInformer::NetworkStateInformerObserver,
public input_method::ImeKeyboard::Observer,
public TouchViewControllerDelegate::Observer {
public TouchViewControllerDelegate::Observer,
public OobeUI::Observer {
public:
SigninScreenHandler(
const scoped_refptr<NetworkStateInformer>& network_state_informer,
......@@ -246,6 +248,15 @@ class SigninScreenHandler
kiosk_enable_flow_aborted_callback_for_test_ = callback;
}
// OobeUI::Observer implemetation.
virtual void OnCurrentScreenChanged(OobeUI::Screen current_screen,
OobeUI::Screen new_screen) OVERRIDE;
// Returns least used user login input method.
std::string GetUserLRUInputMethod(const std::string& username) const;
void SetFocusPODCallbackForTesting(base::Closure callback);
private:
enum UIState {
UI_STATE_UNKNOWN = 0,
......@@ -422,8 +433,10 @@ class SigninScreenHandler
bool ShouldLoadGaia() const;
// Update current input method (namely keyboard layout) to LRU by this user.
void SetUserInputMethod(const std::string& username);
// Update current input method (namely keyboard layout) in the given IME state
// to LRU by this user.
void SetUserInputMethod(const std::string& username,
input_method::InputMethodManager::State* ime_state);
// Invoked when auto enrollment check progresses to decide whether to
// continue kiosk enable flow. Kiosk enable flow is resumed when
......@@ -439,6 +452,9 @@ class SigninScreenHandler
// input_method::ImeKeyboard::Observer implementation:
virtual void OnCapsLockChanged(bool enabled) OVERRIDE;
// Returns OobeUI object of NULL.
OobeUI* GetOobeUI() const;
// Current UI state of the signin screen.
UIState ui_state_;
......@@ -501,6 +517,12 @@ class SigninScreenHandler
// Whether consumer management enrollment is in progress.
bool is_enrolling_consumer_management_;
// Input Method Engine state used at signin screen.
scoped_refptr<input_method::InputMethodManager::State> ime_state_;
// This callback captures "focusPod finished" event for tests.
base::Closure test_focus_pod_callback_;
base::WeakPtrFactory<SigninScreenHandler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler);
......
......@@ -990,6 +990,7 @@
'browser/chromeos/login/login_manager_test.cc',
'browser/chromeos/login/login_manager_test.h',
'browser/chromeos/login/login_screen_policy_browsertest.cc',
'browser/chromeos/login/login_ui_keyboard_browsertest.cc',
'browser/chromeos/login/login_utils_browsertest.cc',
'browser/chromeos/login/mixin_based_browser_test.cc',
'browser/chromeos/login/mixin_based_browser_test.h',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment