| 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/files/file_enumerator.h" | 6 #include "base/files/file_enumerator.h" |
| 7 #include "base/threading/worker_pool.h" | 7 #include "base/threading/worker_pool.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.h" | 9 #include "chrome/browser/extensions/api/image_writer_private/operation.h" |
| 10 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" | 10 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 172 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 173 if (IsCancelled()) { | 173 if (IsCancelled()) { |
| 174 return; | 174 return; |
| 175 } | 175 } |
| 176 | 176 |
| 177 DVLOG(1) << "Starting unzip stage for " << zip_file->value(); | 177 DVLOG(1) << "Starting unzip stage for " << zip_file->value(); |
| 178 | 178 |
| 179 SetStage(image_writer_api::STAGE_UNZIP); | 179 SetStage(image_writer_api::STAGE_UNZIP); |
| 180 | 180 |
| 181 base::FilePath tmp_dir; | 181 base::FilePath tmp_dir; |
| 182 if (!file_util::CreateTemporaryDirInDir(zip_file->DirName(), | 182 if (!base::CreateTemporaryDirInDir(zip_file->DirName(), |
| 183 FILE_PATH_LITERAL("image_writer"), | 183 FILE_PATH_LITERAL("image_writer"), |
| 184 &tmp_dir)) { | 184 &tmp_dir)) { |
| 185 Error(error::kTempDir); | 185 Error(error::kTempDir); |
| 186 return; | 186 return; |
| 187 } | 187 } |
| 188 | 188 |
| 189 AddCleanUpFunction(base::Bind(&RemoveTempDirectory, tmp_dir)); | 189 AddCleanUpFunction(base::Bind(&RemoveTempDirectory, tmp_dir)); |
| 190 | 190 |
| 191 if (!zip::Unzip(*zip_file, tmp_dir)) { | 191 if (!zip::Unzip(*zip_file, tmp_dir)) { |
| 192 Error(error::kUnzip); | 192 Error(error::kUnzip); |
| 193 return; | 193 return; |
| 194 } | 194 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 callback.Run(hash.Pass()); | 311 callback.Run(hash.Pass()); |
| 312 } | 312 } |
| 313 } else { // len < 0 | 313 } else { // len < 0 |
| 314 reader->Close(); | 314 reader->Close(); |
| 315 Error(error::kReadImage); | 315 Error(error::kReadImage); |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 | 318 |
| 319 } // namespace image_writer | 319 } // namespace image_writer |
| 320 } // namespace extensions | 320 } // namespace extensions |
| OLD | NEW |