| Index: components/mus/ws/event_matcher.cc
|
| diff --git a/components/mus/ws/accelerator.cc b/components/mus/ws/event_matcher.cc
|
| similarity index 75%
|
| copy from components/mus/ws/accelerator.cc
|
| copy to components/mus/ws/event_matcher.cc
|
| index b27ad285e68d08fe44110af20345f41e70394242..bb0659bd53935d4bcb91b8b6e4a883c2322a01c8 100644
|
| --- a/components/mus/ws/accelerator.cc
|
| +++ b/components/mus/ws/event_matcher.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "components/mus/ws/accelerator.h"
|
| +#include "components/mus/ws/event_matcher.h"
|
|
|
| #include "mojo/converters/geometry/geometry_type_converters.h"
|
| #include "mojo/converters/input_events/input_events_type_converters.h"
|
| @@ -10,16 +10,13 @@
|
| namespace mus {
|
| namespace ws {
|
|
|
| -Accelerator::Accelerator(uint32_t id, const mojom::EventMatcher& matcher)
|
| - : id_(id),
|
| - fields_to_match_(NONE),
|
| - accelerator_phase_(matcher.accelerator_phase),
|
| +EventMatcher::EventMatcher(const mojom::EventMatcher& matcher)
|
| + : fields_to_match_(NONE),
|
| event_type_(ui::ET_UNKNOWN),
|
| event_flags_(ui::EF_NONE),
|
| ignore_event_flags_(ui::EF_NONE),
|
| keyboard_code_(ui::VKEY_UNKNOWN),
|
| - pointer_type_(ui::EventPointerType::POINTER_TYPE_UNKNOWN),
|
| - weak_factory_(this) {
|
| + pointer_type_(ui::EventPointerType::POINTER_TYPE_UNKNOWN) {
|
| if (matcher.type_matcher) {
|
| fields_to_match_ |= TYPE;
|
| switch (matcher.type_matcher->type) {
|
| @@ -77,12 +74,9 @@ Accelerator::Accelerator(uint32_t id, const mojom::EventMatcher& matcher)
|
| }
|
| }
|
|
|
| -Accelerator::~Accelerator() {}
|
| +EventMatcher::~EventMatcher() {}
|
|
|
| -bool Accelerator::MatchesEvent(const ui::Event& event,
|
| - const mojom::AcceleratorPhase phase) const {
|
| - if (accelerator_phase_ != phase)
|
| - return false;
|
| +bool EventMatcher::MatchesEvent(const ui::Event& event) const {
|
| if ((fields_to_match_ & TYPE) && event.type() != event_type_)
|
| return false;
|
| int flags = event.flags() & ~ignore_event_flags_;
|
| @@ -105,19 +99,17 @@ bool Accelerator::MatchesEvent(const ui::Event& event,
|
| NOTIMPLEMENTED();
|
| return false;
|
| }
|
| -
|
| return true;
|
| }
|
|
|
| -bool Accelerator::EqualEventMatcher(const Accelerator* other) const {
|
| - return fields_to_match_ == other->fields_to_match_ &&
|
| - accelerator_phase_ == other->accelerator_phase_ &&
|
| - event_type_ == other->event_type_ &&
|
| - event_flags_ == other->event_flags_ &&
|
| - ignore_event_flags_ == other->ignore_event_flags_ &&
|
| - keyboard_code_ == other->keyboard_code_ &&
|
| - pointer_type_ == other->pointer_type_ &&
|
| - pointer_region_ == other->pointer_region_;
|
| +bool EventMatcher::Equals(const EventMatcher& other) const {
|
| + return fields_to_match_ == other.fields_to_match_ &&
|
| + event_type_ == other.event_type_ &&
|
| + event_flags_ == other.event_flags_ &&
|
| + ignore_event_flags_ == other.ignore_event_flags_ &&
|
| + keyboard_code_ == other.keyboard_code_ &&
|
| + pointer_type_ == other.pointer_type_ &&
|
| + pointer_region_ == other.pointer_region_;
|
| }
|
|
|
| } // namespace ws
|
|
|