Fix typo in AshWindowTreeHostOzone
[chromium-blink-merge.git] / ui / events / event_handler.cc
blob243007a5553d64f52d830bb03d0ab4aed8bb5df4
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
3 // found in the LICENSE file.
5 #include "ui/events/event_handler.h"
7 #include "ui/events/event.h"
8 #include "ui/events/event_dispatcher.h"
10 namespace ui {
12 EventHandler::EventHandler() {
15 EventHandler::~EventHandler() {
16 while (!dispatchers_.empty()) {
17 EventDispatcher* dispatcher = dispatchers_.top();
18 dispatchers_.pop();
19 dispatcher->OnHandlerDestroyed(this);
23 void EventHandler::OnEvent(Event* event) {
24 if (event->IsKeyEvent())
25 OnKeyEvent(static_cast<KeyEvent*>(event));
26 else if (event->IsMouseEvent())
27 OnMouseEvent(static_cast<MouseEvent*>(event));
28 else if (event->IsScrollEvent())
29 OnScrollEvent(static_cast<ScrollEvent*>(event));
30 else if (event->IsTouchEvent())
31 OnTouchEvent(static_cast<TouchEvent*>(event));
32 else if (event->IsGestureEvent())
33 OnGestureEvent(static_cast<GestureEvent*>(event));
34 else if (event->type() == ET_CANCEL_MODE)
35 OnCancelMode(static_cast<CancelModeEvent*>(event));
38 void EventHandler::OnKeyEvent(KeyEvent* event) {
41 void EventHandler::OnMouseEvent(MouseEvent* event) {
44 void EventHandler::OnScrollEvent(ScrollEvent* event) {
47 void EventHandler::OnTouchEvent(TouchEvent* event) {
50 void EventHandler::OnGestureEvent(GestureEvent* event) {
53 void EventHandler::OnCancelMode(CancelModeEvent* event) {
56 } // namespace ui