| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ | 5 #ifndef CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ |
| 6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ | 6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ |
| 7 | 7 |
| 8 #include <CoreFoundation/CoreFoundation.h> | 8 #include <CoreFoundation/CoreFoundation.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 #include <sys/types.h> |
| 11 | 12 |
| 13 #include <memory> |
| 12 #include <string> | 14 #include <string> |
| 13 #include <vector> | 15 #include <vector> |
| 14 | 16 |
| 15 #include <sys/types.h> | |
| 16 | |
| 17 #include "base/mac/scoped_cftyperef.h" | 17 #include "base/mac/scoped_cftyperef.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/scoped_ptr.h" | |
| 20 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
| 21 | 20 |
| 22 namespace safe_browsing { | 21 namespace safe_browsing { |
| 23 namespace dmg { | 22 namespace dmg { |
| 24 | 23 |
| 25 class ReadStream; | 24 class ReadStream; |
| 26 class UDIFBlock; | 25 class UDIFBlock; |
| 27 struct UDIFBlockChunk; | 26 struct UDIFBlockChunk; |
| 28 | 27 |
| 29 // UDIFParser parses a Universal Disk Image Format file, allowing access to the | 28 // UDIFParser parses a Universal Disk Image Format file, allowing access to the |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 63 |
| 65 // Returns the partition type as a string for the given partition number. | 64 // Returns the partition type as a string for the given partition number. |
| 66 // E.g., "Apple_HFS" and "Apple_Free". | 65 // E.g., "Apple_HFS" and "Apple_Free". |
| 67 std::string GetPartitionType(size_t part_number); | 66 std::string GetPartitionType(size_t part_number); |
| 68 | 67 |
| 69 // Returns the size of the partition in bytes. | 68 // Returns the size of the partition in bytes. |
| 70 size_t GetPartitionSize(size_t part_number); | 69 size_t GetPartitionSize(size_t part_number); |
| 71 | 70 |
| 72 // Returns a stream of the raw partition data for the given partition | 71 // Returns a stream of the raw partition data for the given partition |
| 73 // number. | 72 // number. |
| 74 scoped_ptr<ReadStream> GetPartitionReadStream(size_t part_number); | 73 std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number); |
| 75 | 74 |
| 76 private: | 75 private: |
| 77 // Parses the blkx plist trailer structure. | 76 // Parses the blkx plist trailer structure. |
| 78 bool ParseBlkx(); | 77 bool ParseBlkx(); |
| 79 | 78 |
| 80 // Reads the data pointed to by the block |chunk|, decompressing it as | 79 // Reads the data pointed to by the block |chunk|, decompressing it as |
| 81 // necessary, into the out-buffer |decompressed_data|. | 80 // necessary, into the out-buffer |decompressed_data|. |
| 82 bool ReadBlockChunk(const UDIFBlockChunk* chunk, | 81 bool ReadBlockChunk(const UDIFBlockChunk* chunk, |
| 83 std::vector<uint8_t>* decompressed_data); | 82 std::vector<uint8_t>* decompressed_data); |
| 84 | 83 |
| 85 ReadStream* const stream_; // The stream backing the UDIF image. Weak. | 84 ReadStream* const stream_; // The stream backing the UDIF image. Weak. |
| 86 std::vector<std::string> partition_names_; // The names of all partitions. | 85 std::vector<std::string> partition_names_; // The names of all partitions. |
| 87 ScopedVector<const UDIFBlock> blocks_; // All blocks in the UDIF image. | 86 ScopedVector<const UDIFBlock> blocks_; // All blocks in the UDIF image. |
| 88 uint16_t block_size_; // The image's block size, in bytes. | 87 uint16_t block_size_; // The image's block size, in bytes. |
| 89 | 88 |
| 90 DISALLOW_COPY_AND_ASSIGN(UDIFParser); | 89 DISALLOW_COPY_AND_ASSIGN(UDIFParser); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 } // namespace dmg | 92 } // namespace dmg |
| 94 } // namespace safe_browsing | 93 } // namespace safe_browsing |
| 95 | 94 |
| 96 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ | 95 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ |
| OLD | NEW |