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 #ifndef ASH_WM_TOPLEVEL_WINDOW_EVENT_FILTER_H_ | 5 #ifndef ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ |
6 #define ASH_WM_TOPLEVEL_WINDOW_EVENT_FILTER_H_ | 6 #define ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "ui/aura/client/window_move_client.h" | 14 #include "ui/aura/client/window_move_client.h" |
15 #include "ui/aura/event_filter.h" | 15 #include "ui/base/events/event_handler.h" |
16 #include "ui/gfx/point.h" | 16 #include "ui/gfx/point.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
20 class Window; | 20 class Window; |
21 } | 21 } |
22 | 22 |
23 namespace ui { | 23 namespace ui { |
24 class LocatedEvent; | 24 class LocatedEvent; |
25 } | 25 } |
26 | 26 |
27 namespace ash { | 27 namespace ash { |
28 | 28 |
29 class WindowResizer; | 29 class WindowResizer; |
30 | 30 |
31 class ASH_EXPORT ToplevelWindowEventFilter | 31 class ASH_EXPORT ToplevelWindowEventHandler |
32 : public aura::EventFilter, | 32 : public ui::EventHandler, |
33 public aura::client::WindowMoveClient { | 33 public aura::client::WindowMoveClient { |
34 public: | 34 public: |
35 explicit ToplevelWindowEventFilter(aura::Window* owner); | 35 explicit ToplevelWindowEventHandler(aura::Window* owner); |
36 virtual ~ToplevelWindowEventFilter(); | 36 virtual ~ToplevelWindowEventHandler(); |
37 | 37 |
38 // Overridden from aura::EventFilter: | 38 // Overridden from ui::EventHandler: |
39 virtual bool PreHandleKeyEvent(aura::Window* target, | 39 virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
40 ui::KeyEvent* event) OVERRIDE; | 40 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
41 virtual bool PreHandleMouseEvent(aura::Window* target, | 41 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
42 ui::MouseEvent* event) OVERRIDE; | 42 virtual ui::TouchStatus OnTouchEvent(ui::TouchEvent* event) OVERRIDE; |
43 virtual ui::TouchStatus PreHandleTouchEvent( | 43 virtual ui::EventResult OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
44 aura::Window* target, | |
45 ui::TouchEvent* event) OVERRIDE; | |
46 virtual ui::EventResult PreHandleGestureEvent( | |
47 aura::Window* target, | |
48 ui::GestureEvent* event) OVERRIDE; | |
49 | 44 |
50 // Overridden form aura::client::WindowMoveClient: | 45 // Overridden form aura::client::WindowMoveClient: |
51 virtual void RunMoveLoop(aura::Window* source, | 46 virtual void RunMoveLoop(aura::Window* source, |
52 const gfx::Point& drag_offset) OVERRIDE; | 47 const gfx::Point& drag_offset) OVERRIDE; |
53 virtual void EndMoveLoop() OVERRIDE; | 48 virtual void EndMoveLoop() OVERRIDE; |
54 | 49 |
55 protected: | 50 protected: |
56 // Creates a new WindowResizer. | 51 // Creates a new WindowResizer. |
57 virtual WindowResizer* CreateWindowResizer(aura::Window* window, | 52 virtual WindowResizer* CreateWindowResizer(aura::Window* window, |
58 const gfx::Point& point_in_parent, | 53 const gfx::Point& point_in_parent, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Are we running a nested message loop from RunMoveLoop(). | 86 // Are we running a nested message loop from RunMoveLoop(). |
92 bool in_move_loop_; | 87 bool in_move_loop_; |
93 | 88 |
94 // Is a gesture-resize in progress? | 89 // Is a gesture-resize in progress? |
95 bool in_gesture_resize_; | 90 bool in_gesture_resize_; |
96 | 91 |
97 scoped_ptr<ScopedWindowResizer> window_resizer_; | 92 scoped_ptr<ScopedWindowResizer> window_resizer_; |
98 | 93 |
99 base::Closure quit_closure_; | 94 base::Closure quit_closure_; |
100 | 95 |
101 DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventFilter); | 96 DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventHandler); |
102 }; | 97 }; |
103 | 98 |
104 } // namespace aura | 99 } // namespace aura |
105 | 100 |
106 #endif // ASH_WM_TOPLEVEL_WINDOW_EVENT_FILTER_H_ | 101 #endif // ASH_WM_TOPLEVEL_WINDOW_EVENT_HANDLER_H_ |
OLD | NEW |