| 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 #include "content/browser/download/drag_download_util.h" | 5 #include "content/browser/download/drag_download_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 return NULL; | 93 return NULL; |
| 94 } | 94 } |
| 95 | 95 |
| 96 PromiseFileFinalizer::PromiseFileFinalizer( | 96 PromiseFileFinalizer::PromiseFileFinalizer( |
| 97 DragDownloadFile* drag_file_downloader) | 97 DragDownloadFile* drag_file_downloader) |
| 98 : drag_file_downloader_(drag_file_downloader) { | 98 : drag_file_downloader_(drag_file_downloader) { |
| 99 } | 99 } |
| 100 | 100 |
| 101 PromiseFileFinalizer::~PromiseFileFinalizer() {} | |
| 102 | |
| 103 void PromiseFileFinalizer::Cleanup() { | |
| 104 if (drag_file_downloader_.get()) | |
| 105 drag_file_downloader_ = NULL; | |
| 106 } | |
| 107 | |
| 108 void PromiseFileFinalizer::OnDownloadCompleted(const FilePath& file_path) { | 101 void PromiseFileFinalizer::OnDownloadCompleted(const FilePath& file_path) { |
| 109 BrowserThread::PostTask( | 102 BrowserThread::PostTask( |
| 110 BrowserThread::UI, FROM_HERE, | 103 BrowserThread::UI, FROM_HERE, |
| 111 base::Bind(&PromiseFileFinalizer::Cleanup, this)); | 104 base::Bind(&PromiseFileFinalizer::Cleanup, this)); |
| 112 } | 105 } |
| 113 | 106 |
| 114 void PromiseFileFinalizer::OnDownloadAborted() { | 107 void PromiseFileFinalizer::OnDownloadAborted() { |
| 115 BrowserThread::PostTask( | 108 BrowserThread::PostTask( |
| 116 BrowserThread::UI, FROM_HERE, | 109 BrowserThread::UI, FROM_HERE, |
| 117 base::Bind(&PromiseFileFinalizer::Cleanup, this)); | 110 base::Bind(&PromiseFileFinalizer::Cleanup, this)); |
| 118 } | 111 } |
| 119 | 112 |
| 113 PromiseFileFinalizer::~PromiseFileFinalizer() {} |
| 114 |
| 115 void PromiseFileFinalizer::Cleanup() { |
| 116 if (drag_file_downloader_.get()) |
| 117 drag_file_downloader_ = NULL; |
| 118 } |
| 119 |
| 120 } // namespace drag_download_util | 120 } // namespace drag_download_util |
| OLD | NEW |