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

Side by Side Diff: ui/display/chromeos/x11/native_display_delegate_x11.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/base/clipboard/clipboard_aurax11.cc ('k') | ui/events/platform/x11/x11_event_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/display/chromeos/x11/native_display_delegate_x11.h" 5 #include "ui/display/chromeos/x11/native_display_delegate_x11.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/extensions/dpms.h> 9 #include <X11/extensions/dpms.h>
10 #include <X11/extensions/Xrandr.h> 10 #include <X11/extensions/Xrandr.h>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 //////////////////////////////////////////////////////////////////////////////// 104 ////////////////////////////////////////////////////////////////////////////////
105 // NativeDisplayDelegateX11::MessagePumpObserverX11 105 // NativeDisplayDelegateX11::MessagePumpObserverX11
106 106
107 class NativeDisplayDelegateX11::MessagePumpObserverX11 107 class NativeDisplayDelegateX11::MessagePumpObserverX11
108 : public base::MessagePumpObserver { 108 : public base::MessagePumpObserver {
109 public: 109 public:
110 MessagePumpObserverX11(HelperDelegate* delegate); 110 MessagePumpObserverX11(HelperDelegate* delegate);
111 virtual ~MessagePumpObserverX11(); 111 virtual ~MessagePumpObserverX11();
112 112
113 // base::MessagePumpObserver overrides: 113 // base::MessagePumpObserver overrides:
114 virtual base::EventStatus WillProcessEvent(const base::NativeEvent& event) 114 virtual void WillProcessEvent(const base::NativeEvent& event) OVERRIDE;
115 OVERRIDE;
116 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; 115 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
117 116
118 private: 117 private:
119 HelperDelegate* delegate_; // Not owned. 118 HelperDelegate* delegate_; // Not owned.
120 119
121 DISALLOW_COPY_AND_ASSIGN(MessagePumpObserverX11); 120 DISALLOW_COPY_AND_ASSIGN(MessagePumpObserverX11);
122 }; 121 };
123 122
124 NativeDisplayDelegateX11::MessagePumpObserverX11::MessagePumpObserverX11( 123 NativeDisplayDelegateX11::MessagePumpObserverX11::MessagePumpObserverX11(
125 HelperDelegate* delegate) 124 HelperDelegate* delegate)
126 : delegate_(delegate) {} 125 : delegate_(delegate) {}
127 126
128 NativeDisplayDelegateX11::MessagePumpObserverX11::~MessagePumpObserverX11() {} 127 NativeDisplayDelegateX11::MessagePumpObserverX11::~MessagePumpObserverX11() {}
129 128
130 base::EventStatus 129 void NativeDisplayDelegateX11::MessagePumpObserverX11::WillProcessEvent(
131 NativeDisplayDelegateX11::MessagePumpObserverX11::WillProcessEvent(
132 const base::NativeEvent& event) { 130 const base::NativeEvent& event) {
133 // XI_HierarchyChanged events are special. There is no window associated with 131 // XI_HierarchyChanged events are special. There is no window associated with
134 // these events. So process them directly from here. 132 // these events. So process them directly from here.
135 if (event->type == GenericEvent && 133 if (event->type == GenericEvent &&
136 event->xgeneric.evtype == XI_HierarchyChanged) { 134 event->xgeneric.evtype == XI_HierarchyChanged) {
137 VLOG(1) << "Received XI_HierarchyChanged event"; 135 VLOG(1) << "Received XI_HierarchyChanged event";
138 // Defer configuring outputs to not stall event processing. 136 // Defer configuring outputs to not stall event processing.
139 // This also takes care of same event being received twice. 137 // This also takes care of same event being received twice.
140 delegate_->NotifyDisplayObservers(); 138 delegate_->NotifyDisplayObservers();
141 } 139 }
142
143 return base::EVENT_CONTINUE;
144 } 140 }
145 141
146 void NativeDisplayDelegateX11::MessagePumpObserverX11::DidProcessEvent( 142 void NativeDisplayDelegateX11::MessagePumpObserverX11::DidProcessEvent(
147 const base::NativeEvent& event) {} 143 const base::NativeEvent& event) {}
148 144
149 //////////////////////////////////////////////////////////////////////////////// 145 ////////////////////////////////////////////////////////////////////////////////
150 // NativeDisplayDelegateX11 implementation: 146 // NativeDisplayDelegateX11 implementation:
151 147
152 NativeDisplayDelegateX11::NativeDisplayDelegateX11() 148 NativeDisplayDelegateX11::NativeDisplayDelegateX11()
153 : display_(base::MessagePumpX11::GetDefaultXDisplay()), 149 : display_(base::MessagePumpX11::GetDefaultXDisplay()),
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 649
654 void NativeDisplayDelegateX11::AddObserver(NativeDisplayObserver* observer) { 650 void NativeDisplayDelegateX11::AddObserver(NativeDisplayObserver* observer) {
655 observers_.AddObserver(observer); 651 observers_.AddObserver(observer);
656 } 652 }
657 653
658 void NativeDisplayDelegateX11::RemoveObserver(NativeDisplayObserver* observer) { 654 void NativeDisplayDelegateX11::RemoveObserver(NativeDisplayObserver* observer) {
659 observers_.RemoveObserver(observer); 655 observers_.RemoveObserver(observer);
660 } 656 }
661 657
662 } // namespace ui 658 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_aurax11.cc ('k') | ui/events/platform/x11/x11_event_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698