| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 chrome::NOTIFICATION_AUTH_CANCELLED, | 322 chrome::NOTIFICATION_AUTH_CANCELLED, |
| 323 content::NotificationService::AllSources()); | 323 content::NotificationService::AllSources()); |
| 324 | 324 |
| 325 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( | 325 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( |
| 326 this); | 326 this); |
| 327 | 327 |
| 328 chromeos::input_method::ImeKeyboard* keyboard = | 328 chromeos::input_method::ImeKeyboard* keyboard = |
| 329 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); | 329 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); |
| 330 if (keyboard) | 330 if (keyboard) |
| 331 keyboard->AddObserver(this); | 331 keyboard->AddObserver(this); |
| 332 OnAllowedInputMethodsChanged(); | |
| 333 allowed_input_methods_subscription_ = | 332 allowed_input_methods_subscription_ = |
| 334 chromeos::CrosSettings::Get()->AddSettingsObserver( | 333 chromeos::CrosSettings::Get()->AddSettingsObserver( |
| 335 chromeos::kDeviceLoginScreenInputMethods, | 334 chromeos::kDeviceLoginScreenInputMethods, |
| 336 base::Bind(&SigninScreenHandler::OnAllowedInputMethodsChanged, | 335 base::Bind(&SigninScreenHandler::OnAllowedInputMethodsChanged, |
| 337 base::Unretained(this))); | 336 base::Unretained(this))); |
| 338 | 337 |
| 339 content::ServiceManagerConnection::GetForProcess() | 338 content::ServiceManagerConnection::GetForProcess() |
| 340 ->GetConnector() | 339 ->GetConnector() |
| 341 ->BindInterface(ash::mojom::kServiceName, &touch_view_manager_ptr_); | 340 ->BindInterface(ash::mojom::kServiceName, &touch_view_manager_ptr_); |
| 342 touch_view_manager_ptr_->AddObserver( | 341 touch_view_manager_ptr_->AddObserver( |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 content::NotificationService::current()->Notify( | 1369 content::NotificationService::current()->Notify( |
| 1371 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 1370 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
| 1372 content::NotificationService::AllSources(), | 1371 content::NotificationService::AllSources(), |
| 1373 content::NotificationService::NoDetails()); | 1372 content::NotificationService::NoDetails()); |
| 1374 TRACE_EVENT_ASYNC_END0( | 1373 TRACE_EVENT_ASYNC_END0( |
| 1375 "ui", "ShowLoginWebUI", LoginDisplayHostImpl::kShowLoginWebUIid); | 1374 "ui", "ShowLoginWebUI", LoginDisplayHostImpl::kShowLoginWebUIid); |
| 1376 } | 1375 } |
| 1377 webui_visible_ = true; | 1376 webui_visible_ = true; |
| 1378 if (preferences_changed_delayed_) | 1377 if (preferences_changed_delayed_) |
| 1379 OnPreferencesChanged(); | 1378 OnPreferencesChanged(); |
| 1379 OnAllowedInputMethodsChanged(); |
| 1380 } | 1380 } |
| 1381 | 1381 |
| 1382 void SigninScreenHandler::HandleCancelPasswordChangedFlow( | 1382 void SigninScreenHandler::HandleCancelPasswordChangedFlow( |
| 1383 const AccountId& account_id) { | 1383 const AccountId& account_id) { |
| 1384 if (account_id.is_valid()) { | 1384 if (account_id.is_valid()) { |
| 1385 RecordReauthReason(account_id, ReauthReason::PASSWORD_UPDATE_SKIPPED); | 1385 RecordReauthReason(account_id, ReauthReason::PASSWORD_UPDATE_SKIPPED); |
| 1386 } | 1386 } |
| 1387 gaia_screen_handler_->StartClearingCookies( | 1387 gaia_screen_handler_->StartClearingCookies( |
| 1388 base::Bind(&SigninScreenHandler::CancelPasswordChangedFlowInternal, | 1388 base::Bind(&SigninScreenHandler::CancelPasswordChangedFlowInternal, |
| 1389 weak_factory_.GetWeakPtr())); | 1389 weak_factory_.GetWeakPtr())); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 CrosSettings* cros_settings = CrosSettings::Get(); | 1596 CrosSettings* cros_settings = CrosSettings::Get(); |
| 1597 if (!cros_settings) | 1597 if (!cros_settings) |
| 1598 return false; | 1598 return false; |
| 1599 bool allow_guest; | 1599 bool allow_guest; |
| 1600 cros_settings->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); | 1600 cros_settings->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); |
| 1601 return allow_guest; | 1601 return allow_guest; |
| 1602 } | 1602 } |
| 1603 | 1603 |
| 1604 void SigninScreenHandler::OnShowAddUser() { | 1604 void SigninScreenHandler::OnShowAddUser() { |
| 1605 is_account_picker_showing_first_time_ = false; | 1605 is_account_picker_showing_first_time_ = false; |
| 1606 EnforcePolicyInputMethods(std::string()); |
| 1606 gaia_screen_handler_->ShowGaiaAsync(); | 1607 gaia_screen_handler_->ShowGaiaAsync(); |
| 1607 } | 1608 } |
| 1608 | 1609 |
| 1609 net::Error SigninScreenHandler::FrameError() const { | 1610 net::Error SigninScreenHandler::FrameError() const { |
| 1610 return gaia_screen_handler_->frame_error(); | 1611 return gaia_screen_handler_->frame_error(); |
| 1611 } | 1612 } |
| 1612 | 1613 |
| 1613 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1614 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1614 caps_lock_enabled_ = enabled; | 1615 caps_lock_enabled_ = enabled; |
| 1615 if (page_is_ready()) | 1616 if (page_is_ready()) |
| 1616 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1617 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1617 } | 1618 } |
| 1618 | 1619 |
| 1619 void SigninScreenHandler::OnFeedbackFinished() { | 1620 void SigninScreenHandler::OnFeedbackFinished() { |
| 1620 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI"); | 1621 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI"); |
| 1621 | 1622 |
| 1622 // Recreate user's cryptohome after the feedback is attempted. | 1623 // Recreate user's cryptohome after the feedback is attempted. |
| 1623 HandleResyncUserData(); | 1624 HandleResyncUserData(); |
| 1624 } | 1625 } |
| 1625 | 1626 |
| 1626 void SigninScreenHandler::OnAllowedInputMethodsChanged() { | 1627 void SigninScreenHandler::OnAllowedInputMethodsChanged() { |
| 1628 if (!webui_visible_) |
| 1629 return; |
| 1630 |
| 1627 if (focused_pod_account_id_) { | 1631 if (focused_pod_account_id_) { |
| 1628 std::string user_input_method = | 1632 std::string user_input_method = |
| 1629 GetUserLastInputMethod(focused_pod_account_id_->GetUserEmail()); | 1633 GetUserLastInputMethod(focused_pod_account_id_->GetUserEmail()); |
| 1630 EnforcePolicyInputMethods(user_input_method); | 1634 EnforcePolicyInputMethods(user_input_method); |
| 1631 } else { | 1635 } else { |
| 1632 EnforcePolicyInputMethods(std::string()); | 1636 EnforcePolicyInputMethods(std::string()); |
| 1633 } | 1637 } |
| 1634 } | 1638 } |
| 1635 | 1639 |
| 1636 void SigninScreenHandler::SetKeyboardSettings(const AccountId& account_id) { | 1640 void SigninScreenHandler::SetKeyboardSettings(const AccountId& account_id) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1655 rate.initial_delay_in_ms = auto_repeat_delay; | 1659 rate.initial_delay_in_ms = auto_repeat_delay; |
| 1656 rate.repeat_interval_in_ms = auto_repeat_interval; | 1660 rate.repeat_interval_in_ms = auto_repeat_interval; |
| 1657 input_method::InputMethodManager::Get() | 1661 input_method::InputMethodManager::Get() |
| 1658 ->GetImeKeyboard() | 1662 ->GetImeKeyboard() |
| 1659 ->SetAutoRepeatEnabled(true); | 1663 ->SetAutoRepeatEnabled(true); |
| 1660 input_method::InputMethodManager::Get()->GetImeKeyboard()->SetAutoRepeatRate( | 1664 input_method::InputMethodManager::Get()->GetImeKeyboard()->SetAutoRepeatRate( |
| 1661 rate); | 1665 rate); |
| 1662 } | 1666 } |
| 1663 | 1667 |
| 1664 } // namespace chromeos | 1668 } // namespace chromeos |
| OLD | NEW |