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_WINDOW_MODALITY_CONTROLLER_H_ | 5 #ifndef ASH_WM_WINDOW_MODALITY_CONTROLLER_H_ |
6 #define ASH_WM_WINDOW_MODALITY_CONTROLLER_H_ | 6 #define ASH_WM_WINDOW_MODALITY_CONTROLLER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "ui/aura/env_observer.h" | 12 #include "ui/aura/env_observer.h" |
13 #include "ui/aura/event_filter.h" | 13 #include "ui/aura/event_filter.h" |
14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
15 | 15 |
16 namespace aura { | 16 namespace ui { |
17 class LocatedEvent; | 17 class LocatedEvent; |
18 } | 18 } |
19 | 19 |
20 namespace ash { | 20 namespace ash { |
21 | 21 |
22 namespace wm { | 22 namespace wm { |
23 // Returns the window-modal transient child of |window|, or NULL if |window| | 23 // Returns the window-modal transient child of |window|, or NULL if |window| |
24 // does not have any window-modal transient children. | 24 // does not have any window-modal transient children. |
25 ASH_EXPORT aura::Window* GetWindowModalTransient(aura::Window* window); | 25 ASH_EXPORT aura::Window* GetWindowModalTransient(aura::Window* window); |
26 } | 26 } |
27 | 27 |
28 namespace internal { | 28 namespace internal { |
29 | 29 |
30 // WindowModalityController is an event filter that consumes events sent to | 30 // WindowModalityController is an event filter that consumes events sent to |
31 // windows that are the transient parents of window-modal windows. This filter | 31 // windows that are the transient parents of window-modal windows. This filter |
32 // must be added to the CompoundEventFilter so that activation works properly. | 32 // must be added to the CompoundEventFilter so that activation works properly. |
33 class WindowModalityController : public aura::EventFilter, | 33 class WindowModalityController : public aura::EventFilter, |
34 public aura::EnvObserver, | 34 public aura::EnvObserver, |
35 public aura::WindowObserver { | 35 public aura::WindowObserver { |
36 public: | 36 public: |
37 WindowModalityController(); | 37 WindowModalityController(); |
38 virtual ~WindowModalityController(); | 38 virtual ~WindowModalityController(); |
39 | 39 |
40 // Overridden from aura::EventFilter: | 40 // Overridden from aura::EventFilter: |
41 virtual bool PreHandleKeyEvent(aura::Window* target, | 41 virtual bool PreHandleKeyEvent(aura::Window* target, |
42 aura::KeyEvent* event) OVERRIDE; | 42 ui::KeyEvent* event) OVERRIDE; |
43 virtual bool PreHandleMouseEvent(aura::Window* target, | 43 virtual bool PreHandleMouseEvent(aura::Window* target, |
44 aura::MouseEvent* event) OVERRIDE; | 44 ui::MouseEvent* event) OVERRIDE; |
45 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, | 45 virtual ui::TouchStatus PreHandleTouchEvent( |
46 aura::TouchEvent* event) OVERRIDE; | 46 aura::Window* target, |
| 47 ui::TouchEventImpl* event) OVERRIDE; |
47 virtual ui::GestureStatus PreHandleGestureEvent( | 48 virtual ui::GestureStatus PreHandleGestureEvent( |
48 aura::Window* target, | 49 aura::Window* target, |
49 aura::GestureEvent* event) OVERRIDE; | 50 ui::GestureEventImpl* event) OVERRIDE; |
50 | 51 |
51 // Overridden from aura::EnvObserver: | 52 // Overridden from aura::EnvObserver: |
52 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; | 53 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; |
53 | 54 |
54 // Overridden from aura::WindowObserver: | 55 // Overridden from aura::WindowObserver: |
55 virtual void OnWindowVisibilityChanged(aura::Window* window, | 56 virtual void OnWindowVisibilityChanged(aura::Window* window, |
56 bool visible) OVERRIDE; | 57 bool visible) OVERRIDE; |
57 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 58 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
58 | 59 |
59 private: | 60 private: |
60 // Processes a mouse/touch event, and returns true if the event should be | 61 // Processes a mouse/touch event, and returns true if the event should be |
61 // consumed. | 62 // consumed. |
62 bool ProcessLocatedEvent(aura::Window* target, | 63 bool ProcessLocatedEvent(aura::Window* target, |
63 aura::LocatedEvent* event); | 64 ui::LocatedEvent* event); |
64 | 65 |
65 std::vector<aura::Window*> windows_; | 66 std::vector<aura::Window*> windows_; |
66 | 67 |
67 DISALLOW_COPY_AND_ASSIGN(WindowModalityController); | 68 DISALLOW_COPY_AND_ASSIGN(WindowModalityController); |
68 }; | 69 }; |
69 | 70 |
70 } // namespace internal | 71 } // namespace internal |
71 } // namespace ash | 72 } // namespace ash |
72 | 73 |
73 #endif // ASH_WM_WINDOW_MODALITY_CONTROLLER_H_ | 74 #endif // ASH_WM_WINDOW_MODALITY_CONTROLLER_H_ |
OLD | NEW |