| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TAB_CONTENTS_WEB_DRAG_DEST_GTK_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_GTK_H_ |
| 6 #define CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_GTK_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/task.h" | 13 #include "base/task.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
| 16 #include "ui/base/gtk/gtk_signal.h" | 16 #include "ui/base/gtk/gtk_signal.h" |
| 17 #include "webkit/glue/webdropdata.h" | 17 #include "webkit/glue/webdropdata.h" |
| 18 | 18 |
| 19 class TabContents; | 19 class TabContents; |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 | 22 |
| 23 class WebDragDestDelegateGtk; | 23 class WebDragDestDelegate; |
| 24 | 24 |
| 25 // A helper class that handles DnD for drops in the renderer. In GTK parlance, | 25 // A helper class that handles DnD for drops in the renderer. In GTK parlance, |
| 26 // this handles destination-side DnD, but not source-side DnD. | 26 // this handles destination-side DnD, but not source-side DnD. |
| 27 class CONTENT_EXPORT WebDragDestGtk { | 27 class CONTENT_EXPORT WebDragDestGtk { |
| 28 public: | 28 public: |
| 29 WebDragDestGtk(TabContents* tab_contents, GtkWidget* widget); | 29 WebDragDestGtk(TabContents* tab_contents, GtkWidget* widget); |
| 30 virtual ~WebDragDestGtk(); | 30 virtual ~WebDragDestGtk(); |
| 31 | 31 |
| 32 // This is called when the renderer responds to a drag motion event. We must | 32 // This is called when the renderer responds to a drag motion event. We must |
| 33 // update the system drag cursor. | 33 // update the system drag cursor. |
| 34 void UpdateDragStatus(WebKit::WebDragOperation operation); | 34 void UpdateDragStatus(WebKit::WebDragOperation operation); |
| 35 | 35 |
| 36 // Informs the renderer when a system drag has left the render view. | 36 // Informs the renderer when a system drag has left the render view. |
| 37 // See OnDragLeave(). | 37 // See OnDragLeave(). |
| 38 void DragLeave(); | 38 void DragLeave(); |
| 39 | 39 |
| 40 WebDragDestDelegateGtk* delegate() const { return delegate_; } | 40 WebDragDestDelegate* delegate() const { return delegate_; } |
| 41 void set_delegate(WebDragDestDelegateGtk* delegate) { delegate_ = delegate; } | 41 void set_delegate(WebDragDestDelegate* delegate) { delegate_ = delegate; } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 // Called when a system drag crosses over the render view. As there is no drag | 44 // Called when a system drag crosses over the render view. As there is no drag |
| 45 // enter event, we treat it as an enter event (and not a regular motion event) | 45 // enter event, we treat it as an enter event (and not a regular motion event) |
| 46 // when |context_| is NULL. | 46 // when |context_| is NULL. |
| 47 CHROMEGTK_CALLBACK_4(WebDragDestGtk, gboolean, OnDragMotion, GdkDragContext*, | 47 CHROMEGTK_CALLBACK_4(WebDragDestGtk, gboolean, OnDragMotion, GdkDragContext*, |
| 48 gint, gint, guint); | 48 gint, gint, guint); |
| 49 | 49 |
| 50 // We make a series of requests for the drag data when the drag first enters | 50 // We make a series of requests for the drag data when the drag first enters |
| 51 // the render view. This is the callback that is used to give us the data | 51 // the render view. This is the callback that is used to give us the data |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // got from the renderer. | 87 // got from the renderer. |
| 88 bool is_drop_target_; | 88 bool is_drop_target_; |
| 89 | 89 |
| 90 // Handler ID for the destroy signal handler. We connect to the destroy | 90 // Handler ID for the destroy signal handler. We connect to the destroy |
| 91 // signal handler so that we won't call dest_unset on it after it is | 91 // signal handler so that we won't call dest_unset on it after it is |
| 92 // destroyed, but we have to cancel the handler if we are destroyed before | 92 // destroyed, but we have to cancel the handler if we are destroyed before |
| 93 // |widget_| is. | 93 // |widget_| is. |
| 94 int destroy_handler_; | 94 int destroy_handler_; |
| 95 | 95 |
| 96 // A delegate that can receive drag information about drag events. | 96 // A delegate that can receive drag information about drag events. |
| 97 WebDragDestDelegateGtk* delegate_; | 97 WebDragDestDelegate* delegate_; |
| 98 | 98 |
| 99 ScopedRunnableMethodFactory<WebDragDestGtk> method_factory_; | 99 ScopedRunnableMethodFactory<WebDragDestGtk> method_factory_; |
| 100 | 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(WebDragDestGtk); | 101 DISALLOW_COPY_AND_ASSIGN(WebDragDestGtk); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace content | 104 } // namespace content |
| 105 | 105 |
| 106 #endif // CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_GTK_H_ | 106 #endif // CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_GTK_H_ |
| OLD | NEW |