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_DEST_GTK_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_GTK_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_GTK_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/public/common/drop_data.h" |
14 #include "third_party/WebKit/public/web/WebDragOperation.h" | 15 #include "third_party/WebKit/public/web/WebDragOperation.h" |
15 #include "ui/base/gtk/gtk_signal.h" | 16 #include "ui/base/gtk/gtk_signal.h" |
16 #include "webkit/common/webdropdata.h" | |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class RenderViewHostImpl; | 20 class RenderViewHostImpl; |
21 class WebContents; | 21 class WebContents; |
22 class WebDragDestDelegate; | 22 class WebDragDestDelegate; |
23 | 23 |
24 // A helper class that handles DnD for drops in the renderer. In GTK parlance, | 24 // A helper class that handles DnD for drops in the renderer. In GTK parlance, |
25 // this handles destination-side DnD, but not source-side DnD. | 25 // this handles destination-side DnD, but not source-side DnD. |
26 class CONTENT_EXPORT WebDragDestGtk { | 26 class CONTENT_EXPORT WebDragDestGtk { |
27 public: | 27 public: |
28 WebDragDestGtk(WebContents* web_contents, GtkWidget* widget); | 28 WebDragDestGtk(WebContents* web_contents, GtkWidget* widget); |
29 ~WebDragDestGtk(); | 29 ~WebDragDestGtk(); |
30 | 30 |
31 WebDropData* current_drop_data() const { return drop_data_.get(); } | 31 DropData* current_drop_data() const { return drop_data_.get(); } |
32 | 32 |
33 // This is called when the renderer responds to a drag motion event. We must | 33 // This is called when the renderer responds to a drag motion event. We must |
34 // update the system drag cursor. | 34 // update the system drag cursor. |
35 void UpdateDragStatus(WebKit::WebDragOperation operation); | 35 void UpdateDragStatus(WebKit::WebDragOperation operation); |
36 | 36 |
37 // Informs the renderer when a system drag has left the render view. | 37 // Informs the renderer when a system drag has left the render view. |
38 // See OnDragLeave(). | 38 // See OnDragLeave(). |
39 void DragLeave(); | 39 void DragLeave(); |
40 | 40 |
41 WebDragDestDelegate* delegate() const { return delegate_; } | 41 WebDragDestDelegate* delegate() const { return delegate_; } |
(...skipping 30 matching lines...) Expand all Loading... |
72 WebContents* web_contents_; | 72 WebContents* web_contents_; |
73 | 73 |
74 // The render view. | 74 // The render view. |
75 GtkWidget* widget_; | 75 GtkWidget* widget_; |
76 | 76 |
77 // The current drag context for system drags over our render view, or NULL if | 77 // The current drag context for system drags over our render view, or NULL if |
78 // there is no system drag or the system drag is not over our render view. | 78 // there is no system drag or the system drag is not over our render view. |
79 GdkDragContext* context_; | 79 GdkDragContext* context_; |
80 | 80 |
81 // The data for the current drag, or NULL if |context_| is NULL. | 81 // The data for the current drag, or NULL if |context_| is NULL. |
82 scoped_ptr<WebDropData> drop_data_; | 82 scoped_ptr<DropData> drop_data_; |
83 | 83 |
84 // The number of outstanding drag data requests we have sent to the drag | 84 // The number of outstanding drag data requests we have sent to the drag |
85 // source. | 85 // source. |
86 int data_requests_; | 86 int data_requests_; |
87 | 87 |
88 // The last time we sent a message to the renderer related to a drag motion. | 88 // The last time we sent a message to the renderer related to a drag motion. |
89 gint drag_over_time_; | 89 gint drag_over_time_; |
90 | 90 |
91 // Whether the cursor is over a drop target, according to the last message we | 91 // Whether the cursor is over a drop target, according to the last message we |
92 // got from the renderer. | 92 // got from the renderer. |
(...skipping 12 matching lines...) Expand all Loading... |
105 bool canceled_; | 105 bool canceled_; |
106 | 106 |
107 base::WeakPtrFactory<WebDragDestGtk> method_factory_; | 107 base::WeakPtrFactory<WebDragDestGtk> method_factory_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(WebDragDestGtk); | 109 DISALLOW_COPY_AND_ASSIGN(WebDragDestGtk); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace content | 112 } // namespace content |
113 | 113 |
114 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_GTK_H_ | 114 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_GTK_H_ |
OLD | NEW |