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