Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6026)

Unified Diff: ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc

Issue 806693009: Port ScopedDisableInternalMouseAndKeyboardX11 to Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..ddc8452b69ab7034b336414800bfd82b59197ef8
--- /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
« no previous file with comments | « ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h ('k') | ui/events/ozone/evdev/event_converter_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698