Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / ash / wm / maximize_mode / scoped_disable_internal_mouse_and_keyboard_ozone.cc
bloba6d0b64d196bb75d36d121ca319e83cfbbcd8581
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h"
7 #include <set>
9 #include "ash/shell.h"
10 #include "ui/aura/client/cursor_client.h"
11 #include "ui/events/keycodes/dom/dom_code.h"
12 #include "ui/ozone/public/input_controller.h"
13 #include "ui/ozone/public/ozone_platform.h"
15 namespace ash {
17 ScopedDisableInternalMouseAndKeyboardOzone::
18 ScopedDisableInternalMouseAndKeyboardOzone() {
19 ui::InputController* input_controller =
20 ui::OzonePlatform::GetInstance()->GetInputController();
21 if (input_controller->HasTouchpad()) {
22 input_controller->SetInternalTouchpadEnabled(false);
23 aura::client::GetCursorClient(Shell::GetInstance()->GetPrimaryRootWindow())
24 ->HideCursor();
27 // Allow the acccessible keys present on the side of some devices to continue
28 // working.
29 std::vector<ui::DomCode> allowed_keys;
30 allowed_keys.push_back(ui::DomCode::VOLUME_DOWN);
31 allowed_keys.push_back(ui::DomCode::VOLUME_UP);
32 allowed_keys.push_back(ui::DomCode::POWER);
33 input_controller->SetInternalKeyboardFilter(true /* enable_filter */,
34 allowed_keys);
37 ScopedDisableInternalMouseAndKeyboardOzone::
38 ~ScopedDisableInternalMouseAndKeyboardOzone() {
39 ui::InputController* input_controller =
40 ui::OzonePlatform::GetInstance()->GetInputController();
41 input_controller->SetInternalTouchpadEnabled(true);
42 input_controller->SetInternalKeyboardFilter(false /* enable_filter */,
43 std::vector<ui::DomCode>());
46 } // namespace ash