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

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

Issue 11028131: Shift passage of FileStream in downloads system to be by scoped_ptr<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated Al's comments. Created 8 years, 2 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/web_contents/web_drag_source_gtk.h" 5 #include "content/browser/web_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"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 &file_url_len, 237 &file_url_len,
238 &file_url_value) && 238 &file_url_value) &&
239 file_url_value) { 239 file_url_value) {
240 // Convert from the file url to the file path. 240 // Convert from the file url to the file path.
241 GURL file_url(std::string(reinterpret_cast<char*>(file_url_value), 241 GURL file_url(std::string(reinterpret_cast<char*>(file_url_value),
242 file_url_len)); 242 file_url_len));
243 g_free(file_url_value); 243 g_free(file_url_value);
244 FilePath file_path; 244 FilePath file_path;
245 if (net::FileURLToFilePath(file_url, &file_path)) { 245 if (net::FileURLToFilePath(file_url, &file_path)) {
246 // Open the file as a stream. 246 // Open the file as a stream.
247 net::FileStream* file_stream = 247 scoped_ptr<net::FileStream> file_stream(
248 drag_download_util::CreateFileStreamForDrop( 248 drag_download_util::CreateFileStreamForDrop(
249 &file_path, 249 &file_path,
250 content::GetContentClient()->browser()->GetNetLog()); 250 content::GetContentClient()->browser()->GetNetLog()));
251 if (file_stream) { 251 if (file_stream.get()) {
252 // Start downloading the file to the stream. 252 // Start downloading the file to the stream.
253 scoped_refptr<DragDownloadFile> drag_file_downloader = 253 scoped_refptr<DragDownloadFile> drag_file_downloader =
254 new DragDownloadFile( 254 new DragDownloadFile(
255 file_path, 255 file_path,
256 linked_ptr<net::FileStream>(file_stream), 256 file_stream.Pass(),
257 download_url_, 257 download_url_,
258 content::Referrer(web_contents_->GetURL(), 258 content::Referrer(web_contents_->GetURL(),
259 drop_data_->referrer_policy), 259 drop_data_->referrer_policy),
260 web_contents_->GetEncoding(), 260 web_contents_->GetEncoding(),
261 web_contents_); 261 web_contents_);
262 drag_file_downloader->Start( 262 drag_file_downloader->Start(
263 new drag_download_util::PromiseFileFinalizer( 263 new drag_download_util::PromiseFileFinalizer(
264 drag_file_downloader)); 264 drag_file_downloader));
265 265
266 // Set the status code to success. 266 // Set the status code to success.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 cairo_clip(cr); 403 cairo_clip(cr);
404 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); 404 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
405 gdk_cairo_set_source_pixbuf(cr, drag_pixbuf_, 0, 0); 405 gdk_cairo_set_source_pixbuf(cr, drag_pixbuf_, 0, 0);
406 cairo_paint(cr); 406 cairo_paint(cr);
407 cairo_destroy(cr); 407 cairo_destroy(cr);
408 408
409 return TRUE; 409 return TRUE;
410 } 410 }
411 411
412 } // namespace content 412 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/browser/web_contents/web_drag_source_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698