OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_ | 5 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_ |
6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_ | 6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_ |
7 | 7 |
| 8 #include <set> |
| 9 |
8 #include "ash/shell_observer.h" | 10 #include "ash/shell_observer.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
11 #include "ui/aura/scoped_window_targeter.h" | 13 #include "ui/aura/scoped_window_targeter.h" |
12 | 14 |
13 namespace aura { | 15 namespace aura { |
14 class Window; | 16 class Window; |
15 } // namespace aura | 17 } // namespace aura |
16 | 18 |
17 namespace ash { | 19 namespace ash { |
18 | 20 |
19 // A class which blocks mouse and keyboard events while instantiated by | 21 // A class which blocks mouse and keyboard events while instantiated by |
20 // replacing the root window event targeter. | 22 // replacing the root window event targeter. |
21 class MaximizeModeEventBlocker : public ShellObserver { | 23 class MaximizeModeEventBlocker : public ShellObserver { |
22 public: | 24 public: |
23 MaximizeModeEventBlocker(); | 25 MaximizeModeEventBlocker(); |
24 virtual ~MaximizeModeEventBlocker(); | 26 virtual ~MaximizeModeEventBlocker(); |
25 | 27 |
26 // ShellObserver: | 28 // ShellObserver: |
27 virtual void OnRootWindowAdded(aura::Window* root_window) OVERRIDE; | 29 virtual void OnRootWindowAdded(aura::Window* root_window) OVERRIDE; |
28 | 30 |
29 private: | 31 private: |
30 // Adds an event targeter on |root_window| to block mouse and keyboard events. | 32 // Adds an event targeter on |root_window| to block mouse and keyboard events. |
31 void AddEventTargeterOn(aura::Window* root_window); | 33 void AddEventTargeterOn(aura::Window* root_window); |
32 | 34 |
33 ScopedVector<aura::ScopedWindowTargeter> targeters_; | 35 ScopedVector<aura::ScopedWindowTargeter> targeters_; |
34 | 36 |
| 37 // Tracks the device ids of internal input devices. Events from these are |
| 38 // blocked while this object is instantiated. |
| 39 std::set<int> internal_device_ids_; |
| 40 |
35 DISALLOW_COPY_AND_ASSIGN(MaximizeModeEventBlocker); | 41 DISALLOW_COPY_AND_ASSIGN(MaximizeModeEventBlocker); |
36 }; | 42 }; |
37 | 43 |
38 } // namespace ash | 44 } // namespace ash |
39 | 45 |
40 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_ | 46 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_ |
OLD | NEW |