Index: ui/base/x/selection_requestor.cc |
diff --git a/ui/base/x/selection_requestor.cc b/ui/base/x/selection_requestor.cc |
index 0aec0864f75cfe2f041c39b0af48ab2c418e996f..830d692902cc2da8d11d23377136818e8678111e 100644 |
--- a/ui/base/x/selection_requestor.cc |
+++ b/ui/base/x/selection_requestor.cc |
@@ -6,6 +6,7 @@ |
#include "base/message_pump_aurax11.h" |
#include "base/run_loop.h" |
+#include "ui/base/x/selection_utils.h" |
namespace ui { |
@@ -116,6 +117,28 @@ bool SelectionRequestor::PerformBlockingConvertSelection( |
return true; |
} |
+scoped_ptr<SelectionData> SelectionRequestor::RequestAndWaitForTypes( |
+ const std::vector< ::Atom>& types) { |
+ for (std::vector< ::Atom>::const_iterator it = types.begin(); |
+ it != types.end(); ++it) { |
+ unsigned char* data = NULL; |
+ size_t data_bytes = 0; |
+ ::Atom type = None; |
+ if (PerformBlockingConvertSelection(*it, |
+ &data, |
+ &data_bytes, |
+ NULL, |
+ &type) && |
+ type == *it) { |
+ scoped_ptr<SelectionData> data_out(new SelectionData(x_display_)); |
+ data_out->Set(type, (char*)data, data_bytes, true); |
+ return data_out.Pass(); |
+ } |
+ } |
+ |
+ return scoped_ptr<SelectionData>(); |
+} |
+ |
void SelectionRequestor::OnSelectionNotify(const XSelectionEvent& event) { |
if (!in_nested_loop_) { |
// This shouldn't happen; we're not waiting on the X server for data, but |