| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/events/event_rewriter.h" | 5 #include "ui/events/event_rewriter.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // removal, and sequencing. Consequently EVENT_REWRITE_DISPATCH_ANOTHER is not | 77 // removal, and sequencing. Consequently EVENT_REWRITE_DISPATCH_ANOTHER is not |
| 78 // supported here (calls to NextDispatchEvent() would continue indefinitely). | 78 // supported here (calls to NextDispatchEvent() would continue indefinitely). |
| 79 class TestConstantEventRewriter : public EventRewriter { | 79 class TestConstantEventRewriter : public EventRewriter { |
| 80 public: | 80 public: |
| 81 TestConstantEventRewriter(EventRewriteStatus status, EventType type) | 81 TestConstantEventRewriter(EventRewriteStatus status, EventType type) |
| 82 : status_(status), type_(type) { | 82 : status_(status), type_(type) { |
| 83 CHECK_NE(EVENT_REWRITE_DISPATCH_ANOTHER, status); | 83 CHECK_NE(EVENT_REWRITE_DISPATCH_ANOTHER, status); |
| 84 } | 84 } |
| 85 | 85 |
| 86 EventRewriteStatus RewriteEvent(const Event& event, | 86 EventRewriteStatus RewriteEvent(const Event& event, |
| 87 scoped_ptr<Event>* rewritten_event) | 87 scoped_ptr<Event>* rewritten_event) override { |
| 88 override { | |
| 89 if (status_ == EVENT_REWRITE_REWRITTEN) | 88 if (status_ == EVENT_REWRITE_REWRITTEN) |
| 90 rewritten_event->reset(new TestEvent(type_)); | 89 rewritten_event->reset(new TestEvent(type_)); |
| 91 return status_; | 90 return status_; |
| 92 } | 91 } |
| 93 EventRewriteStatus NextDispatchEvent(const Event& last_event, | 92 EventRewriteStatus NextDispatchEvent(const Event& last_event, |
| 94 scoped_ptr<Event>* new_event) override { | 93 scoped_ptr<Event>* new_event) override { |
| 95 NOTREACHED(); | 94 NOTREACHED(); |
| 96 return status_; | 95 return status_; |
| 97 } | 96 } |
| 98 | 97 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 s.RemoveEventRewriter(&r3); | 218 s.RemoveEventRewriter(&r3); |
| 220 | 219 |
| 221 // Continue with the state-based rewriting. | 220 // Continue with the state-based rewriting. |
| 222 p.AddExpectedEvent(ET_MOUSE_RELEASED); | 221 p.AddExpectedEvent(ET_MOUSE_RELEASED); |
| 223 p.AddExpectedEvent(ET_KEY_RELEASED); | 222 p.AddExpectedEvent(ET_KEY_RELEASED); |
| 224 s.Send(ET_MOUSE_RELEASED); | 223 s.Send(ET_MOUSE_RELEASED); |
| 225 p.CheckAllReceived(); | 224 p.CheckAllReceived(); |
| 226 } | 225 } |
| 227 | 226 |
| 228 } // namespace ui | 227 } // namespace ui |
| OLD | NEW |