Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h

Issue 431973006: Fix flakiness of DesktopDragDropClientAuraX11Tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/views.gyp ('k') | ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DRAG_DROP_CLIENT_AURAX11_H_ 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_
7 7
8 #include <set> 8 #include <set>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 #include "ui/aura/window_observer.h" 15 #include "ui/aura/window_observer.h"
16 #include "ui/base/cursor/cursor.h" 16 #include "ui/base/cursor/cursor.h"
17 #include "ui/base/dragdrop/drag_drop_types.h" 17 #include "ui/base/dragdrop/drag_drop_types.h"
18 #include "ui/gfx/point.h" 18 #include "ui/gfx/point.h"
19 #include "ui/gfx/x/x11_atom_cache.h" 19 #include "ui/gfx/x/x11_atom_cache.h"
20 #include "ui/views/views_export.h" 20 #include "ui/views/views_export.h"
21 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h" 21 #include "ui/views/widget/desktop_aura/x11_move_loop_delegate.h"
22 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop_delegate.h"
23 #include "ui/wm/public/drag_drop_client.h" 22 #include "ui/wm/public/drag_drop_client.h"
24 23
25 namespace aura { 24 namespace aura {
26 namespace client { 25 namespace client {
27 class DragDropDelegate; 26 class DragDropDelegate;
28 } 27 }
29 } 28 }
30 29
31 namespace gfx { 30 namespace gfx {
32 class Point; 31 class Point;
33 } 32 }
34 33
35 namespace ui { 34 namespace ui {
36 class DragSource; 35 class DragSource;
37 class DropTargetEvent; 36 class DropTargetEvent;
38 class OSExchangeData; 37 class OSExchangeData;
39 class OSExchangeDataProviderAuraX11; 38 class OSExchangeDataProviderAuraX11;
40 class SelectionFormatMap; 39 class SelectionFormatMap;
41 } 40 }
42 41
43 namespace views { 42 namespace views {
44 class DesktopNativeCursorManager; 43 class DesktopNativeCursorManager;
44 class X11MoveLoop;
45 45
46 // Implements drag and drop on X11 for aura. On one side, this class takes raw 46 // Implements drag and drop on X11 for aura. On one side, this class takes raw
47 // X11 events forwarded from DesktopWindowTreeHostLinux, while on the other, it 47 // X11 events forwarded from DesktopWindowTreeHostLinux, while on the other, it
48 // handles the views drag events. 48 // handles the views drag events.
49 class VIEWS_EXPORT DesktopDragDropClientAuraX11 49 class VIEWS_EXPORT DesktopDragDropClientAuraX11
50 : public aura::client::DragDropClient, 50 : public aura::client::DragDropClient,
51 public aura::WindowObserver, 51 public aura::WindowObserver,
52 public X11WholeScreenMoveLoopDelegate { 52 public X11MoveLoopDelegate {
53 public: 53 public:
54 DesktopDragDropClientAuraX11( 54 DesktopDragDropClientAuraX11(
55 aura::Window* root_window, 55 aura::Window* root_window,
56 views::DesktopNativeCursorManager* cursor_manager, 56 views::DesktopNativeCursorManager* cursor_manager,
57 Display* xdisplay, 57 Display* xdisplay,
58 ::Window xwindow); 58 ::Window xwindow);
59 virtual ~DesktopDragDropClientAuraX11(); 59 virtual ~DesktopDragDropClientAuraX11();
60 60
61 // We maintain a mapping of live DesktopDragDropClientAuraX11 objects to 61 // We maintain a mapping of live DesktopDragDropClientAuraX11 objects to
62 // their ::Windows. We do this so that we're able to short circuit sending 62 // their ::Windows. We do this so that we're able to short circuit sending
63 // X11 messages to windows in our process. 63 // X11 messages to windows in our process.
64 static DesktopDragDropClientAuraX11* GetForWindow(::Window window); 64 static DesktopDragDropClientAuraX11* GetForWindow(::Window window);
65 65
66 void Init();
67
66 // These methods handle the various X11 client messages from the platform. 68 // These methods handle the various X11 client messages from the platform.
67 void OnXdndEnter(const XClientMessageEvent& event); 69 void OnXdndEnter(const XClientMessageEvent& event);
68 void OnXdndLeave(const XClientMessageEvent& event); 70 void OnXdndLeave(const XClientMessageEvent& event);
69 void OnXdndPosition(const XClientMessageEvent& event); 71 void OnXdndPosition(const XClientMessageEvent& event);
70 void OnXdndStatus(const XClientMessageEvent& event); 72 void OnXdndStatus(const XClientMessageEvent& event);
71 void OnXdndFinished(const XClientMessageEvent& event); 73 void OnXdndFinished(const XClientMessageEvent& event);
72 void OnXdndDrop(const XClientMessageEvent& event); 74 void OnXdndDrop(const XClientMessageEvent& event);
73 75
74 // Called when XSelection data has been copied to our process. 76 // Called when XSelection data has been copied to our process.
75 void OnSelectionNotify(const XSelectionEvent& xselection); 77 void OnSelectionNotify(const XSelectionEvent& xselection);
(...skipping 17 matching lines...) Expand all
93 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; 95 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
94 96
95 // Overridden from X11WholeScreenMoveLoopDelegate: 97 // Overridden from X11WholeScreenMoveLoopDelegate:
96 virtual void OnMouseMovement(XMotionEvent* event) OVERRIDE; 98 virtual void OnMouseMovement(XMotionEvent* event) OVERRIDE;
97 virtual void OnMouseReleased() OVERRIDE; 99 virtual void OnMouseReleased() OVERRIDE;
98 virtual void OnMoveLoopEnded() OVERRIDE; 100 virtual void OnMoveLoopEnded() OVERRIDE;
99 101
100 protected: 102 protected:
101 // The following methods are virtual for the sake of testing. 103 // The following methods are virtual for the sake of testing.
102 104
105 // Creates a move loop.
106 virtual scoped_ptr<X11MoveLoop> CreateMoveLoop(
107 X11MoveLoopDelegate* delegate);
108
103 // Finds the topmost X11 window at |screen_point| and returns it if it is 109 // Finds the topmost X11 window at |screen_point| and returns it if it is
104 // Xdnd aware. Returns NULL otherwise. 110 // Xdnd aware. Returns NULL otherwise.
105 virtual ::Window FindWindowFor(const gfx::Point& screen_point); 111 virtual ::Window FindWindowFor(const gfx::Point& screen_point);
106 112
107 // Sends |xev| to |xid|, optionally short circuiting the round trip to the X 113 // Sends |xev| to |xid|, optionally short circuiting the round trip to the X
108 // server. 114 // server.
109 virtual void SendXClientEvent(::Window xid, XEvent* xev); 115 virtual void SendXClientEvent(::Window xid, XEvent* xev);
110 116
111 private: 117 private:
112 enum SourceState { 118 enum SourceState {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 const gfx::Point& screen_point); 177 const gfx::Point& screen_point);
172 178
173 void SendXdndEnter(::Window dest_window); 179 void SendXdndEnter(::Window dest_window);
174 void SendXdndLeave(::Window dest_window); 180 void SendXdndLeave(::Window dest_window);
175 void SendXdndPosition(::Window dest_window, 181 void SendXdndPosition(::Window dest_window,
176 const gfx::Point& screen_point, 182 const gfx::Point& screen_point,
177 unsigned long event_time); 183 unsigned long event_time);
178 void SendXdndDrop(::Window dest_window); 184 void SendXdndDrop(::Window dest_window);
179 185
180 // A nested message loop that notifies this object of events through the 186 // A nested message loop that notifies this object of events through the
181 // X11WholeScreenMoveLoopDelegate interface. 187 // X11MoveLoopDelegate interface.
182 X11WholeScreenMoveLoop move_loop_; 188 scoped_ptr<X11MoveLoop> move_loop_;
183 189
184 aura::Window* root_window_; 190 aura::Window* root_window_;
185 191
186 Display* xdisplay_; 192 Display* xdisplay_;
187 ::Window xwindow_; 193 ::Window xwindow_;
188 194
189 ui::X11AtomCache atom_cache_; 195 ui::X11AtomCache atom_cache_;
190 196
191 // Target side information. 197 // Target side information.
192 class X11DragContext; 198 class X11DragContext;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 gfx::NativeCursor move_grab_cursor_; 259 gfx::NativeCursor move_grab_cursor_;
254 260
255 base::WeakPtrFactory<DesktopDragDropClientAuraX11> weak_ptr_factory_; 261 base::WeakPtrFactory<DesktopDragDropClientAuraX11> weak_ptr_factory_;
256 262
257 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); 263 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11);
258 }; 264 };
259 265
260 } // namespace views 266 } // namespace views
261 267
262 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ 268 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_
OLDNEW
« no previous file with comments | « ui/views/views.gyp ('k') | ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698