| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_handler.h" | 5 #include "ui/events/event_handler.h" |
| 6 | 6 |
| 7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
| 8 #include "ui/events/event_dispatcher.h" | 8 #include "ui/events/event_dispatcher.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| 11 | 11 |
| 12 EventHandler::EventHandler() { | 12 EventHandler::EventHandler() { |
| 13 } | 13 } |
| 14 | 14 |
| 15 EventHandler::~EventHandler() { | 15 EventHandler::~EventHandler() { |
| 16 while (!dispatchers_.empty()) { | 16 while (!dispatchers_.empty()) { |
| 17 EventDispatcher* dispatcher = dispatchers_.top(); | 17 EventDispatcher* dispatcher = dispatchers_.top(); |
| 18 dispatchers_.pop(); | 18 dispatchers_.pop(); |
| 19 dispatcher->OnHandlerDestroyed(this); | 19 dispatcher->OnHandlerDestroyed(this); |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 | 22 |
| 23 void EventHandler::OnEvent(Event* event) { | 23 void EventHandler::OnEvent(Event* event) { |
| 24 // TODO(tdanderson): Encapsulate static_casts in ui::Event for all | 24 // TODO(tdanderson): Encapsulate static_casts in ui::Event for all |
| 25 // event types. | 25 // event types. |
| 26 if (event->IsKeyEvent()) | 26 if (event->flags() & ui::EF_TOUCH_ACCESSIBILITY) |
| 27 OnAccessibilityMouseEvent(static_cast<MouseEvent*>(event)); |
| 28 else if (event->IsKeyEvent()) |
| 27 OnKeyEvent(static_cast<KeyEvent*>(event)); | 29 OnKeyEvent(static_cast<KeyEvent*>(event)); |
| 28 else if (event->IsMouseEvent()) | 30 else if (event->IsMouseEvent()) |
| 29 OnMouseEvent(static_cast<MouseEvent*>(event)); | 31 OnMouseEvent(static_cast<MouseEvent*>(event)); |
| 30 else if (event->IsScrollEvent()) | 32 else if (event->IsScrollEvent()) |
| 31 OnScrollEvent(static_cast<ScrollEvent*>(event)); | 33 OnScrollEvent(static_cast<ScrollEvent*>(event)); |
| 32 else if (event->IsTouchEvent()) | 34 else if (event->IsTouchEvent()) |
| 33 OnTouchEvent(static_cast<TouchEvent*>(event)); | 35 OnTouchEvent(static_cast<TouchEvent*>(event)); |
| 34 else if (event->IsGestureEvent()) | 36 else if (event->IsGestureEvent()) |
| 35 OnGestureEvent(event->AsGestureEvent()); | 37 OnGestureEvent(event->AsGestureEvent()); |
| 36 else if (event->type() == ET_CANCEL_MODE) | 38 else if (event->type() == ET_CANCEL_MODE) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 48 | 50 |
| 49 void EventHandler::OnTouchEvent(TouchEvent* event) { | 51 void EventHandler::OnTouchEvent(TouchEvent* event) { |
| 50 } | 52 } |
| 51 | 53 |
| 52 void EventHandler::OnGestureEvent(GestureEvent* event) { | 54 void EventHandler::OnGestureEvent(GestureEvent* event) { |
| 53 } | 55 } |
| 54 | 56 |
| 55 void EventHandler::OnCancelMode(CancelModeEvent* event) { | 57 void EventHandler::OnCancelMode(CancelModeEvent* event) { |
| 56 } | 58 } |
| 57 | 59 |
| 60 void EventHandler::OnAccessibilityMouseEvent(MouseEvent* event) { |
| 61 } |
| 62 |
| 58 } // namespace ui | 63 } // namespace ui |
| OLD | NEW |