OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/zip_reader.h" | 5 #include "chrome/common/zip_reader.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/common/zip_internal.h" | 11 #include "chrome/common/zip_internal.h" |
12 #include "net/base/file_stream.h" | 12 #include "net/base/file_stream.h" |
| 13 |
| 14 #if defined(USE_SYSTEM_MINIZIP) |
| 15 #include <minizip/unzip.h> |
| 16 #else |
13 #include "third_party/zlib/contrib/minizip/unzip.h" | 17 #include "third_party/zlib/contrib/minizip/unzip.h" |
14 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
15 #include "third_party/zlib/contrib/minizip/iowin32.h" | 19 #include "third_party/zlib/contrib/minizip/iowin32.h" |
16 #endif | 20 #endif // defined(OS_WIN) |
| 21 #endif // defined(USE_SYSTEM_MINIZIP) |
17 | 22 |
18 namespace zip { | 23 namespace zip { |
19 | 24 |
20 // TODO(satorux): The implementation assumes that file names in zip files | 25 // TODO(satorux): The implementation assumes that file names in zip files |
21 // are encoded in UTF-8. This is true for zip files created by Zip() | 26 // are encoded in UTF-8. This is true for zip files created by Zip() |
22 // function in zip.h, but not true for user-supplied random zip files. | 27 // function in zip.h, but not true for user-supplied random zip files. |
23 ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip, | 28 ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip, |
24 const unz_file_info& raw_file_info) | 29 const unz_file_info& raw_file_info) |
25 : file_path_(FilePath::FromUTF8Unsafe(file_name_in_zip)), | 30 : file_path_(FilePath::FromUTF8Unsafe(file_name_in_zip)), |
26 is_directory_(false) { | 31 is_directory_(false) { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 300 } |
296 | 301 |
297 void ZipReader::Reset() { | 302 void ZipReader::Reset() { |
298 zip_file_ = NULL; | 303 zip_file_ = NULL; |
299 num_entries_ = 0; | 304 num_entries_ = 0; |
300 reached_end_ = false; | 305 reached_end_ = false; |
301 current_entry_info_.reset(); | 306 current_entry_info_.reset(); |
302 } | 307 } |
303 | 308 |
304 } // namespace zip | 309 } // namespace zip |
OLD | NEW |