| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_INSTALLER_UTIL_LZMA_UTIL_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_LZMA_UTIL_H_ |
| 6 #define CHROME_INSTALLER_UTIL_LZMA_UTIL_H_ | 6 #define CHROME_INSTALLER_UTIL_LZMA_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 | 12 |
| 13 // This is a utility class that acts as a wrapper around LZMA SDK library | 13 // This is a utility class that acts as a wrapper around LZMA SDK library |
| 14 class LzmaUtil { | 14 class LzmaUtil { |
| 15 public: | 15 public: |
| 16 // Utility method that does the job of calling OpenArchive(), UnPack() | 16 // Utility method that does the job of calling OpenArchive(), UnPack() |
| 17 // and CloseArchive() in order. Returns error code (NO_ERROR if successful). | 17 // and CloseArchive() in order. Returns error code (NO_ERROR if successful). |
| 18 static int32 UnPackArchive(const std::wstring& archive, | 18 static int32 UnPackArchive(const std::wstring& archive, |
| 19 const std::wstring& output_dir, | 19 const std::wstring& output_dir, |
| 20 std::wstring* output_file); | 20 std::wstring* output_file); |
| 21 | 21 |
| 22 LzmaUtil(); | 22 LzmaUtil(); |
| 23 ~LzmaUtil(); | 23 ~LzmaUtil(); |
| 24 | 24 |
| 25 DWORD OpenArchive(const std::wstring& archivePath); | 25 DWORD OpenArchive(const std::wstring& archivePath); |
| 26 | 26 |
| 27 // Unpacks the archive to the given location | 27 // Unpacks the archive to the given location |
| 28 DWORD UnPack(const std::wstring& location); | 28 DWORD UnPack(const std::wstring& location); |
| 29 | 29 |
| 30 // Unpacks the archive to the given location and returns the last file | 30 // Unpacks the archive to the given location and returns the last file |
| 31 // extracted from archive. |single_file| is set to true iff only a single | 31 // extracted from archive. |single_file| is set to true iff only a single |
| 32 // file is extracted from archive. | 32 // file is extracted from archive. |
| 33 DWORD UnPack(const std::wstring& location, | 33 DWORD UnPack(const std::wstring& location, |
| 34 std::wstring* output_file); | 34 std::wstring* output_file); |
| 35 | 35 |
| 36 void CloseArchive(); | 36 void CloseArchive(); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 HANDLE archive_handle_; | 39 HANDLE archive_handle_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(LzmaUtil); | 41 DISALLOW_COPY_AND_ASSIGN(LzmaUtil); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 #endif // CHROME_INSTALLER_UTIL_LZMA_UTIL_H_ | 44 #endif // CHROME_INSTALLER_UTIL_LZMA_UTIL_H_ |
| OLD | NEW |