Chromium Code Reviews| 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 #ifndef COMPONENTS_MUS_WS_EVENT_TESTER_H_ | |
| 6 #define COMPONENTS_MUS_WS_EVENT_TESTER_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "components/mus/public/interfaces/input_event_constants.mojom.h" | |
| 12 #include "components/mus/public/interfaces/input_event_matcher.mojom.h" | |
| 13 #include "components/mus/public/interfaces/input_key_codes.mojom.h" | |
| 14 #include "ui/events/event.h" | |
| 15 #include "ui/gfx/geometry/rect_f.h" | |
| 16 | |
| 17 namespace mus { | |
| 18 namespace ws { | |
| 19 | |
| 20 // Wraps a mojom::EventMatcher and allows events to be tested against it. | |
|
sky
2016/04/21 17:23:03
The reason we started putting the interfaces/struc
James Cook
2016/04/22 18:22:54
Done. There was a different file called event_matc
| |
| 21 class EventTester { | |
| 22 public: | |
| 23 explicit EventTester(const mojom::EventMatcher& matcher); | |
| 24 ~EventTester(); | |
| 25 | |
| 26 bool MatchesEvent(const ui::Event& event) const; | |
| 27 | |
| 28 bool Equals(const EventTester& other) const; | |
| 29 | |
| 30 private: | |
| 31 enum MatchFields { | |
| 32 NONE = 0, | |
| 33 TYPE = 1 << 0, | |
| 34 FLAGS = 1 << 1, | |
| 35 KEYBOARD_CODE = 1 << 2, | |
| 36 POINTER_KIND = 1 << 3, | |
| 37 POINTER_LOCATION = 1 << 4, | |
| 38 }; | |
| 39 | |
| 40 uint32_t fields_to_match_; | |
| 41 ui::EventType event_type_; | |
| 42 // Bitfields of kEventFlag* and kMouseEventFlag* values in | |
| 43 // input_event_constants.mojom. | |
| 44 int event_flags_; | |
| 45 int ignore_event_flags_; | |
| 46 uint16_t keyboard_code_; | |
| 47 ui::EventPointerType pointer_type_; | |
| 48 gfx::RectF pointer_region_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(EventTester); | |
| 51 }; | |
| 52 | |
| 53 } // namespace ws | |
| 54 } // namespace mus | |
| 55 | |
| 56 #endif // COMPONENTS_MUS_WS_EVENT_TESTER_H_ | |
| OLD | NEW |