OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 "components/keyboard_lock/active_key_event_filter.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "components/keyboard_lock/active_key_event_filter_tracker.h" |
| 9 |
| 10 namespace keyboard_lock { |
| 11 |
| 12 ActiveKeyEventFilter::ActiveKeyEventFilter( |
| 13 const ActiveKeyEventFilterTracker* tracker) |
| 14 : tracker_(tracker) { |
| 15 DCHECK(tracker_); |
| 16 } |
| 17 |
| 18 ActiveKeyEventFilter::~ActiveKeyEventFilter() = default; |
| 19 |
| 20 bool ActiveKeyEventFilter::OnKeyDown(ui::KeyboardCode code, int flags) { |
| 21 KeyEventFilter* filter = tracker_->get(); |
| 22 if (!filter) { |
| 23 return false; |
| 24 } |
| 25 |
| 26 return filter->OnKeyDown(code, flags); |
| 27 } |
| 28 |
| 29 bool ActiveKeyEventFilter::OnKeyUp(ui::KeyboardCode code, int flags) { |
| 30 KeyEventFilter* filter = tracker_->get(); |
| 31 if (!filter) { |
| 32 return false; |
| 33 } |
| 34 |
| 35 return filter->OnKeyUp(code, flags); |
| 36 } |
| 37 |
| 38 } // namespace keyboard_lock |
OLD | NEW |