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_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_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 "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "ui/aura/client/cursor_client.h" | 15 #include "ui/aura/client/cursor_client.h" |
16 #include "ui/aura/root_window_host.h" | 16 #include "ui/aura/root_window_host.h" |
17 #include "ui/base/cursor/cursor_loader_x11.h" | 17 #include "ui/base/cursor/cursor_loader_x11.h" |
| 18 #include "ui/base/dragdrop/desktop_selection_provider_aurax11.h" |
18 #include "ui/base/x/x11_atom_cache.h" | 19 #include "ui/base/x/x11_atom_cache.h" |
19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
20 #include "ui/views/views_export.h" | 21 #include "ui/views/views_export.h" |
21 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" | 22 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" |
22 | 23 |
23 namespace aura { | 24 namespace aura { |
24 namespace client { | 25 namespace client { |
25 class FocusClient; | 26 class FocusClient; |
26 class ScreenPositionClient; | 27 class ScreenPositionClient; |
27 } | 28 } |
28 } | 29 } |
29 | 30 |
30 namespace views { | 31 namespace views { |
31 class DesktopActivationClient; | 32 class DesktopActivationClient; |
32 class DesktopCaptureClient; | 33 class DesktopCaptureClient; |
| 34 class DesktopDragDropClientAuraX11; |
33 class DesktopDispatcherClient; | 35 class DesktopDispatcherClient; |
34 class X11DesktopWindowMoveClient; | 36 class X11DesktopWindowMoveClient; |
35 class X11WindowEventFilter; | 37 class X11WindowEventFilter; |
36 | 38 |
37 namespace corewm { | 39 namespace corewm { |
38 class CursorManager; | 40 class CursorManager; |
39 } | 41 } |
40 | 42 |
41 class VIEWS_EXPORT DesktopRootWindowHostX11 | 43 class VIEWS_EXPORT DesktopRootWindowHostX11 |
42 : public DesktopRootWindowHost, | 44 : public DesktopRootWindowHost, |
43 public aura::RootWindowHost, | 45 public aura::RootWindowHost, |
| 46 public ui::DesktopSelectionProviderAuraX11, |
44 public MessageLoop::Dispatcher { | 47 public MessageLoop::Dispatcher { |
45 public: | 48 public: |
46 DesktopRootWindowHostX11( | 49 DesktopRootWindowHostX11( |
47 internal::NativeWidgetDelegate* native_widget_delegate, | 50 internal::NativeWidgetDelegate* native_widget_delegate, |
48 DesktopNativeWidgetAura* desktop_native_widget_aura, | 51 DesktopNativeWidgetAura* desktop_native_widget_aura, |
49 const gfx::Rect& initial_bounds); | 52 const gfx::Rect& initial_bounds); |
50 virtual ~DesktopRootWindowHostX11(); | 53 virtual ~DesktopRootWindowHostX11(); |
51 | 54 |
52 // A way of converting an X11 |xid| host window into a |content_window_|. | 55 // A way of converting an X11 |xid| host window into a |content_window_|. |
53 static aura::Window* GetContentWindowForXID(XID xid); | 56 static aura::Window* GetContentWindowForXID(XID xid); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 virtual bool CopyAreaToSkCanvas(const gfx::Rect& source_bounds, | 167 virtual bool CopyAreaToSkCanvas(const gfx::Rect& source_bounds, |
165 const gfx::Point& dest_offset, | 168 const gfx::Point& dest_offset, |
166 SkCanvas* canvas) OVERRIDE; | 169 SkCanvas* canvas) OVERRIDE; |
167 virtual bool GrabSnapshot( | 170 virtual bool GrabSnapshot( |
168 const gfx::Rect& snapshot_bounds, | 171 const gfx::Rect& snapshot_bounds, |
169 std::vector<unsigned char>* png_representation) OVERRIDE; | 172 std::vector<unsigned char>* png_representation) OVERRIDE; |
170 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 173 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
171 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 174 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
172 virtual void PrepareForShutdown() OVERRIDE; | 175 virtual void PrepareForShutdown() OVERRIDE; |
173 | 176 |
| 177 // Overridden from DesktopSelectionProviderAuraX11: |
| 178 virtual void SetDropHandler( |
| 179 ui::OSExchangeDataProviderAuraX11* handler) OVERRIDE; |
| 180 |
174 // Overridden from Dispatcher: | 181 // Overridden from Dispatcher: |
175 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 182 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
176 | 183 |
177 base::WeakPtrFactory<DesktopRootWindowHostX11> close_widget_factory_; | 184 base::WeakPtrFactory<DesktopRootWindowHostX11> close_widget_factory_; |
178 | 185 |
179 // X11 things | 186 // X11 things |
180 // The display and the native X window hosting the root window. | 187 // The display and the native X window hosting the root window. |
181 Display* xdisplay_; | 188 Display* xdisplay_; |
182 ::Window xwindow_; | 189 ::Window xwindow_; |
183 | 190 |
(...skipping 17 matching lines...) Expand all Loading... |
201 // We are owned by the RootWindow, but we have to have a back pointer to it. | 208 // We are owned by the RootWindow, but we have to have a back pointer to it. |
202 aura::RootWindow* root_window_; | 209 aura::RootWindow* root_window_; |
203 | 210 |
204 // aura:: objects that we own. | 211 // aura:: objects that we own. |
205 scoped_ptr<DesktopCaptureClient> capture_client_; | 212 scoped_ptr<DesktopCaptureClient> capture_client_; |
206 scoped_ptr<aura::client::FocusClient> focus_client_; | 213 scoped_ptr<aura::client::FocusClient> focus_client_; |
207 scoped_ptr<DesktopActivationClient> activation_client_; | 214 scoped_ptr<DesktopActivationClient> activation_client_; |
208 scoped_ptr<views::corewm::CursorManager> cursor_client_; | 215 scoped_ptr<views::corewm::CursorManager> cursor_client_; |
209 scoped_ptr<DesktopDispatcherClient> dispatcher_client_; | 216 scoped_ptr<DesktopDispatcherClient> dispatcher_client_; |
210 scoped_ptr<aura::client::ScreenPositionClient> position_client_; | 217 scoped_ptr<aura::client::ScreenPositionClient> position_client_; |
| 218 scoped_ptr<DesktopDragDropClientAuraX11> drag_drop_client_; |
211 | 219 |
212 // Current Aura cursor. | 220 // Current Aura cursor. |
213 gfx::NativeCursor current_cursor_; | 221 gfx::NativeCursor current_cursor_; |
214 | 222 |
215 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; | 223 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; |
216 scoped_ptr<X11DesktopWindowMoveClient> x11_window_move_client_; | 224 scoped_ptr<X11DesktopWindowMoveClient> x11_window_move_client_; |
217 | 225 |
218 // TODO(beng): Consider providing an interface to DesktopNativeWidgetAura | 226 // TODO(beng): Consider providing an interface to DesktopNativeWidgetAura |
219 // instead of providing this route back to Widget. | 227 // instead of providing this route back to Widget. |
220 internal::NativeWidgetDelegate* native_widget_delegate_; | 228 internal::NativeWidgetDelegate* native_widget_delegate_; |
221 | 229 |
222 DesktopNativeWidgetAura* desktop_native_widget_aura_; | 230 DesktopNativeWidgetAura* desktop_native_widget_aura_; |
223 | 231 |
224 aura::RootWindowHostDelegate* root_window_host_delegate_; | 232 aura::RootWindowHostDelegate* root_window_host_delegate_; |
225 aura::Window* content_window_; | 233 aura::Window* content_window_; |
226 | 234 |
| 235 // We forward drop related messages to this object. |
| 236 ui::OSExchangeDataProviderAuraX11* drop_handler_; |
| 237 |
227 // The current root window host that has capture. While X11 has something | 238 // The current root window host that has capture. While X11 has something |
228 // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and | 239 // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and |
229 // there are no notifications when this changes. We need to track this so we | 240 // there are no notifications when this changes. We need to track this so we |
230 // can notify widgets when they have lost capture, which controls a bunch of | 241 // can notify widgets when they have lost capture, which controls a bunch of |
231 // things in views like hiding menus. | 242 // things in views like hiding menus. |
232 static DesktopRootWindowHostX11* g_current_capture; | 243 static DesktopRootWindowHostX11* g_current_capture; |
233 | 244 |
234 DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostX11); | 245 DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostX11); |
235 }; | 246 }; |
236 | 247 |
237 } // namespace views | 248 } // namespace views |
238 | 249 |
239 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ | 250 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ |
OLD | NEW |