| OLD | NEW |
| 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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 - (void)writePromisedFileTo:(NSString*)path { | 362 - (void)writePromisedFileTo:(NSString*)path { |
| 363 // Be extra paranoid; avoid crashing. | 363 // Be extra paranoid; avoid crashing. |
| 364 if (!dropData_) { | 364 if (!dropData_) { |
| 365 NOTREACHED() << "No drag-and-drop data available for promised file."; | 365 NOTREACHED() << "No drag-and-drop data available for promised file."; |
| 366 return; | 366 return; |
| 367 } | 367 } |
| 368 | 368 |
| 369 base::FilePath filePath(SysNSStringToUTF8(path)); | 369 base::FilePath filePath(SysNSStringToUTF8(path)); |
| 370 filePath = filePath.Append(downloadFileName_); | 370 filePath = filePath.Append(downloadFileName_); |
| 371 | 371 |
| 372 // CreateFileStreamForDrop() will call file_util::PathExists(), | 372 // CreateFileStreamForDrop() will call base::PathExists(), |
| 373 // which is blocking. Since this operation is already blocking the | 373 // which is blocking. Since this operation is already blocking the |
| 374 // UI thread on OSX, it should be reasonable to let it happen. | 374 // UI thread on OSX, it should be reasonable to let it happen. |
| 375 base::ThreadRestrictions::ScopedAllowIO allowIO; | 375 base::ThreadRestrictions::ScopedAllowIO allowIO; |
| 376 scoped_ptr<FileStream> fileStream(content::CreateFileStreamForDrop( | 376 scoped_ptr<FileStream> fileStream(content::CreateFileStreamForDrop( |
| 377 &filePath, content::GetContentClient()->browser()->GetNetLog())); | 377 &filePath, content::GetContentClient()->browser()->GetNetLog())); |
| 378 if (!fileStream) | 378 if (!fileStream) |
| 379 return; | 379 return; |
| 380 | 380 |
| 381 if (downloadURL_.is_valid()) { | 381 if (downloadURL_.is_valid()) { |
| 382 scoped_refptr<DragDownloadFile> dragFileDownloader(new DragDownloadFile( | 382 scoped_refptr<DragDownloadFile> dragFileDownloader(new DragDownloadFile( |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 - (NSImage*)dragImage { | 501 - (NSImage*)dragImage { |
| 502 if (dragImage_) | 502 if (dragImage_) |
| 503 return dragImage_; | 503 return dragImage_; |
| 504 | 504 |
| 505 // Default to returning a generic image. | 505 // Default to returning a generic image. |
| 506 return content::GetContentClient()->GetNativeImageNamed( | 506 return content::GetContentClient()->GetNativeImageNamed( |
| 507 IDR_DEFAULT_FAVICON).ToNSImage(); | 507 IDR_DEFAULT_FAVICON).ToNSImage(); |
| 508 } | 508 } |
| 509 | 509 |
| 510 @end // @implementation WebDragSource (Private) | 510 @end // @implementation WebDragSource (Private) |
| OLD | NEW |