OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_GTK_TAB_CONTENTS_DRAG_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_GTK_TAB_CONTENTS_DRAG_SOURCE_H_ |
6 #define CHROME_BROWSER_GTK_TAB_CONTENTS_DRAG_SOURCE_H_ | 6 #define CHROME_BROWSER_GTK_TAB_CONTENTS_DRAG_SOURCE_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/gfx/native_widget_types.h" | 11 #include "base/gfx/native_widget_types.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "webkit/api/public/WebDragOperation.h" |
13 | 14 |
14 class TabContents; | 15 class TabContents; |
15 class TabContentsView; | 16 class TabContentsView; |
16 struct WebDropData; | 17 struct WebDropData; |
17 | 18 |
18 // TabContentsDragSource takes care of managing the drag from a TabContents | 19 // TabContentsDragSource takes care of managing the drag from a TabContents |
19 // with Gtk. | 20 // with Gtk. |
20 class TabContentsDragSource : public MessageLoopForUI::Observer { | 21 class TabContentsDragSource : public MessageLoopForUI::Observer { |
21 public: | 22 public: |
22 explicit TabContentsDragSource(TabContentsView* tab_contents_view); | 23 explicit TabContentsDragSource(TabContentsView* tab_contents_view); |
(...skipping 14 matching lines...) Expand all Loading... |
37 static gboolean OnDragFailedThunk(GtkWidget* widget, | 38 static gboolean OnDragFailedThunk(GtkWidget* widget, |
38 GdkDragContext* drag_context, | 39 GdkDragContext* drag_context, |
39 GtkDragResult result, | 40 GtkDragResult result, |
40 TabContentsDragSource* handler) { | 41 TabContentsDragSource* handler) { |
41 return handler->OnDragFailed(); | 42 return handler->OnDragFailed(); |
42 } | 43 } |
43 gboolean OnDragFailed(); | 44 gboolean OnDragFailed(); |
44 static void OnDragEndThunk(GtkWidget* widget, | 45 static void OnDragEndThunk(GtkWidget* widget, |
45 GdkDragContext* drag_context, | 46 GdkDragContext* drag_context, |
46 TabContentsDragSource* handler) { | 47 TabContentsDragSource* handler) { |
47 handler->OnDragEnd(); | 48 handler->OnDragEnd(WebKit::WebDragOperationCopy); |
| 49 // TODO(snej): Pass actual operation instead of hardcoding copy |
48 } | 50 } |
49 void OnDragEnd(); | 51 void OnDragEnd(WebKit::WebDragOperation operation); |
50 static void OnDragDataGetThunk(GtkWidget* drag_widget, | 52 static void OnDragDataGetThunk(GtkWidget* drag_widget, |
51 GdkDragContext* context, | 53 GdkDragContext* context, |
52 GtkSelectionData* selection_data, | 54 GtkSelectionData* selection_data, |
53 guint target_type, | 55 guint target_type, |
54 guint time, | 56 guint time, |
55 TabContentsDragSource* handler) { | 57 TabContentsDragSource* handler) { |
56 handler->OnDragDataGet(context, selection_data, target_type, time); | 58 handler->OnDragDataGet(context, selection_data, target_type, time); |
57 } | 59 } |
58 void OnDragDataGet(GdkDragContext* context, GtkSelectionData* selection_data, | 60 void OnDragDataGet(GdkDragContext* context, GtkSelectionData* selection_data, |
59 guint target_type, guint time); | 61 guint target_type, guint time); |
(...skipping 16 matching lines...) Expand all Loading... |
76 | 78 |
77 // This is the widget we use to initiate drags. Since we don't use the | 79 // This is the widget we use to initiate drags. Since we don't use the |
78 // renderer widget, we can persist drags even when our contents is switched | 80 // renderer widget, we can persist drags even when our contents is switched |
79 // out. | 81 // out. |
80 GtkWidget* drag_widget_; | 82 GtkWidget* drag_widget_; |
81 | 83 |
82 DISALLOW_COPY_AND_ASSIGN(TabContentsDragSource); | 84 DISALLOW_COPY_AND_ASSIGN(TabContentsDragSource); |
83 }; | 85 }; |
84 | 86 |
85 #endif // CHROME_BROWSER_GTK_TAB_CONTENTS_DRAG_SOURCE_H_ | 87 #endif // CHROME_BROWSER_GTK_TAB_CONTENTS_DRAG_SOURCE_H_ |
OLD | NEW |