Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_event_blocker.h

Issue 313913004: Block internal PlatformEvents before they are dispatched in touchview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove obsolete comment and unnecessary includes. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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> 8 #include <set>
9 9
10 #include "ash/shell_observer.h" 10 #include "ash/ash_export.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 13 #include "ui/events/platform/platform_event_filter.h"
14 #include "ui/aura/scoped_window_targeter.h" 14 #include "ui/gfx/point.h"
15
16 namespace aura {
17 class Window;
18 } // namespace aura
19 15
20 namespace ash { 16 namespace ash {
21 17
22 class InternalInputDeviceList; 18 class InternalInputDeviceList;
23 class MaximizeModeControllerTest; 19 class MaximizeModeEventBlockerX11Test;
24 20
25 // A class which blocks mouse and keyboard events while instantiated by 21 // A class which blocks mouse and keyboard events while instantiated by
26 // replacing the root window event targeter. 22 // replacing the root window event targeter.
27 class MaximizeModeEventBlocker : public ShellObserver { 23 class ASH_EXPORT MaximizeModeEventBlocker : public ui::PlatformEventFilter {
28 public: 24 public:
29 MaximizeModeEventBlocker(); 25 MaximizeModeEventBlocker();
30 virtual ~MaximizeModeEventBlocker(); 26 virtual ~MaximizeModeEventBlocker();
31 27
32 InternalInputDeviceList* internal_devices() { 28 // ui::PlatformEventFilter:
33 return internal_devices_.get(); 29 virtual bool ShouldDispatchEvent(const ui::PlatformEvent& event) OVERRIDE;
34 }
35
36 // ShellObserver:
37 virtual void OnRootWindowAdded(aura::Window* root_window) OVERRIDE;
38 30
39 private: 31 private:
40 friend class MaximizeModeControllerTest; 32 friend class MaximizeModeEventBlockerX11Test;
41 33
42 // Adds an event targeter on |root_window| to block mouse and keyboard events. 34 // The last known mouse location to lock the cursor in place to when events
43 void AddEventTargeterOn(aura::Window* root_window); 35 // come from the internal touchpad.
36 gfx::Point last_mouse_location_;
44 37
45 ScopedVector<aura::ScopedWindowTargeter> targeters_;
46 scoped_ptr<InternalInputDeviceList> internal_devices_; 38 scoped_ptr<InternalInputDeviceList> internal_devices_;
47 39
48 DISALLOW_COPY_AND_ASSIGN(MaximizeModeEventBlocker); 40 DISALLOW_COPY_AND_ASSIGN(MaximizeModeEventBlocker);
49 }; 41 };
50 42
51 } // namespace ash 43 } // namespace ash
52 44
53 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_ 45 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_EVENT_BLOCKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698