OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/login/ui/input_events_blocker.h" | 5 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/ui/ash/ash_util.h" | 9 #include "chrome/browser/ui/ash/ash_util.h" |
10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
11 | 11 |
12 namespace chromeos { | 12 namespace chromeos { |
13 | 13 |
14 InputEventsBlocker::InputEventsBlocker() { | 14 InputEventsBlocker::InputEventsBlocker() { |
15 // TODO(mash): Implement a mash version. This will probably need to talk to | 15 // TODO(mash): Implement a mash version. This will probably need to talk to |
16 // the window server. | 16 // the window server. |
17 if (!ash_util::IsRunningInMash()) { | 17 if (!IsRunningInMash()) { |
18 ash::Shell::GetInstance()->PrependPreTargetHandler(this); | 18 ash::Shell::GetInstance()->PrependPreTargetHandler(this); |
19 VLOG(1) << "InputEventsBlocker " << this << " created."; | 19 VLOG(1) << "InputEventsBlocker " << this << " created."; |
20 } else { | 20 } else { |
21 NOTIMPLEMENTED(); | 21 NOTIMPLEMENTED(); |
22 } | 22 } |
23 } | 23 } |
24 | 24 |
25 InputEventsBlocker::~InputEventsBlocker() { | 25 InputEventsBlocker::~InputEventsBlocker() { |
26 if (!ash_util::IsRunningInMash()) { | 26 if (!IsRunningInMash()) { |
27 ash::Shell::GetInstance()->RemovePreTargetHandler(this); | 27 ash::Shell::GetInstance()->RemovePreTargetHandler(this); |
28 VLOG(1) << "InputEventsBlocker " << this << " destroyed."; | 28 VLOG(1) << "InputEventsBlocker " << this << " destroyed."; |
29 } else { | 29 } else { |
30 NOTIMPLEMENTED(); | 30 NOTIMPLEMENTED(); |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 void InputEventsBlocker::OnKeyEvent(ui::KeyEvent* event) { | 34 void InputEventsBlocker::OnKeyEvent(ui::KeyEvent* event) { |
35 event->StopPropagation(); | 35 event->StopPropagation(); |
36 } | 36 } |
37 | 37 |
38 void InputEventsBlocker::OnMouseEvent(ui::MouseEvent* event) { | 38 void InputEventsBlocker::OnMouseEvent(ui::MouseEvent* event) { |
39 event->StopPropagation(); | 39 event->StopPropagation(); |
40 } | 40 } |
41 | 41 |
42 void InputEventsBlocker::OnTouchEvent(ui::TouchEvent* event) { | 42 void InputEventsBlocker::OnTouchEvent(ui::TouchEvent* event) { |
43 event->StopPropagation(); | 43 event->StopPropagation(); |
44 } | 44 } |
45 | 45 |
46 void InputEventsBlocker::OnGestureEvent(ui::GestureEvent* event) { | 46 void InputEventsBlocker::OnGestureEvent(ui::GestureEvent* event) { |
47 event->StopPropagation(); | 47 event->StopPropagation(); |
48 } | 48 } |
49 | 49 |
50 } // namespace chromeos | 50 } // namespace chromeos |
OLD | NEW |