| Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
|
| diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
|
| index 9d1861e41db23fb1956fcc03e03065064455200c..e2e25e82555fdc20e9389db54bab7f14c907d41b 100644
|
| --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
|
| +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
|
| @@ -259,6 +259,7 @@ DesktopNativeWidgetAura::DesktopNativeWidgetAura(
|
| last_drop_operation_(ui::DragDropTypes::DRAG_NONE),
|
| restore_focus_on_activate_(false),
|
| restore_focus_on_window_focus_(false),
|
| + intercept_all_keys_on_focus_(false),
|
| cursor_(gfx::kNullCursor),
|
| widget_type_(Widget::InitParams::TYPE_WINDOW) {
|
| aura::client::SetFocusChangeObserver(content_window_, this);
|
| @@ -813,6 +814,14 @@ void DesktopNativeWidgetAura::SetVisibleOnAllWorkspaces(bool always_visible) {
|
| desktop_window_tree_host_->SetVisibleOnAllWorkspaces(always_visible);
|
| }
|
|
|
| +void DesktopNativeWidgetAura::SetInterceptAllKeys(bool want_all_keys) {
|
| + // Enable immediately if the window is active.
|
| + if (IsActive()) {
|
| + desktop_window_tree_host_->SetInterceptAllKeys(want_all_keys);
|
| + }
|
| + intercept_all_keys_on_focus_ = want_all_keys;
|
| +}
|
| +
|
| void DesktopNativeWidgetAura::Maximize() {
|
| if (content_window_)
|
| desktop_window_tree_host_->Maximize();
|
| @@ -1074,6 +1083,12 @@ bool DesktopNativeWidgetAura::ShouldActivate() const {
|
| void DesktopNativeWidgetAura::OnWindowActivated(aura::Window* gained_active,
|
| aura::Window* lost_active) {
|
| DCHECK(content_window_ == gained_active || content_window_ == lost_active);
|
| +
|
| + if (intercept_all_keys_on_focus_) {
|
| + desktop_window_tree_host_->SetInterceptAllKeys(gained_active ==
|
| + content_window_);
|
| + }
|
| +
|
| if (gained_active == content_window_ && restore_focus_on_activate_) {
|
| restore_focus_on_activate_ = false;
|
| GetWidget()->GetFocusManager()->RestoreFocusedView();
|
|
|