| 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 "chrome/browser/extensions/api/image_writer_private/operation.h" | 5 #include "chrome/browser/extensions/api/image_writer_private/operation.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 if (zip_reader_->HasMore()) { | 119 if (zip_reader_->HasMore()) { |
| 120 Error(error::kUnzipInvalidArchive); | 120 Error(error::kUnzipInvalidArchive); |
| 121 return; | 121 return; |
| 122 } | 122 } |
| 123 | 123 |
| 124 // Create a new target to unzip to. The original file is opened by the | 124 // Create a new target to unzip to. The original file is opened by the |
| 125 // zip_reader_. | 125 // zip_reader_. |
| 126 zip::ZipReader::EntryInfo* entry_info = zip_reader_->current_entry_info(); | 126 zip::ZipReader::EntryInfo* entry_info = zip_reader_->current_entry_info(); |
| 127 if (entry_info) { | 127 if (entry_info) { |
| 128 image_path_ = temp_dir_.path().Append(entry_info->file_path().BaseName()); | 128 image_path_ = |
| 129 temp_dir_.GetPath().Append(entry_info->file_path().BaseName()); |
| 129 } else { | 130 } else { |
| 130 Error(error::kTempDirError); | 131 Error(error::kTempDirError); |
| 131 return; | 132 return; |
| 132 } | 133 } |
| 133 | 134 |
| 134 zip_reader_->ExtractCurrentEntryToFilePathAsync( | 135 zip_reader_->ExtractCurrentEntryToFilePathAsync( |
| 135 image_path_, | 136 image_path_, |
| 136 base::Bind(&Operation::CompleteAndContinue, this, continuation), | 137 base::Bind(&Operation::CompleteAndContinue, this, continuation), |
| 137 base::Bind(&Operation::OnUnzipFailure, this), | 138 base::Bind(&Operation::OnUnzipFailure, this), |
| 138 base::Bind(&Operation::OnUnzipProgress, | 139 base::Bind(&Operation::OnUnzipProgress, |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 for (std::vector<base::Closure>::iterator it = cleanup_functions_.begin(); | 382 for (std::vector<base::Closure>::iterator it = cleanup_functions_.begin(); |
| 382 it != cleanup_functions_.end(); | 383 it != cleanup_functions_.end(); |
| 383 ++it) { | 384 ++it) { |
| 384 it->Run(); | 385 it->Run(); |
| 385 } | 386 } |
| 386 cleanup_functions_.clear(); | 387 cleanup_functions_.clear(); |
| 387 } | 388 } |
| 388 | 389 |
| 389 } // namespace image_writer | 390 } // namespace image_writer |
| 390 } // namespace extensions | 391 } // namespace extensions |
| OLD | NEW |