| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 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/mus/ws/accelerator.h" | |
| 6 | |
| 7 namespace mus { | |
| 8 namespace ws { | |
| 9 | |
| 10 Accelerator::Accelerator(uint32_t id, const mojom::EventMatcher& matcher) | |
| 11 : id_(id), | |
| 12 accelerator_phase_(matcher.accelerator_phase), | |
| 13 event_matcher_(matcher), | |
| 14 weak_factory_(this) {} | |
| 15 | |
| 16 Accelerator::~Accelerator() {} | |
| 17 | |
| 18 bool Accelerator::MatchesEvent(const ui::Event& event, | |
| 19 const ui::mojom::AcceleratorPhase phase) const { | |
| 20 if (accelerator_phase_ != phase) | |
| 21 return false; | |
| 22 if (!event_matcher_.MatchesEvent(event)) | |
| 23 return false; | |
| 24 return true; | |
| 25 } | |
| 26 | |
| 27 bool Accelerator::EqualEventMatcher(const Accelerator* other) const { | |
| 28 return accelerator_phase_ == other->accelerator_phase_ && | |
| 29 event_matcher_.Equals(other->event_matcher_); | |
| 30 } | |
| 31 | |
| 32 } // namespace ws | |
| 33 } // namespace mus | |
| OLD | NEW |