| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 void TabContentsDragSource::DidProcessEvent(GdkEvent* event) { | 106 void TabContentsDragSource::DidProcessEvent(GdkEvent* event) { |
| 107 if (event->type != GDK_MOTION_NOTIFY) | 107 if (event->type != GDK_MOTION_NOTIFY) |
| 108 return; | 108 return; |
| 109 | 109 |
| 110 GdkEventMotion* event_motion = reinterpret_cast<GdkEventMotion*>(event); | 110 GdkEventMotion* event_motion = reinterpret_cast<GdkEventMotion*>(event); |
| 111 gfx::Point client = gtk_util::ClientPoint(GetContentNativeView()); | 111 gfx::Point client = gtk_util::ClientPoint(GetContentNativeView()); |
| 112 | 112 |
| 113 if (tab_contents()->render_view_host()) { | 113 if (tab_contents()->render_view_host()) { |
| 114 tab_contents()->render_view_host()->DragSourceMovedTo( | 114 tab_contents()->render_view_host()->DragSourceMovedTo( |
| 115 client.x(), client.y(), | 115 client.x(), client.y(), event_motion->x_root, event_motion->y_root); |
| 116 static_cast<int>(event_motion->x_root), | |
| 117 static_cast<int>(event_motion->y_root)); | |
| 118 } | 116 } |
| 119 } | 117 } |
| 120 | 118 |
| 121 void TabContentsDragSource::OnDragDataGet( | 119 void TabContentsDragSource::OnDragDataGet( |
| 122 GdkDragContext* context, GtkSelectionData* selection_data, | 120 GdkDragContext* context, GtkSelectionData* selection_data, |
| 123 guint target_type, guint time) { | 121 guint target_type, guint time) { |
| 124 const int bits_per_byte = 8; | 122 const int bits_per_byte = 8; |
| 125 | 123 |
| 126 switch (target_type) { | 124 switch (target_type) { |
| 127 case GtkDndUtil::TEXT_PLAIN: { | 125 case GtkDndUtil::TEXT_PLAIN: { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 208 |
| 211 if (tab_contents()->render_view_host()) | 209 if (tab_contents()->render_view_host()) |
| 212 tab_contents()->render_view_host()->DragSourceSystemDragEnded(); | 210 tab_contents()->render_view_host()->DragSourceSystemDragEnded(); |
| 213 | 211 |
| 214 drop_data_.reset(); | 212 drop_data_.reset(); |
| 215 } | 213 } |
| 216 | 214 |
| 217 gfx::NativeView TabContentsDragSource::GetContentNativeView() const { | 215 gfx::NativeView TabContentsDragSource::GetContentNativeView() const { |
| 218 return tab_contents_view_->GetContentNativeView(); | 216 return tab_contents_view_->GetContentNativeView(); |
| 219 } | 217 } |
| OLD | NEW |