Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: content/browser/tab_contents/web_drag_source_gtk.cc

Issue 8538008: Linux: Move base/mime_util* to base/nix. It's not used on any other platform. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/dialogs_kde.cc ('k') | net/base/platform_mime_util_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/mime_util.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"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // bad on non-compositing WMs. Fall back to the default drag icon. 107 // bad on non-compositing WMs. Fall back to the default drag icon.
108 if (!image.isNull() && ui::IsScreenComposited()) 108 if (!image.isNull() && ui::IsScreenComposited())
109 drag_pixbuf_ = gfx::GdkPixbufFromSkBitmap(&image); 109 drag_pixbuf_ = gfx::GdkPixbufFromSkBitmap(&image);
110 image_offset_ = image_offset; 110 image_offset_ = image_offset;
111 111
112 GtkTargetList* list = ui::GetTargetListFromCodeMask(targets_mask); 112 GtkTargetList* list = ui::GetTargetListFromCodeMask(targets_mask);
113 if (targets_mask & ui::CHROME_WEBDROP_FILE_CONTENTS) { 113 if (targets_mask & ui::CHROME_WEBDROP_FILE_CONTENTS) {
114 // Looking up the mime type can hit the disk. http://crbug.com/84896 114 // Looking up the mime type can hit the disk. http://crbug.com/84896
115 base::ThreadRestrictions::ScopedAllowIO allow_io; 115 base::ThreadRestrictions::ScopedAllowIO allow_io;
116 drag_file_mime_type_ = gdk_atom_intern( 116 drag_file_mime_type_ = gdk_atom_intern(
117 mime_util::GetDataMimeType(drop_data.file_contents).c_str(), FALSE); 117 base::nix::GetDataMimeType(drop_data.file_contents).c_str(), FALSE);
118 gtk_target_list_add(list, drag_file_mime_type_, 118 gtk_target_list_add(list, drag_file_mime_type_,
119 0, ui::CHROME_WEBDROP_FILE_CONTENTS); 119 0, ui::CHROME_WEBDROP_FILE_CONTENTS);
120 } 120 }
121 121
122 drag_failed_ = false; 122 drag_failed_ = false;
123 // If we don't pass an event, GDK won't know what event time to start grabbing 123 // If we don't pass an event, GDK won't know what event time to start grabbing
124 // mouse events. Technically it's the mouse motion event and not the mouse 124 // mouse events. Technically it's the mouse motion event and not the mouse
125 // down event that causes the drag, but there's no reliable way to know 125 // down event that causes the drag, but there's no reliable way to know
126 // *which* motion event initiated the drag, so this will have to do. 126 // *which* motion event initiated the drag, so this will have to do.
127 // TODO(estade): This can sometimes be very far off, e.g. if the user clicks 127 // TODO(estade): This can sometimes be very far off, e.g. if the user clicks
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 cairo_clip(cr); 375 cairo_clip(cr);
376 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); 376 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
377 gdk_cairo_set_source_pixbuf(cr, drag_pixbuf_, 0, 0); 377 gdk_cairo_set_source_pixbuf(cr, drag_pixbuf_, 0, 0);
378 cairo_paint(cr); 378 cairo_paint(cr);
379 cairo_destroy(cr); 379 cairo_destroy(cr);
380 380
381 return TRUE; 381 return TRUE;
382 } 382 }
383 383
384 } // namespace content 384 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/dialogs_kde.cc ('k') | net/base/platform_mime_util_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698