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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 AddCleanUpFunction(base::Bind(&WriteFromUrlOperation::DownloadCleanUp, this)); | 60 AddCleanUpFunction(base::Bind(&WriteFromUrlOperation::DownloadCleanUp, this)); |
61 } | 61 } |
62 | 62 |
63 void WriteFromUrlOperation::CreateTempFile() { | 63 void WriteFromUrlOperation::CreateTempFile() { |
64 if (IsCancelled()) { | 64 if (IsCancelled()) { |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 tmp_file_.reset(new base::FilePath()); | 68 tmp_file_.reset(new base::FilePath()); |
69 | 69 |
70 if (file_util::CreateTemporaryFile(tmp_file_.get())) { | 70 if (base::CreateTemporaryFile(tmp_file_.get())) { |
71 BrowserThread::PostTask( | 71 BrowserThread::PostTask( |
72 BrowserThread::UI, | 72 BrowserThread::UI, |
73 FROM_HERE, | 73 FROM_HERE, |
74 base::Bind(&WriteFromUrlOperation::DownloadStart, this)); | 74 base::Bind(&WriteFromUrlOperation::DownloadStart, this)); |
75 } else { | 75 } else { |
76 Error(error::kTempFile); | 76 Error(error::kTempFile); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 // The downloader runs on the UI thread. | 80 // The downloader runs on the UI thread. |
(...skipping 169 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 |