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

Unified Diff: ui/aura/desktop_host_linux.cc

Issue 8566037: aura: Fix unit_tests on linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove Synthetic tests that were added for NWViews Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ui/aura/desktop_host_linux.cc
diff --git a/ui/aura/desktop_host_linux.cc b/ui/aura/desktop_host_linux.cc
index 7e9a5b110b073e12983307923cc62f8c27c31b27..08deabded4bb5c762272759b03147a9102c3a3ac 100644
--- a/ui/aura/desktop_host_linux.cc
+++ b/ui/aura/desktop_host_linux.cc
@@ -13,6 +13,7 @@
#include <algorithm>
#include "base/message_loop.h"
+#include "base/message_pump_observer.h"
#include "base/message_pump_x.h"
#include "ui/aura/cursor.h"
#include "ui/aura/desktop.h"
@@ -222,7 +223,8 @@ bool ShouldSendCharEventForKeyboardCode(ui::KeyboardCode keycode) {
}
}
-class DesktopHostLinux : public DesktopHost {
+class DesktopHostLinux : public DesktopHost,
+ public base::MessagePumpObserver {
public:
explicit DesktopHostLinux(const gfx::Rect& bounds);
virtual ~DesktopHostLinux();
@@ -243,6 +245,12 @@ class DesktopHostLinux : public DesktopHost {
virtual gfx::Point QueryMouseLocation() OVERRIDE;
virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE;
+ // base::MessagePumpObserver Overrides.
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE;
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
+ virtual void DestroyMessagePump() OVERRIDE;
+
// Returns true if there's an X window manager present... in most cases. Some
// window managers (notably, ion3) don't implement enough of ICCCM for us to
// detect that they're there.
@@ -287,6 +295,9 @@ DesktopHostLinux::DesktopHostLinux(const gfx::Rect& bounds)
if (base::MessagePumpForUI::HasXInput2())
ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_);
#endif
+
+ base::MessagePumpX::SetDefaultDispatcher(this);
+ MessageLoopForUI::current()->AddObserver(this);
}
DesktopHostLinux::~DesktopHostLinux() {
@@ -294,6 +305,10 @@ DesktopHostLinux::~DesktopHostLinux() {
// Clears XCursorCache.
ui::GetXCursor(ui::kCursorClearXCursorCache);
+
+ base::MessagePumpX::SetDefaultDispatcher(NULL);
+ if (MessageLoop::current())
+ MessageLoopForUI::current()->RemoveObserver(this);
oshima 2011/11/30 00:04:16 nit: it may be better to put them in reverse order
sadrul 2011/11/30 13:54:58 Done.
}
base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch(
@@ -520,6 +535,18 @@ void DesktopHostLinux::PostNativeEvent(const base::NativeEvent& native_event) {
XSendEvent(xdisplay_, xwindow_, False, 0, &xevent);
}
+base::EventStatus DesktopHostLinux::WillProcessEvent(
+ const base::NativeEvent& event) {
+ return base::EVENT_CONTINUE;
+}
+
+void DesktopHostLinux::DidProcessEvent(const base::NativeEvent& event) {
+}
+
+void DesktopHostLinux::DestroyMessagePump() {
+ desktop_->DeleteInstance();
+}
+
bool DesktopHostLinux::IsWindowManagerPresent() {
// Per ICCCM 2.8, "Manager Selections", window managers should take ownership
// of WM_Sn selections (where n is a screen number).

Powered by Google App Engine
This is Rietveld 408576698