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

Side by Side Diff: ui/views/test/ui_controls_factory_desktop_aurax11.cc

Issue 223483002: base: Do not allow MessagePumpObservers to consume events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r262009 Created 6 years, 8 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
« no previous file with comments | « ui/gl/gl_surface_glx.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_glx.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698