Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
| 29 #include "base/sys_info.h" | 29 #include "base/sys_info.h" |
| 30 #include "base/threading/thread_task_runner_handle.h" | 30 #include "base/threading/thread_task_runner_handle.h" |
| 31 #include "base/trace_event/trace_event.h" | 31 #include "base/trace_event/trace_event.h" |
| 32 #include "chrome/browser/browser_process.h" | 32 #include "chrome/browser/browser_process.h" |
| 33 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 33 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 34 #include "chrome/browser/browser_shutdown.h" | 34 #include "chrome/browser/browser_shutdown.h" |
| 35 #include "chrome/browser/chrome_notification_types.h" | 35 #include "chrome/browser/chrome_notification_types.h" |
| 36 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 36 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 37 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 37 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 38 #include "chrome/browser/chromeos/language_preferences.h" | |
| 38 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" | 39 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" |
| 39 #include "chrome/browser/chromeos/login/hwid_checker.h" | 40 #include "chrome/browser/chromeos/login/hwid_checker.h" |
| 40 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 41 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 41 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" | 42 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
| 42 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" | 43 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" |
| 43 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" | 44 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" |
| 44 #include "chrome/browser/chromeos/login/reauth_stats.h" | 45 #include "chrome/browser/chromeos/login/reauth_stats.h" |
| 45 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 46 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
| 46 #include "chrome/browser/chromeos/login/screens/network_error.h" | 47 #include "chrome/browser/chromeos/login/screens/network_error.h" |
| 47 #include "chrome/browser/chromeos/login/startup_utils.h" | 48 #include "chrome/browser/chromeos/login/startup_utils.h" |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 965 } | 966 } |
| 966 | 967 |
| 967 gfx::NativeWindow SigninScreenHandler::GetNativeWindow() { | 968 gfx::NativeWindow SigninScreenHandler::GetNativeWindow() { |
| 968 if (native_window_delegate_) | 969 if (native_window_delegate_) |
| 969 return native_window_delegate_->GetNativeWindow(); | 970 return native_window_delegate_->GetNativeWindow(); |
| 970 return nullptr; | 971 return nullptr; |
| 971 } | 972 } |
| 972 | 973 |
| 973 void SigninScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { | 974 void SigninScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { |
| 974 registry->RegisterDictionaryPref(prefs::kUsersLRUInputMethod); | 975 registry->RegisterDictionaryPref(prefs::kUsersLRUInputMethod); |
| 976 registry->RegisterDictionaryPref(prefs::kLanguageXkbAutoRepeatEnabled); | |
| 977 registry->RegisterDictionaryPref(prefs::kLanguageXkbAutoRepeatDelay); | |
| 978 registry->RegisterDictionaryPref(prefs::kLanguageXkbAutoRepeatInterval); | |
| 975 } | 979 } |
| 976 | 980 |
| 977 void SigninScreenHandler::OnCurrentScreenChanged(OobeScreen current_screen, | 981 void SigninScreenHandler::OnCurrentScreenChanged(OobeScreen current_screen, |
| 978 OobeScreen new_screen) { | 982 OobeScreen new_screen) { |
| 979 if (new_screen == OobeScreen::SCREEN_ACCOUNT_PICKER) { | 983 if (new_screen == OobeScreen::SCREEN_ACCOUNT_PICKER) { |
| 980 // Restore active IME state if returning to user pod row screen. | 984 // Restore active IME state if returning to user pod row screen. |
| 981 input_method::InputMethodManager::Get()->SetState(ime_state_); | 985 input_method::InputMethodManager::Get()->SetState(ime_state_); |
| 982 } | 986 } |
| 983 } | 987 } |
| 984 | 988 |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1429 focused_pod_account_id_ = base::MakeUnique<AccountId>(account_id); | 1433 focused_pod_account_id_ = base::MakeUnique<AccountId>(account_id); |
| 1430 | 1434 |
| 1431 const user_manager::User* user = | 1435 const user_manager::User* user = |
| 1432 user_manager::UserManager::Get()->FindUser(account_id); | 1436 user_manager::UserManager::Get()->FindUser(account_id); |
| 1433 // |user| may be nullptr in kiosk mode or unit tests. | 1437 // |user| may be nullptr in kiosk mode or unit tests. |
| 1434 if (user && user->is_logged_in() && !user->is_active()) { | 1438 if (user && user->is_logged_in() && !user->is_active()) { |
| 1435 ash::WmShell::Get()->GetSessionStateDelegate()->SwitchActiveUser( | 1439 ash::WmShell::Get()->GetSessionStateDelegate()->SwitchActiveUser( |
| 1436 account_id); | 1440 account_id); |
| 1437 } else { | 1441 } else { |
| 1438 SetUserInputMethod(account_id.GetUserEmail(), ime_state_.get()); | 1442 SetUserInputMethod(account_id.GetUserEmail(), ime_state_.get()); |
| 1443 SetKeyboardSettings(account_id.GetUserEmail()); | |
| 1439 WallpaperManager::Get()->SetUserWallpaperDelayed(account_id); | 1444 WallpaperManager::Get()->SetUserWallpaperDelayed(account_id); |
| 1440 | 1445 |
| 1441 bool use_24hour_clock = false; | 1446 bool use_24hour_clock = false; |
| 1442 if (user_manager::known_user::GetBooleanPref( | 1447 if (user_manager::known_user::GetBooleanPref( |
| 1443 account_id, prefs::kUse24HourClock, &use_24hour_clock)) { | 1448 account_id, prefs::kUse24HourClock, &use_24hour_clock)) { |
| 1444 g_browser_process->platform_part() | 1449 g_browser_process->platform_part() |
| 1445 ->GetSystemClock() | 1450 ->GetSystemClock() |
| 1446 ->SetLastFocusedPodHourClockType( | 1451 ->SetLastFocusedPodHourClockType( |
| 1447 use_24hour_clock ? base::k24HourClock : base::k12HourClock); | 1452 use_24hour_clock ? base::k24HourClock : base::k12HourClock); |
| 1448 } | 1453 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1604 void SigninScreenHandler::OnAllowedInputMethodsChanged() { | 1609 void SigninScreenHandler::OnAllowedInputMethodsChanged() { |
| 1605 if (focused_pod_account_id_) { | 1610 if (focused_pod_account_id_) { |
| 1606 std::string user_input_method = | 1611 std::string user_input_method = |
| 1607 GetUserLRUInputMethod(focused_pod_account_id_->GetUserEmail()); | 1612 GetUserLRUInputMethod(focused_pod_account_id_->GetUserEmail()); |
| 1608 EnforcePolicyInputMethods(user_input_method); | 1613 EnforcePolicyInputMethods(user_input_method); |
| 1609 } else { | 1614 } else { |
| 1610 EnforcePolicyInputMethods(std::string()); | 1615 EnforcePolicyInputMethods(std::string()); |
| 1611 } | 1616 } |
| 1612 } | 1617 } |
| 1613 | 1618 |
| 1619 void SigninScreenHandler::SetKeyboardSettings(const std::string& username) { | |
|
Alexander Alekseev
2017/02/17 02:18:23
AccountId ?
| |
| 1620 PrefService* const local_state = g_browser_process->local_state(); | |
| 1621 | |
| 1622 const base::DictionaryValue* auto_repeat_enabled_data = | |
| 1623 local_state->GetDictionary(prefs::kLanguageXkbAutoRepeatEnabled); | |
| 1624 bool auto_repeat_enabled = true; | |
| 1625 if (auto_repeat_enabled_data->GetBooleanWithoutPathExpansion( | |
| 1626 username, &auto_repeat_enabled) && | |
| 1627 !auto_repeat_enabled) { | |
| 1628 input_method::InputMethodManager::Get() | |
| 1629 ->GetImeKeyboard() | |
| 1630 ->SetAutoRepeatEnabled(false); | |
| 1631 return; | |
| 1632 } | |
| 1633 | |
| 1634 const base::DictionaryValue* auto_repeat_delay_data = | |
| 1635 local_state->GetDictionary(prefs::kLanguageXkbAutoRepeatDelay); | |
| 1636 const base::DictionaryValue* auto_repeat_interval_data = | |
| 1637 local_state->GetDictionary(prefs::kLanguageXkbAutoRepeatInterval); | |
| 1638 int auto_repeat_delay = language_prefs::kXkbAutoRepeatDelayInMs; | |
| 1639 int auto_repeat_interval = language_prefs::kXkbAutoRepeatIntervalInMs; | |
| 1640 auto_repeat_delay_data->GetIntegerWithoutPathExpansion(username, | |
| 1641 &auto_repeat_delay); | |
| 1642 auto_repeat_interval_data->GetIntegerWithoutPathExpansion( | |
| 1643 username, &auto_repeat_interval); | |
| 1644 input_method::AutoRepeatRate rate; | |
| 1645 rate.initial_delay_in_ms = auto_repeat_delay; | |
| 1646 rate.repeat_interval_in_ms = auto_repeat_interval; | |
| 1647 input_method::InputMethodManager::Get() | |
| 1648 ->GetImeKeyboard() | |
| 1649 ->SetAutoRepeatEnabled(true); | |
| 1650 input_method::InputMethodManager::Get()->GetImeKeyboard()->SetAutoRepeatRate( | |
| 1651 rate); | |
| 1652 } | |
| 1653 | |
| 1614 } // namespace chromeos | 1654 } // namespace chromeos |
| OLD | NEW |