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

Side by Side Diff: ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc

Issue 2906803002: Rename MaximizeMode to TabletMode (Closed)
Patch Set: updated filter Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone. h"
6
7 #include <set>
8
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"
14
15 namespace ash {
16
17 ScopedDisableInternalMouseAndKeyboardOzone::
18 ScopedDisableInternalMouseAndKeyboardOzone() {
19 ui::InputController* input_controller =
20 ui::OzonePlatform::GetInstance()->GetInputController();
21 if (input_controller->HasTouchpad() &&
22 input_controller->IsInternalTouchpadEnabled()) {
23 should_ignore_touch_pad_ = false;
24 input_controller->SetInternalTouchpadEnabled(false);
25 Shell::Get()->cursor_manager()->HideCursor();
26 }
27
28 // Allow the acccessible keys present on the side of some devices to continue
29 // working.
30 std::vector<ui::DomCode> allowed_keys;
31 allowed_keys.push_back(ui::DomCode::VOLUME_DOWN);
32 allowed_keys.push_back(ui::DomCode::VOLUME_UP);
33 allowed_keys.push_back(ui::DomCode::POWER);
34 input_controller->SetInternalKeyboardFilter(true /* enable_filter */,
35 allowed_keys);
36 }
37
38 ScopedDisableInternalMouseAndKeyboardOzone::
39 ~ScopedDisableInternalMouseAndKeyboardOzone() {
40 ui::InputController* input_controller =
41 ui::OzonePlatform::GetInstance()->GetInputController();
42
43 if (!should_ignore_touch_pad_) {
44 input_controller->SetInternalTouchpadEnabled(true);
45 Shell::Get()->cursor_manager()->ShowCursor();
46 }
47
48 input_controller->SetInternalKeyboardFilter(false /* enable_filter */,
49 std::vector<ui::DomCode>());
50 }
51
52 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698