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 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 | 8 |
9 #include "base/event_types.h" | 9 #include "base/event_types.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/message_loop/message_pump_dispatcher.h" |
12 #include "ui/aura/client/drag_drop_client.h" | 13 #include "ui/aura/client/drag_drop_client.h" |
13 #include "ui/aura/client/drag_drop_delegate.h" | 14 #include "ui/aura/client/drag_drop_delegate.h" |
14 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
16 #include "ui/base/dragdrop/drag_drop_types.h" | 17 #include "ui/base/dragdrop/drag_drop_types.h" |
17 #include "ui/base/dragdrop/drop_target_event.h" | 18 #include "ui/base/dragdrop/drop_target_event.h" |
18 #include "ui/base/dragdrop/os_exchange_data.h" | 19 #include "ui/base/dragdrop/os_exchange_data.h" |
19 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" | 20 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" |
20 #include "ui/base/x/selection_utils.h" | 21 #include "ui/base/x/selection_utils.h" |
21 #include "ui/base/x/x11_util.h" | 22 #include "ui/base/x/x11_util.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 version >= kMinXdndVersion) { | 132 version >= kMinXdndVersion) { |
132 *dest_window = target; | 133 *dest_window = target; |
133 } | 134 } |
134 } | 135 } |
135 | 136 |
136 } // namespace | 137 } // namespace |
137 | 138 |
138 namespace views { | 139 namespace views { |
139 | 140 |
140 class DesktopDragDropClientAuraX11::X11DragContext : | 141 class DesktopDragDropClientAuraX11::X11DragContext : |
141 public base::MessageLoop::Dispatcher { | 142 public base::MessagePumpDispatcher { |
142 public: | 143 public: |
143 X11DragContext(ui::X11AtomCache* atom_cache, | 144 X11DragContext(ui::X11AtomCache* atom_cache, |
144 ::Window local_window, | 145 ::Window local_window, |
145 const XClientMessageEvent& event); | 146 const XClientMessageEvent& event); |
146 virtual ~X11DragContext(); | 147 virtual ~X11DragContext(); |
147 | 148 |
148 // When we receive an XdndPosition message, we need to have all the data | 149 // When we receive an XdndPosition message, we need to have all the data |
149 // copied from the other window before we process the XdndPosition | 150 // copied from the other window before we process the XdndPosition |
150 // message. If we have that data already, dispatch immediately. Otherwise, | 151 // message. If we have that data already, dispatch immediately. Otherwise, |
151 // delay dispatching until we do. | 152 // delay dispatching until we do. |
(...skipping 14 matching lines...) Expand all Loading... |
166 | 167 |
167 // Reads the "XdndActionList" property from |source_window| and copies it | 168 // Reads the "XdndActionList" property from |source_window| and copies it |
168 // into |actions|. | 169 // into |actions|. |
169 void ReadActions(); | 170 void ReadActions(); |
170 | 171 |
171 // Creates a ui::DragDropTypes::DragOperation representation of the current | 172 // Creates a ui::DragDropTypes::DragOperation representation of the current |
172 // action list. | 173 // action list. |
173 int GetDragOperation() const; | 174 int GetDragOperation() const; |
174 | 175 |
175 private: | 176 private: |
176 // Overridden from MessageLoop::Dispatcher: | 177 // Overridden from MessagePumpDispatcher: |
177 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 178 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
178 | 179 |
179 // The atom cache owned by our parent. | 180 // The atom cache owned by our parent. |
180 ui::X11AtomCache* atom_cache_; | 181 ui::X11AtomCache* atom_cache_; |
181 | 182 |
182 // The XID of our chrome local aura window handling our events. | 183 // The XID of our chrome local aura window handling our events. |
183 ::Window local_window_; | 184 ::Window local_window_; |
184 | 185 |
185 // The XID of the window that's initiated the drag. | 186 // The XID of the window that's initiated the drag. |
186 unsigned long source_window_; | 187 unsigned long source_window_; |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 // GdkEvent about the failed drag. (And sending this message doesn't appear | 922 // GdkEvent about the failed drag. (And sending this message doesn't appear |
922 // to go through normal xlib machinery, but instead passes through the low | 923 // to go through normal xlib machinery, but instead passes through the low |
923 // level xProto (the x11 wire format) that I don't understand. | 924 // level xProto (the x11 wire format) that I don't understand. |
924 // | 925 // |
925 // I'm unsure if I have to jump through those hoops, or if XSendEvent is | 926 // I'm unsure if I have to jump through those hoops, or if XSendEvent is |
926 // sufficient. | 927 // sufficient. |
927 XSendEvent(xdisplay_, xid, False, 0, xev); | 928 XSendEvent(xdisplay_, xid, False, 0, xev); |
928 } | 929 } |
929 | 930 |
930 } // namespace views | 931 } // namespace views |
OLD | NEW |