Chromium Code Reviews| Index: chrome/browser/chromeos/login/ui/webui_login_view.cc |
| diff --git a/chrome/browser/chromeos/login/ui/webui_login_view.cc b/chrome/browser/chromeos/login/ui/webui_login_view.cc |
| index 1dcb1fc9f02695cbd462f1aaee87bd26c38f5cde..6d254018e1ad31fe9f43abf85ed0f05c08f0007e 100644 |
| --- a/chrome/browser/chromeos/login/ui/webui_login_view.cc |
| +++ b/chrome/browser/chromeos/login/ui/webui_login_view.cc |
| @@ -54,6 +54,7 @@ |
| #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| #include "ui/gfx/geometry/rect.h" |
| #include "ui/gfx/geometry/size.h" |
| +#include "ui/keyboard/keyboard_controller.h" |
| #include "ui/views/controls/webview/webview.h" |
| #include "ui/views/widget/widget.h" |
| @@ -111,6 +112,12 @@ const char WebUILoginView::kViewClassName[] = |
| WebUILoginView::WebUILoginView(const WebViewSettings& settings) |
| : settings_(settings) { |
| + if (keyboard::KeyboardController::GetInstance()) { |
| + keyboard::KeyboardController::GetInstance()->AddObserver(this); |
| + is_observing_keyboard_ = true; |
| + } |
| + ash::Shell::Get()->AddShellObserver(this); |
| + |
| registrar_.Add(this, |
| chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
| content::NotificationService::AllSources()); |
| @@ -171,6 +178,12 @@ WebUILoginView::~WebUILoginView() { |
| for (auto& observer : observer_list_) |
| observer.OnHostDestroying(); |
| + ash::Shell::Get()->RemoveShellObserver(this); |
| + if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) { |
| + keyboard::KeyboardController::GetInstance()->RemoveObserver(this); |
| + is_observing_keyboard_ = false; |
| + } |
| + |
| if (!ash_util::IsRunningInMash() && |
| ash::Shell::Get()->HasPrimaryStatusArea()) { |
| ash::Shell::Get()->GetPrimarySystemTray()->SetNextFocusableView(nullptr); |
| @@ -406,6 +419,45 @@ views::WebView* WebUILoginView::web_view() { |
| return webui_login_.get(); |
| } |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// ash::ShellObserver: |
| + |
| +void WebUILoginView::OnVirtualKeyboardStateChanged(bool activated, |
| + ash::WmWindow* root_window) { |
| + if (keyboard::KeyboardController::GetInstance()) { |
|
achuithb
2017/04/12 19:00:26
Let's use a temp var for this?
jdufault
2017/04/13 00:34:42
Done.
|
| + if (activated) { |
| + if (!is_observing_keyboard_) { |
| + keyboard::KeyboardController::GetInstance()->AddObserver(this); |
| + is_observing_keyboard_ = true; |
|
achuithb
2017/04/12 19:00:26
Is the purpose of is_observing_keyboard_ just to p
jdufault
2017/04/13 00:34:42
Done.
|
| + } |
| + } else { |
| + keyboard::KeyboardController::GetInstance()->RemoveObserver(this); |
| + is_observing_keyboard_ = false; |
| + } |
| + } |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// keyboard::KeyboardControllerObserver: |
| + |
| +void WebUILoginView::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) { |
| + if (new_bounds.IsEmpty()) { |
| + // Keyboard has been hidden. |
| + if (GetOobeUI()) { |
| + GetOobeUI()->GetCoreOobeView()->ShowControlBar(true); |
|
achuithb
2017/04/12 19:00:26
Use a temp var for this?
CoreOobeView* core_oobe_
jdufault
2017/04/13 00:34:42
Done.
|
| + GetOobeUI()->GetCoreOobeView()->SetVirtualKeyboardShown(false); |
| + } |
| + } else { |
| + // Keyboard has been shown. |
| + if (GetOobeUI()) { |
| + GetOobeUI()->GetCoreOobeView()->ShowControlBar(false); |
| + GetOobeUI()->GetCoreOobeView()->SetVirtualKeyboardShown(true); |
| + } |
| + } |
| +} |
| + |
| +void WebUILoginView::OnKeyboardClosed() {} |
| + |
| // WebUILoginView private: ----------------------------------------------------- |
| bool WebUILoginView::HandleContextMenu( |