| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef THIRD_PARTY_ZLIB_GOOGLE_ZIP_READER_H_ | 4 #ifndef THIRD_PARTY_ZLIB_GOOGLE_ZIP_READER_H_ |
| 5 #define THIRD_PARTY_ZLIB_GOOGLE_ZIP_READER_H_ | 5 #define THIRD_PARTY_ZLIB_GOOGLE_ZIP_READER_H_ |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/file.h" |
| 12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 15 #include "base/platform_file.h" | |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 | 17 |
| 18 #if defined(USE_SYSTEM_MINIZIP) | 18 #if defined(USE_SYSTEM_MINIZIP) |
| 19 #include <minizip/unzip.h> | 19 #include <minizip/unzip.h> |
| 20 #else | 20 #else |
| 21 #include "third_party/zlib/contrib/minizip/unzip.h" | 21 #include "third_party/zlib/contrib/minizip/unzip.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 namespace zip { | 24 namespace zip { |
| 25 | 25 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 private: | 193 private: |
| 194 // Common code used both in Open and OpenFromFd. | 194 // Common code used both in Open and OpenFromFd. |
| 195 bool OpenInternal(); | 195 bool OpenInternal(); |
| 196 | 196 |
| 197 // Resets the internal state. | 197 // Resets the internal state. |
| 198 void Reset(); | 198 void Reset(); |
| 199 | 199 |
| 200 // Extracts a chunk of the file to the target. Will post a task for the next | 200 // Extracts a chunk of the file to the target. Will post a task for the next |
| 201 // chunk and success/failure/progress callbacks as necessary. | 201 // chunk and success/failure/progress callbacks as necessary. |
| 202 void ExtractChunk(base::PlatformFile target_file, | 202 void ExtractChunk(base::File target_file, |
| 203 const SuccessCallback& success_callback, | 203 const SuccessCallback& success_callback, |
| 204 const FailureCallback& failure_callback, | 204 const FailureCallback& failure_callback, |
| 205 const ProgressCallback& progress_callback, | 205 const ProgressCallback& progress_callback, |
| 206 const int64 offset); | 206 const int64 offset); |
| 207 | 207 |
| 208 unzFile zip_file_; | 208 unzFile zip_file_; |
| 209 int num_entries_; | 209 int num_entries_; |
| 210 bool reached_end_; | 210 bool reached_end_; |
| 211 scoped_ptr<EntryInfo> current_entry_info_; | 211 scoped_ptr<EntryInfo> current_entry_info_; |
| 212 | 212 |
| 213 base::WeakPtrFactory<ZipReader> weak_ptr_factory_; | 213 base::WeakPtrFactory<ZipReader> weak_ptr_factory_; |
| 214 | 214 |
| 215 DISALLOW_COPY_AND_ASSIGN(ZipReader); | 215 DISALLOW_COPY_AND_ASSIGN(ZipReader); |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 } // namespace zip | 218 } // namespace zip |
| 219 | 219 |
| 220 #endif // THIRD_PARTY_ZLIB_GOOGLE_ZIP_READER_H_ | 220 #endif // THIRD_PARTY_ZLIB_GOOGLE_ZIP_READER_H_ |
| OLD | NEW |