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 UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ | 5 #ifndef UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ |
6 #define UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ | 6 #define UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 WM_EXPORT aura::Window* GetModalTransient(aura::Window* window); | 28 WM_EXPORT aura::Window* GetModalTransient(aura::Window* window); |
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 WM_EXPORT WindowModalityController : public ui::EventHandler, | 33 class WM_EXPORT WindowModalityController : public ui::EventHandler, |
34 public aura::EnvObserver, | 34 public aura::EnvObserver, |
35 public aura::WindowObserver { | 35 public aura::WindowObserver { |
36 public: | 36 public: |
37 explicit WindowModalityController(ui::EventTarget* event_target); | 37 explicit WindowModalityController(ui::EventTarget* event_target); |
38 virtual ~WindowModalityController(); | 38 ~WindowModalityController() override; |
39 | 39 |
40 // Overridden from ui::EventHandler: | 40 // Overridden from ui::EventHandler: |
41 virtual void OnKeyEvent(ui::KeyEvent* event) override; | 41 void OnKeyEvent(ui::KeyEvent* event) override; |
42 virtual void OnMouseEvent(ui::MouseEvent* event) override; | 42 void OnMouseEvent(ui::MouseEvent* event) override; |
43 virtual void OnTouchEvent(ui::TouchEvent* event) override; | 43 void OnTouchEvent(ui::TouchEvent* event) override; |
44 | 44 |
45 // Overridden from aura::EnvObserver: | 45 // Overridden from aura::EnvObserver: |
46 virtual void OnWindowInitialized(aura::Window* window) override; | 46 void OnWindowInitialized(aura::Window* window) override; |
47 | 47 |
48 // Overridden from aura::WindowObserver: | 48 // Overridden from aura::WindowObserver: |
49 virtual void OnWindowPropertyChanged(aura::Window* window, | 49 void OnWindowPropertyChanged(aura::Window* window, |
50 const void* key, | 50 const void* key, |
51 intptr_t old) override; | 51 intptr_t old) override; |
52 virtual void OnWindowVisibilityChanged(aura::Window* window, | 52 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
53 bool visible) override; | 53 void OnWindowDestroyed(aura::Window* window) override; |
54 virtual void OnWindowDestroyed(aura::Window* window) override; | |
55 | 54 |
56 private: | 55 private: |
57 // Processes a mouse/touch event, and returns true if the event should be | 56 // Processes a mouse/touch event, and returns true if the event should be |
58 // consumed. | 57 // consumed. |
59 bool ProcessLocatedEvent(aura::Window* target, | 58 bool ProcessLocatedEvent(aura::Window* target, |
60 ui::LocatedEvent* event); | 59 ui::LocatedEvent* event); |
61 | 60 |
62 std::vector<aura::Window*> windows_; | 61 std::vector<aura::Window*> windows_; |
63 | 62 |
64 ui::EventTarget* event_target_; | 63 ui::EventTarget* event_target_; |
65 | 64 |
66 DISALLOW_COPY_AND_ASSIGN(WindowModalityController); | 65 DISALLOW_COPY_AND_ASSIGN(WindowModalityController); |
67 }; | 66 }; |
68 | 67 |
69 } // namespace wm | 68 } // namespace wm |
70 | 69 |
71 #endif // UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ | 70 #endif // UI_WM_CORE_WINDOW_MODALITY_CONTROLLER_H_ |
OLD | NEW |