Chromium Code Reviews| Index: ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc |
| diff --git a/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..efd019493dcba7a6eba6a531257e772da9128fa9 |
| --- /dev/null |
| +++ b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
|
oshima
2015/01/13 23:16:37
ditto
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h" |
| + |
| +#include <set> |
| + |
| +#include "ash/shell.h" |
| +#include "ui/aura/client/cursor_client.h" |
| +#include "ui/events/keycodes/dom3/dom_code.h" |
| +#include "ui/ozone/public/input_controller.h" |
| +#include "ui/ozone/public/ozone_platform.h" |
| + |
| +namespace ash { |
| + |
| +ScopedDisableInternalMouseAndKeyboardOzone:: |
| + ScopedDisableInternalMouseAndKeyboardOzone() { |
| + ui::InputController* input_controller = |
| + ui::OzonePlatform::GetInstance()->GetInputController(); |
| + if (input_controller->HasTouchpad()) { |
| + input_controller->DisableInternalTouchpad(); |
| + aura::client::GetCursorClient(Shell::GetInstance()->GetPrimaryRootWindow()) |
| + ->HideCursor(); |
|
oshima
2015/01/13 23:16:37
I assume you just want to hide as a initial state
pkotwicz
2015/01/14 18:01:42
Yes, moving an external mouse while in maximized m
|
| + } |
| + |
| + // Allow the acccessible keys present on the side of some devices to continue |
| + // working. |
| + scoped_ptr<std::set<ui::DomCode>> excepted_keys(new std::set<ui::DomCode>); |
| + excepted_keys->insert(ui::DomCode::VOLUME_DOWN); |
| + excepted_keys->insert(ui::DomCode::VOLUME_UP); |
| + excepted_keys->insert(ui::DomCode::POWER); |
| + input_controller->DisableInternalKeyboardExceptKeys(excepted_keys.Pass()); |
| +} |
| + |
| +ScopedDisableInternalMouseAndKeyboardOzone:: |
| + ~ScopedDisableInternalMouseAndKeyboardOzone() { |
| + ui::InputController* input_controller = |
| + ui::OzonePlatform::GetInstance()->GetInputController(); |
| + input_controller->EnableInternalTouchpad(); |
| + input_controller->EnableInternalKeyboard(); |
| +} |
| + |
| +} // namespace ash |