Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Side by Side Diff: components/mus/ws/event_matcher.cc

Issue 2008193002: Change mojo geometry structs from using type converters to StructTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/event_matcher.h" 5 #include "components/mus/ws/event_matcher.h"
6 6
7 #include "ui/events/mojo/input_events_type_converters.h" 7 #include "ui/events/mojo/input_events_type_converters.h"
8 #include "ui/gfx/geometry/mojo/geometry_type_converters.h"
9 8
10 namespace mus { 9 namespace mus {
11 namespace ws { 10 namespace ws {
12 11
13 EventMatcher::EventMatcher(const mojom::EventMatcher& matcher) 12 EventMatcher::EventMatcher(const mojom::EventMatcher& matcher)
14 : fields_to_match_(NONE), 13 : fields_to_match_(NONE),
15 event_type_(ui::ET_UNKNOWN), 14 event_type_(ui::ET_UNKNOWN),
16 event_flags_(ui::EF_NONE), 15 event_flags_(ui::EF_NONE),
17 ignore_event_flags_(ui::EF_NONE), 16 ignore_event_flags_(ui::EF_NONE),
18 keyboard_code_(ui::VKEY_UNKNOWN), 17 keyboard_code_(ui::VKEY_UNKNOWN),
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 break; 62 break;
64 case mojom::PointerKind::TOUCH: 63 case mojom::PointerKind::TOUCH:
65 pointer_type_ = ui::EventPointerType::POINTER_TYPE_TOUCH; 64 pointer_type_ = ui::EventPointerType::POINTER_TYPE_TOUCH;
66 break; 65 break;
67 default: 66 default:
68 NOTREACHED(); 67 NOTREACHED();
69 } 68 }
70 } 69 }
71 if (matcher.pointer_location_matcher) { 70 if (matcher.pointer_location_matcher) {
72 fields_to_match_ |= POINTER_LOCATION; 71 fields_to_match_ |= POINTER_LOCATION;
73 pointer_region_ = matcher.pointer_location_matcher->region.To<gfx::RectF>(); 72 pointer_region_ = matcher.pointer_location_matcher->region;
74 } 73 }
75 } 74 }
76 75
77 EventMatcher::~EventMatcher() {} 76 EventMatcher::~EventMatcher() {}
78 77
79 bool EventMatcher::MatchesEvent(const ui::Event& event) const { 78 bool EventMatcher::MatchesEvent(const ui::Event& event) const {
80 if ((fields_to_match_ & TYPE) && event.type() != event_type_) 79 if ((fields_to_match_ & TYPE) && event.type() != event_type_)
81 return false; 80 return false;
82 int flags = event.flags() & ~ignore_event_flags_; 81 int flags = event.flags() & ~ignore_event_flags_;
83 if ((fields_to_match_ & FLAGS) && flags != event_flags_) 82 if ((fields_to_match_ & FLAGS) && flags != event_flags_)
(...skipping 23 matching lines...) Expand all
107 event_type_ == other.event_type_ && 106 event_type_ == other.event_type_ &&
108 event_flags_ == other.event_flags_ && 107 event_flags_ == other.event_flags_ &&
109 ignore_event_flags_ == other.ignore_event_flags_ && 108 ignore_event_flags_ == other.ignore_event_flags_ &&
110 keyboard_code_ == other.keyboard_code_ && 109 keyboard_code_ == other.keyboard_code_ &&
111 pointer_type_ == other.pointer_type_ && 110 pointer_type_ == other.pointer_type_ &&
112 pointer_region_ == other.pointer_region_; 111 pointer_region_ == other.pointer_region_;
113 } 112 }
114 113
115 } // namespace ws 114 } // namespace ws
116 } // namespace mus 115 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698