Index: ui/base/clipboard/clipboard_aurax11.cc |
diff --git a/ui/base/clipboard/clipboard_aurax11.cc b/ui/base/clipboard/clipboard_aurax11.cc |
index 70768444b0cc4dc5b0ec78746b86291f68950b1a..f86e4a2ffdc74b1692fe70003293e108dd6dee39 100644 |
--- a/ui/base/clipboard/clipboard_aurax11.cc |
+++ b/ui/base/clipboard/clipboard_aurax11.cc |
@@ -25,6 +25,8 @@ |
#include "ui/base/x/selection_requestor.h" |
#include "ui/base/x/selection_utils.h" |
#include "ui/base/x/x11_util.h" |
+#include "ui/events/platform/platform_event_dispatcher.h" |
+#include "ui/events/platform/x11/x11_event_source.h" |
#include "ui/gfx/codec/png_codec.h" |
#include "ui/gfx/size.h" |
#include "ui/gfx/x/x11_atom_cache.h" |
@@ -224,7 +226,7 @@ bool Clipboard::FormatType::Equals(const FormatType& other) const { |
// Private implementation of our X11 integration. Keeps X11 headers out of the |
// majority of chrome, which break badly. |
-class Clipboard::AuraX11Details : public base::MessagePumpDispatcher { |
+class Clipboard::AuraX11Details : public PlatformEventDispatcher { |
public: |
AuraX11Details(); |
virtual ~AuraX11Details(); |
@@ -282,8 +284,9 @@ class Clipboard::AuraX11Details : public base::MessagePumpDispatcher { |
void Clear(ClipboardType type); |
private: |
- // Overridden from base::MessagePumpDispatcher: |
- virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE; |
+ // PlatformEventDispatcher: |
+ virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE; |
+ virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE; |
// Our X11 state. |
Display* x_display_; |
@@ -332,11 +335,13 @@ Clipboard::AuraX11Details::AuraX11Details() |
XStoreName(x_display_, x_window_, "Chromium clipboard"); |
XSelectInput(x_display_, x_window_, PropertyChangeMask); |
- base::MessagePumpX11::Current()->AddDispatcherForWindow(this, x_window_); |
+ if (PlatformEventSource::GetInstance()) |
+ PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
} |
Clipboard::AuraX11Details::~AuraX11Details() { |
- base::MessagePumpX11::Current()->RemoveDispatcherForWindow(x_window_); |
+ if (PlatformEventSource::GetInstance()) |
+ PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
XDestroyWindow(x_display_, x_window_); |
} |
@@ -485,9 +490,11 @@ void Clipboard::AuraX11Details::Clear(ClipboardType type) { |
primary_owner_.ClearSelectionOwner(); |
} |
-uint32_t Clipboard::AuraX11Details::Dispatch(const base::NativeEvent& event) { |
- XEvent* xev = event; |
+bool Clipboard::AuraX11Details::CanDispatchEvent(const PlatformEvent& event) { |
+ return event->xany.window == x_window_; |
+} |
+uint32_t Clipboard::AuraX11Details::DispatchEvent(const PlatformEvent& xev) { |
switch (xev->type) { |
case SelectionRequest: { |
if (xev->xselectionrequest.selection == XA_PRIMARY) |