| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/gtk_dnd_util.h" | 9 #include "app/gtk_dnd_util.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 if (!drag_image_.isNull()) { | 314 if (!drag_image_.isNull()) { |
| 315 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&drag_image_); | 315 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&drag_image_); |
| 316 gtk_drag_set_icon_pixbuf(drag_context, pixbuf, | 316 gtk_drag_set_icon_pixbuf(drag_context, pixbuf, |
| 317 image_offset_.x(), image_offset_.y()); | 317 image_offset_.x(), image_offset_.y()); |
| 318 // Let the drag take ownership. | 318 // Let the drag take ownership. |
| 319 g_object_unref(pixbuf); | 319 g_object_unref(pixbuf); |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 void TabContentsDragSource::OnDragEnd(GdkDragContext* drag_context, | 323 void TabContentsDragSource::OnDragEnd(GdkDragContext* drag_context, |
| 324 WebDragOperation operation) { | 324 GdkDragAction action) { |
| 325 MessageLoopForUI::current()->RemoveObserver(this); | 325 MessageLoopForUI::current()->RemoveObserver(this); |
| 326 | 326 |
| 327 if (!download_url_.is_empty()) { | 327 if (!download_url_.is_empty()) { |
| 328 gdk_property_delete(drag_context->source_window, | 328 gdk_property_delete(drag_context->source_window, |
| 329 gtk_dnd_util::GetAtomForTarget( | 329 gtk_dnd_util::GetAtomForTarget( |
| 330 gtk_dnd_util::DIRECT_SAVE_FILE)); | 330 gtk_dnd_util::DIRECT_SAVE_FILE)); |
| 331 } | 331 } |
| 332 | 332 |
| 333 if (!drag_failed_) { | 333 if (!drag_failed_) { |
| 334 gfx::Point root = gtk_util::ScreenPoint(GetContentNativeView()); | 334 gfx::Point root = gtk_util::ScreenPoint(GetContentNativeView()); |
| 335 gfx::Point client = gtk_util::ClientPoint(GetContentNativeView()); | 335 gfx::Point client = gtk_util::ClientPoint(GetContentNativeView()); |
| 336 | 336 |
| 337 if (tab_contents()->render_view_host()) { | 337 if (tab_contents()->render_view_host()) { |
| 338 tab_contents()->render_view_host()->DragSourceEndedAt( | 338 tab_contents()->render_view_host()->DragSourceEndedAt( |
| 339 client.x(), client.y(), root.x(), root.y(), operation); | 339 client.x(), client.y(), root.x(), root.y(), |
| 340 gtk_dnd_util::GdkDragActionToWebDragOp(action)); |
| 340 } | 341 } |
| 341 } | 342 } |
| 342 | 343 |
| 343 if (tab_contents()->render_view_host()) | 344 if (tab_contents()->render_view_host()) |
| 344 tab_contents()->render_view_host()->DragSourceSystemDragEnded(); | 345 tab_contents()->render_view_host()->DragSourceSystemDragEnded(); |
| 345 | 346 |
| 346 drop_data_.reset(); | 347 drop_data_.reset(); |
| 347 } | 348 } |
| 348 | 349 |
| 349 gfx::NativeView TabContentsDragSource::GetContentNativeView() const { | 350 gfx::NativeView TabContentsDragSource::GetContentNativeView() const { |
| 350 return tab_contents_view_->GetContentNativeView(); | 351 return tab_contents_view_->GetContentNativeView(); |
| 351 } | 352 } |
| OLD | NEW |