OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_BASE_X_SELECTION_REQUESTOR_H_ | 5 #ifndef UI_BASE_X_SELECTION_REQUESTOR_H_ |
6 #define UI_BASE_X_SELECTION_REQUESTOR_H_ | 6 #define UI_BASE_X_SELECTION_REQUESTOR_H_ |
7 | 7 |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
11 #undef RootWindow | 11 #undef RootWindow |
12 | 12 |
13 #include <list> | 13 #include <list> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/callback.h" | 17 #include "base/callback.h" |
18 #include "base/memory/ref_counted_memory.h" | 18 #include "base/memory/ref_counted_memory.h" |
19 #include "ui/base/ui_export.h" | 19 #include "ui/base/ui_base_export.h" |
20 #include "ui/gfx/x/x11_atom_cache.h" | 20 #include "ui/gfx/x/x11_atom_cache.h" |
21 | 21 |
22 namespace ui { | 22 namespace ui { |
23 class SelectionData; | 23 class SelectionData; |
24 | 24 |
25 // Requests and later receives data from the X11 server through the selection | 25 // Requests and later receives data from the X11 server through the selection |
26 // system. | 26 // system. |
27 // | 27 // |
28 // X11 uses a system called "selections" to implement clipboards and drag and | 28 // X11 uses a system called "selections" to implement clipboards and drag and |
29 // drop. This class interprets messages from the statefull selection request | 29 // drop. This class interprets messages from the statefull selection request |
30 // API. SelectionRequestor should only deal with the X11 details; it does not | 30 // API. SelectionRequestor should only deal with the X11 details; it does not |
31 // implement per-component fast-paths. | 31 // implement per-component fast-paths. |
32 class UI_EXPORT SelectionRequestor { | 32 class UI_BASE_EXPORT SelectionRequestor { |
33 public: | 33 public: |
34 SelectionRequestor(Display* xdisplay, | 34 SelectionRequestor(Display* xdisplay, |
35 ::Window xwindow, | 35 ::Window xwindow, |
36 ::Atom selection_name); | 36 ::Atom selection_name); |
37 ~SelectionRequestor(); | 37 ~SelectionRequestor(); |
38 | 38 |
39 // Does the work of requesting |target| from the selection we handle, | 39 // Does the work of requesting |target| from the selection we handle, |
40 // spinning up the nested message loop, and reading the resulting data | 40 // spinning up the nested message loop, and reading the resulting data |
41 // back. |out_data| is allocated with the X allocator and must be freed with | 41 // back. |out_data| is allocated with the X allocator and must be freed with |
42 // XFree(). |out_data_bytes| is the length in machine chars, while | 42 // XFree(). |out_data_bytes| is the length in machine chars, while |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 std::list<PendingRequest*> pending_requests_; | 90 std::list<PendingRequest*> pending_requests_; |
91 | 91 |
92 X11AtomCache atom_cache_; | 92 X11AtomCache atom_cache_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(SelectionRequestor); | 94 DISALLOW_COPY_AND_ASSIGN(SelectionRequestor); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace ui | 97 } // namespace ui |
98 | 98 |
99 #endif // UI_BASE_X_SELECTION_REQUESTOR_H_ | 99 #endif // UI_BASE_X_SELECTION_REQUESTOR_H_ |
OLD | NEW |