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

Side by Side Diff: content/browser/web_contents/web_drag_source_mac.mm

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: Removed blank line. 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 #import "content/browser/web_contents/web_drag_source_mac.h" 5 #import "content/browser/web_contents/web_drag_source_mac.h"
6 6
7 #include <sys/param.h> 7 #include <sys/param.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 335
336 FilePath fileName = downloadFileName_.empty() ? 336 FilePath fileName = downloadFileName_.empty() ?
337 GetFileNameFromDragData(*dropData_) : downloadFileName_; 337 GetFileNameFromDragData(*dropData_) : downloadFileName_;
338 FilePath filePath(SysNSStringToUTF8(path)); 338 FilePath filePath(SysNSStringToUTF8(path));
339 filePath = filePath.Append(fileName); 339 filePath = filePath.Append(fileName);
340 340
341 // CreateFileStreamForDrop() will call file_util::PathExists(), 341 // CreateFileStreamForDrop() will call file_util::PathExists(),
342 // which is blocking. Since this operation is already blocking the 342 // which is blocking. Since this operation is already blocking the
343 // UI thread on OSX, it should be reasonable to let it happen. 343 // UI thread on OSX, it should be reasonable to let it happen.
344 base::ThreadRestrictions::ScopedAllowIO allowIO; 344 base::ThreadRestrictions::ScopedAllowIO allowIO;
345 FileStream* fileStream = 345 scoped_ptr<FileStream> fileStream(
346 drag_download_util::CreateFileStreamForDrop( 346 drag_download_util::CreateFileStreamForDrop(
347 &filePath, content::GetContentClient()->browser()->GetNetLog()); 347 &filePath, content::GetContentClient()->browser()->GetNetLog()));
348 if (!fileStream) 348 if (!fileStream.get())
349 return nil; 349 return nil;
350 350
351 if (downloadURL_.is_valid()) { 351 if (downloadURL_.is_valid()) {
352 scoped_refptr<DragDownloadFile> dragFileDownloader(new DragDownloadFile( 352 scoped_refptr<DragDownloadFile> dragFileDownloader(new DragDownloadFile(
353 filePath, 353 filePath,
354 linked_ptr<net::FileStream>(fileStream), 354 fileStream.Pass(),
355 downloadURL_, 355 downloadURL_,
356 content::Referrer(contents_->GetURL(), dropData_->referrer_policy), 356 content::Referrer(contents_->GetURL(), dropData_->referrer_policy),
357 contents_->GetEncoding(), 357 contents_->GetEncoding(),
358 contents_)); 358 contents_));
359 359
360 // The finalizer will take care of closing and deletion. 360 // The finalizer will take care of closing and deletion.
361 dragFileDownloader->Start( 361 dragFileDownloader->Start(
362 new drag_download_util::PromiseFileFinalizer(dragFileDownloader)); 362 new drag_download_util::PromiseFileFinalizer(dragFileDownloader));
363 } else { 363 } else {
364 // The writer will take care of closing and deletion. 364 // The writer will take care of closing and deletion.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 - (NSImage*)dragImage { 464 - (NSImage*)dragImage {
465 if (dragImage_) 465 if (dragImage_)
466 return dragImage_; 466 return dragImage_;
467 467
468 // Default to returning a generic image. 468 // Default to returning a generic image.
469 return content::GetContentClient()->GetNativeImageNamed( 469 return content::GetContentClient()->GetNativeImageNamed(
470 IDR_DEFAULT_FAVICON).ToNSImage(); 470 IDR_DEFAULT_FAVICON).ToNSImage();
471 } 471 }
472 472
473 @end // @implementation WebDragSource (Private) 473 @end // @implementation WebDragSource (Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698