| 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 #include "chrome/browser/gtk/tab_contents_drag_source.h" | 5 #include "chrome/browser/gtk/tab_contents_drag_source.h" |
| 6 | 6 |
| 7 #include "app/gtk_dnd_util.h" | 7 #include "app/gtk_dnd_util.h" |
| 8 #include "base/mime_util.h" | 8 #include "base/mime_util.h" |
| 9 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 9 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 void TabContentsDragSource::DidProcessEvent(GdkEvent* event) { | 109 void TabContentsDragSource::DidProcessEvent(GdkEvent* event) { |
| 110 if (event->type != GDK_MOTION_NOTIFY) | 110 if (event->type != GDK_MOTION_NOTIFY) |
| 111 return; | 111 return; |
| 112 | 112 |
| 113 GdkEventMotion* event_motion = reinterpret_cast<GdkEventMotion*>(event); | 113 GdkEventMotion* event_motion = reinterpret_cast<GdkEventMotion*>(event); |
| 114 gfx::Point client = gtk_util::ClientPoint(GetContentNativeView()); | 114 gfx::Point client = gtk_util::ClientPoint(GetContentNativeView()); |
| 115 | 115 |
| 116 if (tab_contents()->render_view_host()) { | 116 if (tab_contents()->render_view_host()) { |
| 117 tab_contents()->render_view_host()->DragSourceMovedTo( | 117 tab_contents()->render_view_host()->DragSourceMovedTo( |
| 118 client.x(), client.y(), event_motion->x_root, event_motion->y_root); | 118 client.x(), client.y(), |
| 119 static_cast<int>(event_motion->x_root), |
| 120 static_cast<int>(event_motion->y_root)); |
| 119 } | 121 } |
| 120 } | 122 } |
| 121 | 123 |
| 122 void TabContentsDragSource::OnDragDataGet( | 124 void TabContentsDragSource::OnDragDataGet( |
| 123 GdkDragContext* context, GtkSelectionData* selection_data, | 125 GdkDragContext* context, GtkSelectionData* selection_data, |
| 124 guint target_type, guint time) { | 126 guint target_type, guint time) { |
| 125 const int bits_per_byte = 8; | 127 const int bits_per_byte = 8; |
| 126 | 128 |
| 127 switch (target_type) { | 129 switch (target_type) { |
| 128 case GtkDndUtil::TEXT_PLAIN: { | 130 case GtkDndUtil::TEXT_PLAIN: { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 199 |
| 198 if (tab_contents()->render_view_host()) | 200 if (tab_contents()->render_view_host()) |
| 199 tab_contents()->render_view_host()->DragSourceSystemDragEnded(); | 201 tab_contents()->render_view_host()->DragSourceSystemDragEnded(); |
| 200 | 202 |
| 201 drop_data_.reset(); | 203 drop_data_.reset(); |
| 202 } | 204 } |
| 203 | 205 |
| 204 gfx::NativeView TabContentsDragSource::GetContentNativeView() const { | 206 gfx::NativeView TabContentsDragSource::GetContentNativeView() const { |
| 205 return tab_contents_view_->GetContentNativeView(); | 207 return tab_contents_view_->GetContentNativeView(); |
| 206 } | 208 } |
| OLD | NEW |