Index: ui/base/clipboard/clipboard_gtk.cc |
=================================================================== |
--- ui/base/clipboard/clipboard_gtk.cc (revision 109529) |
+++ ui/base/clipboard/clipboard_gtk.cc (working copy) |
@@ -5,8 +5,6 @@ |
#include "ui/base/clipboard/clipboard.h" |
#include <gtk/gtk.h> |
-#include <X11/extensions/Xfixes.h> |
-#include <X11/Xatom.h> |
#include <map> |
#include <set> |
#include <string> |
@@ -14,11 +12,9 @@ |
#include "base/file_path.h" |
#include "base/logging.h" |
-#include "base/memory/singleton.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/utf_string_conversions.h" |
#include "third_party/skia/include/core/SkBitmap.h" |
-#include "ui/base/gtk/gtk_signal.h" |
-#include "ui/base/x/x11_util.h" |
#include "ui/gfx/canvas_skia.h" |
#include "ui/gfx/gtk_util.h" |
#include "ui/gfx/size.h" |
@@ -27,82 +23,6 @@ |
namespace { |
-class SelectionChangeObserver { |
- public: |
- static SelectionChangeObserver* GetInstance(); |
- |
- uint64 clipboard_sequence_number() const { |
- return clipboard_sequence_number_; |
- } |
- uint64 primary_sequence_number() const { return primary_sequence_number_; } |
- |
- private: |
- friend struct DefaultSingletonTraits<SelectionChangeObserver>; |
- |
- SelectionChangeObserver(); |
- ~SelectionChangeObserver(); |
- |
- CHROMEG_CALLBACK_1(SelectionChangeObserver, GdkFilterReturn, OnXEvent, |
- GdkXEvent*, GdkEvent*); |
- |
- int event_base_; |
- Atom clipboard_atom_; |
- uint64 clipboard_sequence_number_; |
- uint64 primary_sequence_number_; |
- |
- DISALLOW_COPY_AND_ASSIGN(SelectionChangeObserver); |
-}; |
- |
-SelectionChangeObserver::SelectionChangeObserver() |
- : event_base_(-1), |
- clipboard_atom_(None), |
- clipboard_sequence_number_(0), |
- primary_sequence_number_(0) { |
- int ignored; |
- if (XFixesQueryExtension(GetXDisplay(), &event_base_, &ignored)) { |
- clipboard_atom_ = XInternAtom(GetXDisplay(), "CLIPBOARD", false); |
- XFixesSelectSelectionInput(GetXDisplay(), GetX11RootWindow(), |
- clipboard_atom_, |
- XFixesSetSelectionOwnerNotifyMask | |
- XFixesSelectionWindowDestroyNotifyMask | |
- XFixesSelectionClientCloseNotifyMask); |
- // This seems to be semi-optional. For some reason, registering for any |
- // selection notify events seems to subscribe us to events for both the |
- // primary and the clipboard buffers. Register anyway just to be safe. |
- XFixesSelectSelectionInput(GetXDisplay(), GetX11RootWindow(), |
- XA_PRIMARY, |
- XFixesSetSelectionOwnerNotifyMask | |
- XFixesSelectionWindowDestroyNotifyMask | |
- XFixesSelectionClientCloseNotifyMask); |
- gdk_window_add_filter(NULL, &SelectionChangeObserver::OnXEventThunk, this); |
- } |
-} |
- |
-SelectionChangeObserver::~SelectionChangeObserver() { |
-} |
- |
-SelectionChangeObserver* SelectionChangeObserver::GetInstance() { |
- return Singleton<SelectionChangeObserver>::get(); |
-} |
- |
-GdkFilterReturn SelectionChangeObserver::OnXEvent(GdkXEvent* xevent, |
- GdkEvent* event) { |
- XEvent* xev = static_cast<XEvent*>(xevent); |
- |
- if (xev->type == event_base_ + XFixesSelectionNotify) { |
- XFixesSelectionNotifyEvent* ev = |
- reinterpret_cast<XFixesSelectionNotifyEvent*>(xev); |
- if (ev->selection == clipboard_atom_) { |
- clipboard_sequence_number_++; |
- } else if (ev->selection == XA_PRIMARY) { |
- primary_sequence_number_++; |
- } else { |
- DLOG(ERROR) << "Unexpected selection atom: " << ev->selection; |
- } |
- } |
- return GDK_FILTER_CONTINUE; |
-} |
- |
const char kMimeTypeBitmap[] = "image/bmp"; |
const char kMimeTypeMozillaURL[] = "text/x-moz-url"; |
const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste"; |
@@ -503,10 +423,10 @@ |
} |
uint64 Clipboard::GetSequenceNumber(Buffer buffer) { |
- if (buffer == BUFFER_STANDARD) |
- return SelectionChangeObserver::GetInstance()->clipboard_sequence_number(); |
- else |
- return SelectionChangeObserver::GetInstance()->primary_sequence_number(); |
+ // TODO(cdn): implement this. For now this interface will advertise |
+ // that the Linux clipboard never changes. That's fine as long as we |
+ // don't rely on this signal. |
+ return 0; |
} |
// static |