Chromium Code Reviews| Index: chrome/browser/chromeos/login/ui/login_display_host_impl.cc |
| diff --git a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc |
| index be3a303249bbf552237ffa3fec6e0b674a9d7444..55829d081fe1252dd748f557a80b72507f3b9bf0 100644 |
| --- a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc |
| +++ b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc |
| @@ -83,6 +83,7 @@ |
| #include "ui/gfx/rect.h" |
| #include "ui/gfx/transform.h" |
| #include "ui/keyboard/keyboard_controller.h" |
| +#include "ui/keyboard/keyboard_util.h" |
| #include "ui/views/focus/focus_manager.h" |
| #include "ui/views/widget/widget.h" |
| #include "ui/views/widget/widget_delegate.h" |
| @@ -282,6 +283,24 @@ class LoginWidgetDelegate : public views::WidgetDelegate { |
| DISALLOW_COPY_AND_ASSIGN(LoginWidgetDelegate); |
| }; |
| +// Returns true if login should scroll user pods into view itself when virtual |
| +// keyboard is shown and disable vk overscroll. |
| +bool LoginScrollIntoViewEnabled() { |
| + return !CommandLine::ForCurrentProcess()->HasSwitch( |
| + chromeos::switches::kDisableLoginScrollIntoView); |
| +} |
| + |
| +// Disables virtual keyboard overscroll. Login UI will scroll user pods |
| +// into view on JS side when virtual keyboard is shown. |
| +void DisableKeyboardOverscroll() { |
| + keyboard::SetKeyboardOverscrollEnabledOverrideValue(false); |
| + keyboard::SetKeyboardOverscrollOverrideEnabled(true); |
| +} |
| + |
| +void ResetKeyboardOverscrollOverride() { |
| + keyboard::SetKeyboardOverscrollOverrideEnabled(false); |
| +} |
| + |
| } // namespace |
| namespace chromeos { |
| @@ -435,6 +454,9 @@ LoginDisplayHostImpl::~LoginDisplayHostImpl() { |
| ash::Shell::GetInstance()->delegate()-> |
| RemoveVirtualKeyboardStateObserver(this); |
| + if (LoginScrollIntoViewEnabled()) |
| + ResetKeyboardOverscrollOverride(); |
| + |
| views::FocusManager::set_arrow_key_traversal_enabled(false); |
| ResetLoginWindowAndView(); |
| @@ -530,6 +552,9 @@ AutoEnrollmentController* LoginDisplayHostImpl::GetAutoEnrollmentController() { |
| void LoginDisplayHostImpl::StartWizard( |
| const std::string& first_screen_name, |
| scoped_ptr<base::DictionaryValue> screen_parameters) { |
| + if (LoginScrollIntoViewEnabled()) |
| + DisableKeyboardOverscroll(); |
| + |
| startup_sound_honors_spoken_feedback_ = true; |
| TryToPlayStartupSound(); |
| @@ -574,6 +599,9 @@ AppLaunchController* LoginDisplayHostImpl::GetAppLaunchController() { |
| void LoginDisplayHostImpl::StartUserAdding( |
| const base::Closure& completion_callback) { |
| + if (LoginScrollIntoViewEnabled()) |
| + DisableKeyboardOverscroll(); |
| + |
| restore_path_ = RESTORE_ADD_USER_INTO_SESSION; |
| completion_callback_ = completion_callback; |
| finalize_animation_type_ = ANIMATION_NONE; |
| @@ -606,6 +634,9 @@ void LoginDisplayHostImpl::StartUserAdding( |
| void LoginDisplayHostImpl::StartSignInScreen( |
| const LoginScreenContext& context) { |
| + if (LoginScrollIntoViewEnabled()) |
| + DisableKeyboardOverscroll(); |
| + |
| startup_sound_honors_spoken_feedback_ = true; |
| TryToPlayStartupSound(); |
| @@ -876,12 +907,18 @@ void LoginDisplayHostImpl::OnKeyboardBoundsChanging( |
| const gfx::Rect& new_bounds) { |
| if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty()) { |
| // Keyboard has been hidden. |
| - if (webui_login_display_) |
| + if (webui_login_display_) { |
|
dzhioev (left Google)
2014/05/21 17:30:32
Shouldn't we also set keyboard state once webui_lo
Nikita (slow)
2014/05/22 15:11:50
When CreateLoginDisplay() is called neither handle
|
| webui_login_display_->ShowControlBar(true); |
| + if (LoginScrollIntoViewEnabled()) |
| + webui_login_display_->SetKeyboardState(false); |
| + } |
| } else if (!new_bounds.IsEmpty() && keyboard_bounds_.IsEmpty()) { |
| // Keyboard has been shown. |
| - if (webui_login_display_) |
| + if (webui_login_display_) { |
| webui_login_display_->ShowControlBar(false); |
| + if (LoginScrollIntoViewEnabled()) |
| + webui_login_display_->SetKeyboardState(true); |
| + } |
| } |
| keyboard_bounds_ = new_bounds; |