| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/threading/worker_pool.h" | 6 #include "base/threading/worker_pool.h" |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 8 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" |
| 9 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" | 9 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" |
| 10 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper
ation.h" | 10 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper
ation.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 } else if (download->GetState() == content::DownloadItem::INTERRUPTED) { | 160 } else if (download->GetState() == content::DownloadItem::INTERRUPTED) { |
| 161 Error(error::kDownloadInterrupted); | 161 Error(error::kDownloadInterrupted); |
| 162 } else if (download->GetState() == content::DownloadItem::CANCELLED) { | 162 } else if (download->GetState() == content::DownloadItem::CANCELLED) { |
| 163 Error(error::kDownloadCancelled); | 163 Error(error::kDownloadCancelled); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 void WriteFromUrlOperation::DownloadComplete() { | 167 void WriteFromUrlOperation::DownloadComplete() { |
| 168 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 168 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 169 DVLOG(1) << "Download complete."; | 169 DVLOG(0) << "Download complete: " << download_path_.value(); |
| 170 | 170 |
| 171 SetProgress(kProgressComplete); | 171 SetProgress(kProgressComplete); |
| 172 | 172 |
| 173 VerifyDownloadStart(); | 173 VerifyDownloadStart(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void WriteFromUrlOperation::DownloadCleanUp() { | 176 void WriteFromUrlOperation::DownloadCleanUp() { |
| 177 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 177 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 178 BrowserThread::PostTask( | 178 BrowserThread::PostTask( |
| 179 BrowserThread::UI, | 179 BrowserThread::UI, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 DVLOG(1) << "Download verification complete."; | 250 DVLOG(1) << "Download verification complete."; |
| 251 | 251 |
| 252 SetProgress(kProgressComplete); | 252 SetProgress(kProgressComplete); |
| 253 | 253 |
| 254 scoped_ptr<base::FilePath> download_path(new base::FilePath(download_path_)); | 254 scoped_ptr<base::FilePath> download_path(new base::FilePath(download_path_)); |
| 255 UnzipStart(download_path.Pass()); | 255 UnzipStart(download_path.Pass()); |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace image_writer | 258 } // namespace image_writer |
| 259 } // namespace extensions | 259 } // namespace extensions |
| OLD | NEW |