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_GTK_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/public/browser/web_contents.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
17 #include "ui/base/gtk/gtk_signal.h" | 18 #include "ui/base/gtk/gtk_signal.h" |
18 #include "ui/base/gtk/gtk_signal_registrar.h" | 19 #include "ui/base/gtk/gtk_signal_registrar.h" |
19 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
20 #include "ui/gfx/vector2d.h" | 21 #include "ui/gfx/vector2d.h" |
21 | 22 |
22 class SkBitmap; | 23 class SkBitmap; |
23 struct WebDropData; | 24 struct WebDropData; |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 | 27 |
27 class RenderViewHostImpl; | 28 class RenderViewHostImpl; |
28 class WebContents; | 29 class WebContentsImpl; |
29 | 30 |
30 // WebDragSourceGtk takes care of managing the drag from a WebContents | 31 // WebDragSourceGtk takes care of managing the drag from a WebContents |
31 // with Gtk. | 32 // with Gtk. |
32 class CONTENT_EXPORT WebDragSourceGtk : public MessageLoopForUI::Observer { | 33 class CONTENT_EXPORT WebDragSourceGtk : public MessageLoopForUI::Observer { |
33 public: | 34 public: |
34 explicit WebDragSourceGtk(WebContents* web_contents); | 35 explicit WebDragSourceGtk(WebContents* web_contents); |
35 virtual ~WebDragSourceGtk(); | 36 virtual ~WebDragSourceGtk(); |
36 | 37 |
37 // Starts a drag for the WebContents this WebDragSourceGtk was created for. | 38 // Starts a drag for the WebContents this WebDragSourceGtk was created for. |
38 // Returns false if the drag could not be started. | 39 // Returns false if the drag could not be started. |
(...skipping 12 matching lines...) Expand all Loading... |
51 GdkDragContext*, GtkDragResult); | 52 GdkDragContext*, GtkDragResult); |
52 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, void, OnDragBegin, | 53 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, void, OnDragBegin, |
53 GdkDragContext*); | 54 GdkDragContext*); |
54 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, void, OnDragEnd, | 55 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, void, OnDragEnd, |
55 GdkDragContext*); | 56 GdkDragContext*); |
56 CHROMEGTK_CALLBACK_4(WebDragSourceGtk, void, OnDragDataGet, | 57 CHROMEGTK_CALLBACK_4(WebDragSourceGtk, void, OnDragDataGet, |
57 GdkDragContext*, GtkSelectionData*, guint, guint); | 58 GdkDragContext*, GtkSelectionData*, guint, guint); |
58 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, gboolean, OnDragIconExpose, | 59 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, gboolean, OnDragIconExpose, |
59 GdkEventExpose*); | 60 GdkEventExpose*); |
60 | 61 |
61 RenderViewHostImpl* GetRenderViewHost() const; | |
62 gfx::NativeView GetContentNativeView() const; | 62 gfx::NativeView GetContentNativeView() const; |
63 | 63 |
64 // The tab we're manging the drag for. | 64 // The tab we're manging the drag for. |
65 WebContents* web_contents_; | 65 WebContentsImpl* web_contents_; |
66 | 66 |
67 // The drop data for the current drag (for drags that originate in the render | 67 // The drop data for the current drag (for drags that originate in the render |
68 // view). Non-NULL iff there is a current drag. | 68 // view). Non-NULL iff there is a current drag. |
69 scoped_ptr<WebDropData> drop_data_; | 69 scoped_ptr<WebDropData> drop_data_; |
70 | 70 |
71 // The image used for depicting the drag, and the offset between the cursor | 71 // The image used for depicting the drag, and the offset between the cursor |
72 // and the top left pixel. | 72 // and the top left pixel. |
73 GdkPixbuf* drag_pixbuf_; | 73 GdkPixbuf* drag_pixbuf_; |
74 gfx::Vector2d image_offset_; | 74 gfx::Vector2d image_offset_; |
75 | 75 |
(...skipping 29 matching lines...) Expand all Loading... |
105 GtkWidget* drag_icon_; | 105 GtkWidget* drag_icon_; |
106 | 106 |
107 ui::GtkSignalRegistrar signals_; | 107 ui::GtkSignalRegistrar signals_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(WebDragSourceGtk); | 109 DISALLOW_COPY_AND_ASSIGN(WebDragSourceGtk); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace content | 112 } // namespace content |
113 | 113 |
114 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_ | 114 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_ |
OLD | NEW |