| Index: ui/base/x/selection_requestor.h
|
| diff --git a/ui/base/x/selection_requestor.h b/ui/base/x/selection_requestor.h
|
| index e092850532a546f655838e561defb430302af5e3..ea847a0869709c49969dfce133cc2c0f40c47d35 100644
|
| --- a/ui/base/x/selection_requestor.h
|
| +++ b/ui/base/x/selection_requestor.h
|
| @@ -7,11 +7,7 @@
|
|
|
| #include <X11/Xlib.h>
|
|
|
| -// Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
|
| -#undef RootWindow
|
| -
|
| #include <list>
|
| -#include <vector>
|
|
|
| #include "base/basictypes.h"
|
| #include "base/callback.h"
|
| @@ -34,29 +30,31 @@ class UI_BASE_EXPORT SelectionRequestor {
|
| public:
|
| SelectionRequestor(Display* xdisplay,
|
| ::Window xwindow,
|
| - ::Atom selection_name,
|
| PlatformEventDispatcher* dispatcher);
|
| ~SelectionRequestor();
|
|
|
| - // Does the work of requesting |target| from the selection we handle,
|
| - // spinning up the nested message loop, and reading the resulting data
|
| - // back. The result is stored in |out_data|.
|
| + // Does the work of requesting |target| from |selection|, spinning up the
|
| + // nested message loop, and reading the resulting data back. The result is
|
| + // stored in |out_data|.
|
| // |out_data_items| is the length of |out_data| in |out_type| items.
|
| bool PerformBlockingConvertSelection(
|
| + ::Atom selection,
|
| ::Atom target,
|
| scoped_refptr<base::RefCountedMemory>* out_data,
|
| size_t* out_data_items,
|
| ::Atom* out_type);
|
|
|
| - // Requests |target| from the selection that we handle, passing |parameter|
|
| - // as a parameter to XConvertSelection().
|
| + // Requests |target| from |selection|, passing |parameter| as a parameter to
|
| + // XConvertSelection().
|
| void PerformBlockingConvertSelectionWithParameter(
|
| + ::Atom selection,
|
| ::Atom target,
|
| const std::vector< ::Atom>& parameter);
|
|
|
| - // Returns the first of |types| offered by the current selection holder, or
|
| - // returns NULL if none of those types are available.
|
| - SelectionData RequestAndWaitForTypes(const std::vector< ::Atom>& types);
|
| + // Returns the first of |types| offered by the current owner of |selection|,
|
| + // or returns NULL if none of those types are available.
|
| + SelectionData RequestAndWaitForTypes(::Atom selection,
|
| + const std::vector< ::Atom>& types);
|
|
|
| // It is our owner's responsibility to plumb X11 SelectionNotify events on
|
| // |xwindow_| to us.
|
| @@ -65,11 +63,12 @@ class UI_BASE_EXPORT SelectionRequestor {
|
| private:
|
| // A request that has been issued and we are waiting for a response to.
|
| struct PendingRequest {
|
| - explicit PendingRequest(Atom target);
|
| + PendingRequest(::Atom requested_selection, ::Atom requested_target);
|
| ~PendingRequest();
|
|
|
| - // Data to the current XConvertSelection request. Used for error detection;
|
| - // we verify it on the return message.
|
| + // The target and selection requested in the XConvertSelection() request.
|
| + // Used for error detection.
|
| + ::Atom selection;
|
| ::Atom target;
|
|
|
| // Called to terminate the nested message loop.
|
| @@ -85,6 +84,16 @@ class UI_BASE_EXPORT SelectionRequestor {
|
| bool returned;
|
| };
|
|
|
| + // Helper method for PerformBlockingConvertSelection() and
|
| + // PerformBlockingConvertSelectionWithParameter().
|
| + bool PerformBlockingConvertSelectionImpl(
|
| + ::Atom selection,
|
| + ::Atom target,
|
| + const char* property_name,
|
| + scoped_refptr<base::RefCountedMemory>* out_data,
|
| + size_t* out_data_items,
|
| + ::Atom* out_type);
|
| +
|
| // Blocks till SelectionNotify is received for the target specified in
|
| // |request|.
|
| void BlockTillSelectionNotifyForRequest(PendingRequest* request);
|
| @@ -93,9 +102,6 @@ class UI_BASE_EXPORT SelectionRequestor {
|
| Display* x_display_;
|
| ::Window x_window_;
|
|
|
| - // The X11 selection that this instance communicates on.
|
| - ::Atom selection_name_;
|
| -
|
| // Dispatcher which handles SelectionNotify and SelectionRequest for
|
| // |selection_name_|. PerformBlockingConvertSelection() calls the
|
| // dispatcher directly if PerformBlockingConvertSelection() is called after
|
| @@ -103,6 +109,9 @@ class UI_BASE_EXPORT SelectionRequestor {
|
| // Not owned.
|
| PlatformEventDispatcher* dispatcher_;
|
|
|
| + // A pool of properties which can be used in XConvertSelection() requests.
|
| + std::list<const char*> property_pool_;
|
| +
|
| // A list of requests for which we are waiting for responses.
|
| std::list<PendingRequest*> pending_requests_;
|
|
|
|
|