Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / ash / wm / maximize_mode / maximize_mode_event_blocker.h
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_
6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_
7
8 #include <set>
9
10 #include "ash/shell_observer.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h"
14 #include "ui/aura/scoped_window_targeter.h"
15
16 namespace aura {
17 class Window;
18 }  // namespace aura
19
20 namespace ash {
21
22 class InternalInputDeviceList;
23 class MaximizeModeControllerTest;
24
25 // A class which blocks mouse and keyboard events while instantiated by
26 // replacing the root window event targeter.
27 class MaximizeModeEventBlocker : public ShellObserver {
28  public:
29   MaximizeModeEventBlocker();
30   virtual ~MaximizeModeEventBlocker();
31
32   InternalInputDeviceList* internal_devices() {
33     return internal_devices_.get();
34   }
35
36   // ShellObserver:
37   virtual void OnRootWindowAdded(aura::Window* root_window) OVERRIDE;
38
39  private:
40   friend class MaximizeModeControllerTest;
41
42   // Adds an event targeter on |root_window| to block mouse and keyboard events.
43   void AddEventTargeterOn(aura::Window* root_window);
44
45   ScopedVector<aura::ScopedWindowTargeter> targeters_;
46   scoped_ptr<InternalInputDeviceList> internal_devices_;
47
48   DISALLOW_COPY_AND_ASSIGN(MaximizeModeEventBlocker);
49 };
50
51 }  // namespace ash
52
53 #endif  // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_