OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_ | 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_ |
6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_ | 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_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 <map> | 13 #include <map> |
14 | 14 |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/message_loop/message_pump_dispatcher.h" | 16 #include "base/message_loop/message_pump_dispatcher.h" |
17 #include "base/pickle.h" | 17 #include "base/pickle.h" |
18 #include "ui/base/dragdrop/os_exchange_data.h" | 18 #include "ui/base/dragdrop/os_exchange_data.h" |
19 #include "ui/base/x/selection_owner.h" | 19 #include "ui/base/x/selection_owner.h" |
20 #include "ui/base/x/selection_requestor.h" | 20 #include "ui/base/x/selection_requestor.h" |
21 #include "ui/base/x/selection_utils.h" | 21 #include "ui/base/x/selection_utils.h" |
22 #include "ui/gfx/image/image_skia.h" | 22 #include "ui/gfx/image/image_skia.h" |
23 #include "ui/gfx/vector2d.h" | 23 #include "ui/gfx/vector2d.h" |
24 #include "ui/gfx/x/x11_atom_cache.h" | 24 #include "ui/gfx/x/x11_atom_cache.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 namespace ui { | 27 namespace ui { |
28 | 28 |
29 class Clipboard; | 29 class Clipboard; |
| 30 class OSExchangeDataProviderAuraX11Test; |
30 | 31 |
31 // OSExchangeData::Provider implementation for aura on linux. | 32 // OSExchangeData::Provider implementation for aura on linux. |
32 class UI_BASE_EXPORT OSExchangeDataProviderAuraX11 | 33 class UI_BASE_EXPORT OSExchangeDataProviderAuraX11 |
33 : public OSExchangeData::Provider, | 34 : public OSExchangeData::Provider, |
34 public base::MessagePumpDispatcher { | 35 public base::MessagePumpDispatcher { |
35 public: | 36 public: |
36 // |x_window| is the window the cursor is over, and |selection| is the set of | 37 // |x_window| is the window the cursor is over, and |selection| is the set of |
37 // data being offered. | 38 // data being offered. |
38 OSExchangeDataProviderAuraX11(::Window x_window, | 39 OSExchangeDataProviderAuraX11(::Window x_window, |
39 const SelectionFormatMap& selection); | 40 const SelectionFormatMap& selection); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 virtual bool HasHtml() const OVERRIDE; | 84 virtual bool HasHtml() const OVERRIDE; |
84 virtual void SetDragImage(const gfx::ImageSkia& image, | 85 virtual void SetDragImage(const gfx::ImageSkia& image, |
85 const gfx::Vector2d& cursor_offset) OVERRIDE; | 86 const gfx::Vector2d& cursor_offset) OVERRIDE; |
86 virtual const gfx::ImageSkia& GetDragImage() const OVERRIDE; | 87 virtual const gfx::ImageSkia& GetDragImage() const OVERRIDE; |
87 virtual const gfx::Vector2d& GetDragImageOffset() const OVERRIDE; | 88 virtual const gfx::Vector2d& GetDragImageOffset() const OVERRIDE; |
88 | 89 |
89 // Overridden from base::MessagePumpDispatcher: | 90 // Overridden from base::MessagePumpDispatcher: |
90 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 91 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
91 | 92 |
92 private: | 93 private: |
| 94 friend class OSExchangeDataProviderAuraX11Test; |
93 typedef std::map<OSExchangeData::CustomFormat, Pickle> PickleData; | 95 typedef std::map<OSExchangeData::CustomFormat, Pickle> PickleData; |
94 | 96 |
95 // Returns true if |formats_| contains a string format and the string can be | 97 // Returns true if |formats_| contains a string format and the string can be |
96 // parsed as a URL. | 98 // parsed as a URL. |
97 bool GetPlainTextURL(GURL* url) const; | 99 bool GetPlainTextURL(GURL* url) const; |
98 | 100 |
99 // Returns the targets in |format_map_|. | 101 // Returns the targets in |format_map_|. |
100 std::vector< ::Atom> GetTargets() const; | 102 std::vector< ::Atom> GetTargets() const; |
101 | 103 |
102 // Drag image and offset data. | 104 // Drag image and offset data. |
(...skipping 23 matching lines...) Expand all Loading... |
126 | 128 |
127 // Takes a snapshot of |format_map_| and offers it to other windows. | 129 // Takes a snapshot of |format_map_| and offers it to other windows. |
128 mutable SelectionOwner selection_owner_; | 130 mutable SelectionOwner selection_owner_; |
129 | 131 |
130 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderAuraX11); | 132 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderAuraX11); |
131 }; | 133 }; |
132 | 134 |
133 } // namespace ui | 135 } // namespace ui |
134 | 136 |
135 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_ | 137 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_ |
OLD | NEW |