OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include <X11/keysym.h> | 5 #include <X11/keysym.h> |
6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
7 | 7 |
8 // X macro fail. | 8 // X macro fail. |
9 #if defined(RootWindow) | 9 #if defined(RootWindow) |
10 #undef RootWindow | 10 #undef RootWindow |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 : closure_(closure), | 47 : closure_(closure), |
48 matcher_(matcher) { | 48 matcher_(matcher) { |
49 base::MessageLoopForUI::current()->AddObserver(this); | 49 base::MessageLoopForUI::current()->AddObserver(this); |
50 } | 50 } |
51 | 51 |
52 virtual ~EventWaiter() { | 52 virtual ~EventWaiter() { |
53 base::MessageLoopForUI::current()->RemoveObserver(this); | 53 base::MessageLoopForUI::current()->RemoveObserver(this); |
54 } | 54 } |
55 | 55 |
56 // MessageLoop::Observer implementation: | 56 // MessageLoop::Observer implementation: |
57 virtual base::EventStatus WillProcessEvent( | 57 virtual void WillProcessEvent(const base::NativeEvent& event) OVERRIDE { |
58 const base::NativeEvent& event) OVERRIDE { | |
59 if ((*matcher_)(event)) { | 58 if ((*matcher_)(event)) { |
60 base::MessageLoop::current()->PostTask(FROM_HERE, closure_); | 59 base::MessageLoop::current()->PostTask(FROM_HERE, closure_); |
61 delete this; | 60 delete this; |
62 } | 61 } |
63 return base::EVENT_CONTINUE; | |
64 } | 62 } |
65 | 63 |
66 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE { | 64 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE { |
67 } | 65 } |
68 | 66 |
69 private: | 67 private: |
70 base::Closure closure_; | 68 base::Closure closure_; |
71 EventWaiterMatcher matcher_; | 69 EventWaiterMatcher matcher_; |
72 DISALLOW_COPY_AND_ASSIGN(EventWaiter); | 70 DISALLOW_COPY_AND_ASSIGN(EventWaiter); |
73 }; | 71 }; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } // namespace | 312 } // namespace |
315 | 313 |
316 UIControlsAura* CreateUIControlsDesktopAura() { | 314 UIControlsAura* CreateUIControlsDesktopAura() { |
317 // The constructor of UIControlsDesktopX11 needs XInitThreads to be called. | 315 // The constructor of UIControlsDesktopX11 needs XInitThreads to be called. |
318 XInitThreads(); | 316 XInitThreads(); |
319 return new UIControlsDesktopX11(); | 317 return new UIControlsDesktopX11(); |
320 } | 318 } |
321 | 319 |
322 } // namespace test | 320 } // namespace test |
323 } // namespace views | 321 } // namespace views |
OLD | NEW |