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 #include "content/browser/tab_contents/web_drag_source_gtk.h" | 5 #include "content/browser/tab_contents/web_drag_source_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/nix/mime_util_xdg.h" | 10 #include "base/nix/mime_util_xdg.h" |
11 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "content/browser/download/drag_download_file.h" | 13 #include "content/browser/download/drag_download_file.h" |
14 #include "content/browser/download/drag_download_util.h" | 14 #include "content/browser/download/drag_download_util.h" |
15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
16 #include "content/browser/renderer_host/render_view_host_delegate.h" | 16 #include "content/browser/renderer_host/render_view_host_delegate.h" |
17 #include "content/browser/tab_contents/drag_utils_gtk.h" | 17 #include "content/browser/tab_contents/drag_utils_gtk.h" |
18 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
19 #include "content/browser/tab_contents/tab_contents_view.h" | 19 #include "content/browser/tab_contents/tab_contents_view.h" |
20 #include "content/public/browser/content_browser_client.h" | 20 #include "content/public/browser/content_browser_client.h" |
21 #include "net/base/file_stream.h" | 21 #include "net/base/file_stream.h" |
22 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
23 #include "ui/base/dragdrop/gtk_dnd_util.h" | 23 #include "ui/base/dragdrop/gtk_dnd_util.h" |
| 24 #include "ui/base/gtk/gtk_compat.h" |
24 #include "ui/base/gtk/gtk_screen_utils.h" | 25 #include "ui/base/gtk/gtk_screen_utils.h" |
25 #include "ui/gfx/gtk_util.h" | 26 #include "ui/gfx/gtk_util.h" |
26 #include "webkit/glue/webdropdata.h" | 27 #include "webkit/glue/webdropdata.h" |
27 | 28 |
28 using WebKit::WebDragOperation; | 29 using WebKit::WebDragOperation; |
29 using WebKit::WebDragOperationsMask; | 30 using WebKit::WebDragOperationsMask; |
30 using WebKit::WebDragOperationNone; | 31 using WebKit::WebDragOperationNone; |
31 | 32 |
32 namespace content { | 33 namespace content { |
33 | 34 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 generated_download_file_name.value().c_str()), | 315 generated_download_file_name.value().c_str()), |
315 generated_download_file_name.value().length()); | 316 generated_download_file_name.value().length()); |
316 } | 317 } |
317 | 318 |
318 if (drag_pixbuf_) { | 319 if (drag_pixbuf_) { |
319 gtk_widget_set_size_request(drag_icon_, | 320 gtk_widget_set_size_request(drag_icon_, |
320 gdk_pixbuf_get_width(drag_pixbuf_), | 321 gdk_pixbuf_get_width(drag_pixbuf_), |
321 gdk_pixbuf_get_height(drag_pixbuf_)); | 322 gdk_pixbuf_get_height(drag_pixbuf_)); |
322 | 323 |
323 // We only need to do this once. | 324 // We only need to do this once. |
324 if (!GTK_WIDGET_REALIZED(drag_icon_)) { | 325 if (!gtk_widget_get_realized(drag_icon_)) { |
325 GdkScreen* screen = gtk_widget_get_screen(drag_icon_); | 326 GdkScreen* screen = gtk_widget_get_screen(drag_icon_); |
326 GdkColormap* rgba = gdk_screen_get_rgba_colormap(screen); | 327 GdkColormap* rgba = gdk_screen_get_rgba_colormap(screen); |
327 if (rgba) | 328 if (rgba) |
328 gtk_widget_set_colormap(drag_icon_, rgba); | 329 gtk_widget_set_colormap(drag_icon_, rgba); |
329 } | 330 } |
330 | 331 |
331 gtk_drag_set_icon_widget(drag_context, drag_icon_, | 332 gtk_drag_set_icon_widget(drag_context, drag_icon_, |
332 image_offset_.x(), image_offset_.y()); | 333 image_offset_.x(), image_offset_.y()); |
333 } | 334 } |
334 } | 335 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 cairo_clip(cr); | 376 cairo_clip(cr); |
376 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); | 377 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
377 gdk_cairo_set_source_pixbuf(cr, drag_pixbuf_, 0, 0); | 378 gdk_cairo_set_source_pixbuf(cr, drag_pixbuf_, 0, 0); |
378 cairo_paint(cr); | 379 cairo_paint(cr); |
379 cairo_destroy(cr); | 380 cairo_destroy(cr); |
380 | 381 |
381 return TRUE; | 382 return TRUE; |
382 } | 383 } |
383 | 384 |
384 } // namespace content | 385 } // namespace content |
OLD | NEW |