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

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

Issue 9296012: Hooked up NetLog to DownloadItem, DownloadFile, and FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk Created 8 years, 10 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tab_contents/drag_utils_gtk.h" 16 #include "content/browser/tab_contents/drag_utils_gtk.h"
17 #include "content/browser/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
18 #include "content/public/browser/content_browser_client.h" 18 #include "content/public/browser/content_browser_client.h"
19 #include "content/public/browser/render_view_host_delegate.h" 19 #include "content/public/browser/render_view_host_delegate.h"
20 #include "content/public/browser/web_contents_view.h" 20 #include "content/public/browser/web_contents_view.h"
21 #include "content/public/common/content_client.h"
21 #include "net/base/file_stream.h" 22 #include "net/base/file_stream.h"
22 #include "net/base/net_util.h" 23 #include "net/base/net_util.h"
23 #include "third_party/skia/include/core/SkBitmap.h" 24 #include "third_party/skia/include/core/SkBitmap.h"
24 #include "ui/base/clipboard/custom_data_helper.h" 25 #include "ui/base/clipboard/custom_data_helper.h"
25 #include "ui/base/dragdrop/gtk_dnd_util.h" 26 #include "ui/base/dragdrop/gtk_dnd_util.h"
26 #include "ui/base/gtk/gtk_compat.h" 27 #include "ui/base/gtk/gtk_compat.h"
27 #include "ui/base/gtk/gtk_screen_utils.h" 28 #include "ui/base/gtk/gtk_screen_utils.h"
28 #include "ui/gfx/gtk_util.h" 29 #include "ui/gfx/gtk_util.h"
29 #include "webkit/glue/webdropdata.h" 30 #include "webkit/glue/webdropdata.h"
30 31
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 &file_url_value) && 237 &file_url_value) &&
237 file_url_value) { 238 file_url_value) {
238 // Convert from the file url to the file path. 239 // Convert from the file url to the file path.
239 GURL file_url(std::string(reinterpret_cast<char*>(file_url_value), 240 GURL file_url(std::string(reinterpret_cast<char*>(file_url_value),
240 file_url_len)); 241 file_url_len));
241 g_free(file_url_value); 242 g_free(file_url_value);
242 FilePath file_path; 243 FilePath file_path;
243 if (net::FileURLToFilePath(file_url, &file_path)) { 244 if (net::FileURLToFilePath(file_url, &file_path)) {
244 // Open the file as a stream. 245 // Open the file as a stream.
245 net::FileStream* file_stream = 246 net::FileStream* file_stream =
246 drag_download_util::CreateFileStreamForDrop(&file_path); 247 drag_download_util::CreateFileStreamForDrop(
248 &file_path,
249 content::GetContentClient()->browser()->GetNetLog());
247 if (file_stream) { 250 if (file_stream) {
248 // Start downloading the file to the stream. 251 // Start downloading the file to the stream.
249 scoped_refptr<DragDownloadFile> drag_file_downloader = 252 scoped_refptr<DragDownloadFile> drag_file_downloader =
250 new DragDownloadFile(file_path, 253 new DragDownloadFile(file_path,
251 linked_ptr<net::FileStream>(file_stream), 254 linked_ptr<net::FileStream>(file_stream),
252 download_url_, 255 download_url_,
253 web_contents_->GetURL(), 256 web_contents_->GetURL(),
254 web_contents_->GetEncoding(), 257 web_contents_->GetEncoding(),
255 web_contents_); 258 web_contents_);
256 drag_file_downloader->Start( 259 drag_file_downloader->Start(
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 cairo_clip(cr); 396 cairo_clip(cr);
394 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); 397 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
395 gdk_cairo_set_source_pixbuf(cr, drag_pixbuf_, 0, 0); 398 gdk_cairo_set_source_pixbuf(cr, drag_pixbuf_, 0, 0);
396 cairo_paint(cr); 399 cairo_paint(cr);
397 cairo_destroy(cr); 400 cairo_destroy(cr);
398 401
399 return TRUE; 402 return TRUE;
400 } 403 }
401 404
402 } // namespace content 405 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/drag_download_util.cc ('k') | content/browser/tab_contents/web_drag_source_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698