diff options
author | pkotwicz <pkotwicz@chromium.org> | 2015-01-14 09:51:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-14 17:52:48 +0000 |
commit | 62e31ac2ddce4ae5fbbc2f1275e7b0da9819a408 (patch) | |
tree | b7a3de01ffcc67aac88e47b2d4bc2f17ae2ed9b6 /ash/wm | |
parent | 8e37c0b62f039f48abec63409f01965081f8d8b4 (diff) | |
download | chromium_src-62e31ac2ddce4ae5fbbc2f1275e7b0da9819a408.zip chromium_src-62e31ac2ddce4ae5fbbc2f1275e7b0da9819a408.tar.gz chromium_src-62e31ac2ddce4ae5fbbc2f1275e7b0da9819a408.tar.bz2 |
Port ScopedDisableInternalMouseAndKeyboardX11 to Ozone
BUG=401598
TEST=Manual, see bug
Review URL: https://codereview.chromium.org/806693009
Cr-Commit-Position: refs/heads/master@{#311505}
Diffstat (limited to 'ash/wm')
3 files changed, 77 insertions, 0 deletions
diff --git a/ash/wm/maximize_mode/maximize_mode_controller.cc b/ash/wm/maximize_mode/maximize_mode_controller.cc index f391de7..1463a50 100644 --- a/ash/wm/maximize_mode/maximize_mode_controller.cc +++ b/ash/wm/maximize_mode/maximize_mode_controller.cc @@ -24,6 +24,10 @@ #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" #endif +#if defined(USE_OZONE) +#include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h" +#endif + #if defined(OS_CHROMEOS) #include "chromeos/dbus/dbus_thread_manager.h" #endif // OS_CHROMEOS @@ -226,6 +230,8 @@ void MaximizeModeController::HandleHingeRotation(const gfx::Vector3dF& base, } #if defined(USE_X11) event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); +#elif defined(USE_OZONE) + event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardOzone); #endif } } 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 0000000..ddc8452 --- /dev/null +++ b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc @@ -0,0 +1,44 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// 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(); + } + + // 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 diff --git a/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h new file mode 100644 index 0000000..2376504 --- /dev/null +++ b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h @@ -0,0 +1,27 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_WM_MAXIMIZE_MODE_SCOPED_DISABLE_INTERNAL_MOUSE_AND_KEYBOARD_OZONE_H_ +#define ASH_WM_MAXIMIZE_MODE_SCOPED_DISABLE_INTERNAL_MOUSE_AND_KEYBOARD_OZONE_H_ + +#include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard.h" +#include "base/macros.h" + +namespace ash { + +// Disables the internal mouse and keyboard for the duration of the class' +// lifetime. +class ScopedDisableInternalMouseAndKeyboardOzone + : public ScopedDisableInternalMouseAndKeyboard { + public: + ScopedDisableInternalMouseAndKeyboardOzone(); + ~ScopedDisableInternalMouseAndKeyboardOzone() override; + + private: + DISALLOW_COPY_AND_ASSIGN(ScopedDisableInternalMouseAndKeyboardOzone); +}; + +} // namespace ash + +#endif // ASH_WM_MAXIMIZE_MODE_SCOPED_DISABLE_INTERNAL_MOUSE_AND_KEYBOARD_OZONE_H_ |