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 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 { | 15 namespace ui { |
16 class OSExchangeData; | 16 class OSExchangeData; |
17 } // namespace ui | 17 } // namespace ui |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 class RenderViewHost; | 20 class RenderViewHost; |
21 class WebContents; | 21 class WebContents; |
| 22 class WebContentsImpl; |
22 | 23 |
23 // An IDropSource implementation for a WebContentsImpl. Handles notifications | 24 // An IDropSource implementation for a WebContentsImpl. Handles notifications |
24 // sent by an active drag-drop operation as the user mouses over other drop | 25 // sent by an active drag-drop operation as the user mouses over other drop |
25 // targets on their system. This object tells Windows whether or not the drag | 26 // targets on their system. This object tells Windows whether or not the drag |
26 // should continue, and supplies the appropriate cursors. | 27 // should continue, and supplies the appropriate cursors. |
27 class WebDragSource : public ui::DragSourceWin, | 28 class WebDragSource : public ui::DragSourceWin, |
28 public NotificationObserver { | 29 public NotificationObserver { |
29 public: | 30 public: |
30 // Create a new DragSource for a given HWND and WebContents. | 31 // Create a new DragSource for a given HWND and WebContents. |
31 WebDragSource(gfx::NativeWindow source_wnd, WebContents* web_contents); | 32 WebDragSource(gfx::NativeWindow source_wnd, WebContents* web_contents); |
(...skipping 23 matching lines...) Expand all Loading... |
55 // OnDragSourceDrop schedules its main work to be done after IDropTarget::Drop | 56 // OnDragSourceDrop schedules its main work to be done after IDropTarget::Drop |
56 // by posting a task to this function. | 57 // by posting a task to this function. |
57 void DelayedOnDragSourceDrop(); | 58 void DelayedOnDragSourceDrop(); |
58 | 59 |
59 // Keep a reference to the window so we can translate the cursor position. | 60 // Keep a reference to the window so we can translate the cursor position. |
60 gfx::NativeWindow source_wnd_; | 61 gfx::NativeWindow source_wnd_; |
61 | 62 |
62 // We use this as a channel to the renderer to tell it about various drag | 63 // We use this as a channel to the renderer to tell it about various drag |
63 // drop events that it needs to know about (such as when a drag operation it | 64 // drop events that it needs to know about (such as when a drag operation it |
64 // initiated terminates). | 65 // initiated terminates). |
65 RenderViewHost* render_view_host_; | 66 WebContentsImpl* web_contents_; |
66 | 67 |
67 NotificationRegistrar registrar_; | 68 NotificationRegistrar registrar_; |
68 | 69 |
69 DWORD effect_; | 70 DWORD effect_; |
70 | 71 |
71 ui::OSExchangeData* data_; | 72 ui::OSExchangeData* data_; |
72 | 73 |
73 DISALLOW_COPY_AND_ASSIGN(WebDragSource); | 74 DISALLOW_COPY_AND_ASSIGN(WebDragSource); |
74 }; | 75 }; |
75 | 76 |
76 } // namespace content | 77 } // namespace content |
77 | 78 |
78 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_ | 79 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_ |
OLD | NEW |