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

Side by Side Diff: content/browser/web_contents/web_drag_source_win.h

Issue 13979012: Fix deadlock between UI thread and drag and drop thread on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add initializer Created 7 years, 8 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
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 CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "content/public/browser/notification_observer.h" 9 #include "content/public/browser/notification_observer.h"
10 #include "content/public/browser/notification_registrar.h" 10 #include "content/public/browser/notification_registrar.h"
11 #include "ui/base/dragdrop/drag_source_win.h" 11 #include "ui/base/dragdrop/drag_source_win.h"
12 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/gfx/point.h" 13 #include "ui/gfx/point.h"
14 14
15 namespace ui {
16 class OSExchangeData;
17 } // namespace ui
18
15 namespace content { 19 namespace content {
16 class RenderViewHost; 20 class RenderViewHost;
17 class WebContents; 21 class WebContents;
18 22
19 // An IDropSource implementation for a WebContentsImpl. Handles notifications 23 // An IDropSource implementation for a WebContentsImpl. Handles notifications
20 // sent by an active drag-drop operation as the user mouses over other drop 24 // sent by an active drag-drop operation as the user mouses over other drop
21 // targets on their system. This object tells Windows whether or not the drag 25 // targets on their system. This object tells Windows whether or not the drag
22 // should continue, and supplies the appropriate cursors. 26 // should continue, and supplies the appropriate cursors.
23 class WebDragSource : public ui::DragSourceWin, 27 class WebDragSource : public ui::DragSourceWin,
24 public NotificationObserver { 28 public NotificationObserver {
25 public: 29 public:
26 // Create a new DragSource for a given HWND and WebContents. 30 // Create a new DragSource for a given HWND and WebContents.
27 WebDragSource(gfx::NativeWindow source_wnd, WebContents* web_contents); 31 WebDragSource(gfx::NativeWindow source_wnd, WebContents* web_contents);
28 virtual ~WebDragSource(); 32 virtual ~WebDragSource();
29 33
30 // NotificationObserver implementation. 34 // NotificationObserver implementation.
31 virtual void Observe(int type, 35 virtual void Observe(int type,
32 const NotificationSource& source, 36 const NotificationSource& source,
33 const NotificationDetails& details); 37 const NotificationDetails& details);
34 38
35 void set_effect(DWORD effect) { effect_ = effect; } 39 void set_effect(DWORD effect) { effect_ = effect; }
40 void set_data(ui::OSExchangeData* data) { data_ = data; }
sky 2013/04/26 22:10:22 Document ownership.
dcheng 2013/04/26 22:20:10 Done.
36 41
37 protected: 42 protected:
38 // ui::DragSourceWin 43 // ui::DragSourceWin
39 virtual void OnDragSourceCancel(); 44 virtual void OnDragSourceCancel();
40 virtual void OnDragSourceDrop(); 45 virtual void OnDragSourceDrop();
41 virtual void OnDragSourceMove(); 46 virtual void OnDragSourceMove();
42 47
43 private: 48 private:
44 // Cannot construct thusly. 49 // Cannot construct thusly.
45 WebDragSource(); 50 WebDragSource();
46 51
47 // OnDragSourceDrop schedules its main work to be done after IDropTarget::Drop 52 // OnDragSourceDrop schedules its main work to be done after IDropTarget::Drop
48 // by posting a task to this function. 53 // by posting a task to this function.
49 void DelayedOnDragSourceDrop(); 54 void DelayedOnDragSourceDrop();
50 55
51 // Keep a reference to the window so we can translate the cursor position. 56 // Keep a reference to the window so we can translate the cursor position.
52 gfx::NativeWindow source_wnd_; 57 gfx::NativeWindow source_wnd_;
53 58
54 // We use this as a channel to the renderer to tell it about various drag 59 // We use this as a channel to the renderer to tell it about various drag
55 // drop events that it needs to know about (such as when a drag operation it 60 // drop events that it needs to know about (such as when a drag operation it
56 // initiated terminates). 61 // initiated terminates).
57 RenderViewHost* render_view_host_; 62 RenderViewHost* render_view_host_;
58 63
59 NotificationRegistrar registrar_; 64 NotificationRegistrar registrar_;
60 65
61 DWORD effect_; 66 DWORD effect_;
62 67
68 ui::OSExchangeData* data_;
69
63 DISALLOW_COPY_AND_ASSIGN(WebDragSource); 70 DISALLOW_COPY_AND_ASSIGN(WebDragSource);
64 }; 71 };
65 72
66 } // namespace content 73 } // namespace content
67 74
68 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_ 75 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698