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

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

Issue 1412623006: Developer Feature: Add Debug Accelerators to Toggle Touchscreen/Touchpad On or Off (CrOS) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix actions.xml. Created 5 years, 2 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone. h" 5 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone. h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ui/aura/client/cursor_client.h" 10 #include "ui/aura/client/cursor_client.h"
11 #include "ui/events/keycodes/dom/dom_code.h" 11 #include "ui/events/keycodes/dom/dom_code.h"
12 #include "ui/ozone/public/input_controller.h" 12 #include "ui/ozone/public/input_controller.h"
13 #include "ui/ozone/public/ozone_platform.h" 13 #include "ui/ozone/public/ozone_platform.h"
14 14
15 namespace ash { 15 namespace ash {
16 16
17 ScopedDisableInternalMouseAndKeyboardOzone:: 17 ScopedDisableInternalMouseAndKeyboardOzone::
18 ScopedDisableInternalMouseAndKeyboardOzone() { 18 ScopedDisableInternalMouseAndKeyboardOzone()
19 : should_ignore_touch_pad_(true) {
19 ui::InputController* input_controller = 20 ui::InputController* input_controller =
20 ui::OzonePlatform::GetInstance()->GetInputController(); 21 ui::OzonePlatform::GetInstance()->GetInputController();
21 if (input_controller->HasTouchpad()) { 22 if (input_controller->HasTouchpad() &&
23 input_controller->IsInternalTouchpadEnabled()) {
24 should_ignore_touch_pad_ = false;
22 input_controller->SetInternalTouchpadEnabled(false); 25 input_controller->SetInternalTouchpadEnabled(false);
23 aura::client::GetCursorClient(Shell::GetInstance()->GetPrimaryRootWindow()) 26 aura::client::GetCursorClient(Shell::GetInstance()->GetPrimaryRootWindow())
oshima 2015/10/29 23:38:43 Shell::GetInstnace()->cursor_manager()->HideCursor
afakhry 2015/10/30 05:18:03 Done.
24 ->HideCursor(); 27 ->HideCursor();
25 } 28 }
26 29
27 // Allow the acccessible keys present on the side of some devices to continue 30 // Allow the acccessible keys present on the side of some devices to continue
28 // working. 31 // working.
29 std::vector<ui::DomCode> allowed_keys; 32 std::vector<ui::DomCode> allowed_keys;
30 allowed_keys.push_back(ui::DomCode::VOLUME_DOWN); 33 allowed_keys.push_back(ui::DomCode::VOLUME_DOWN);
31 allowed_keys.push_back(ui::DomCode::VOLUME_UP); 34 allowed_keys.push_back(ui::DomCode::VOLUME_UP);
32 allowed_keys.push_back(ui::DomCode::POWER); 35 allowed_keys.push_back(ui::DomCode::POWER);
33 input_controller->SetInternalKeyboardFilter(true /* enable_filter */, 36 input_controller->SetInternalKeyboardFilter(true /* enable_filter */,
34 allowed_keys); 37 allowed_keys);
35 } 38 }
36 39
37 ScopedDisableInternalMouseAndKeyboardOzone:: 40 ScopedDisableInternalMouseAndKeyboardOzone::
38 ~ScopedDisableInternalMouseAndKeyboardOzone() { 41 ~ScopedDisableInternalMouseAndKeyboardOzone() {
39 ui::InputController* input_controller = 42 ui::InputController* input_controller =
40 ui::OzonePlatform::GetInstance()->GetInputController(); 43 ui::OzonePlatform::GetInstance()->GetInputController();
41 input_controller->SetInternalTouchpadEnabled(true); 44
45 if (!should_ignore_touch_pad_)
46 input_controller->SetInternalTouchpadEnabled(true);
47
42 input_controller->SetInternalKeyboardFilter(false /* enable_filter */, 48 input_controller->SetInternalKeyboardFilter(false /* enable_filter */,
43 std::vector<ui::DomCode>()); 49 std::vector<ui::DomCode>());
44 } 50 }
45 51
46 } // namespace ash 52 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698