OLD | NEW |
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 #import "content/browser/tab_contents/web_drag_source_mac.h" | 5 #import "content/browser/tab_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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 drag_download_util::CreateFileStreamForDrop(&filePath); | 326 drag_download_util::CreateFileStreamForDrop(&filePath); |
327 if (!fileStream) | 327 if (!fileStream) |
328 return nil; | 328 return nil; |
329 | 329 |
330 if (downloadURL_.is_valid()) { | 330 if (downloadURL_.is_valid()) { |
331 scoped_refptr<DragDownloadFile> dragFileDownloader(new DragDownloadFile( | 331 scoped_refptr<DragDownloadFile> dragFileDownloader(new DragDownloadFile( |
332 filePath, | 332 filePath, |
333 linked_ptr<net::FileStream>(fileStream), | 333 linked_ptr<net::FileStream>(fileStream), |
334 downloadURL_, | 334 downloadURL_, |
335 contents_->GetURL(), | 335 contents_->GetURL(), |
336 contents_->encoding(), | 336 contents_->GetEncoding(), |
337 contents_)); | 337 contents_)); |
338 | 338 |
339 // The finalizer will take care of closing and deletion. | 339 // The finalizer will take care of closing and deletion. |
340 dragFileDownloader->Start( | 340 dragFileDownloader->Start( |
341 new drag_download_util::PromiseFileFinalizer(dragFileDownloader)); | 341 new drag_download_util::PromiseFileFinalizer(dragFileDownloader)); |
342 } else { | 342 } else { |
343 // The writer will take care of closing and deletion. | 343 // The writer will take care of closing and deletion. |
344 BrowserThread::PostTask(BrowserThread::FILE, | 344 BrowserThread::PostTask(BrowserThread::FILE, |
345 FROM_HERE, | 345 FROM_HERE, |
346 base::Bind(&PromiseWriterHelper, | 346 base::Bind(&PromiseWriterHelper, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 437 |
438 - (NSImage*)dragImage { | 438 - (NSImage*)dragImage { |
439 if (dragImage_) | 439 if (dragImage_) |
440 return dragImage_; | 440 return dragImage_; |
441 | 441 |
442 // Default to returning a generic image. | 442 // Default to returning a generic image. |
443 return gfx::GetCachedImageWithName(@"nav.pdf"); | 443 return gfx::GetCachedImageWithName(@"nav.pdf"); |
444 } | 444 } |
445 | 445 |
446 @end // @implementation WebDragSource (Private) | 446 @end // @implementation WebDragSource (Private) |
OLD | NEW |