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 #include <sys/types.h> |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 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_vector.h" | |
20 | 19 |
21 namespace safe_browsing { | 20 namespace safe_browsing { |
22 namespace dmg { | 21 namespace dmg { |
23 | 22 |
24 class ReadStream; | 23 class ReadStream; |
25 class UDIFBlock; | 24 class UDIFBlock; |
26 | 25 |
27 // UDIFParser parses a Universal Disk Image Format file, allowing access to the | 26 // UDIFParser parses a Universal Disk Image Format file, allowing access to the |
28 // name, types, and data of the partitions held within the file. There is no | 27 // name, types, and data of the partitions held within the file. There is no |
29 // canonical documentation for UDIF, and not all disk images use UDIF (though | 28 // canonical documentation for UDIF, and not all disk images use UDIF (though |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Returns a stream of the raw partition data for the given partition | 69 // Returns a stream of the raw partition data for the given partition |
71 // number. | 70 // number. |
72 std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number); | 71 std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number); |
73 | 72 |
74 private: | 73 private: |
75 // Parses the blkx plist trailer structure. | 74 // Parses the blkx plist trailer structure. |
76 bool ParseBlkx(); | 75 bool ParseBlkx(); |
77 | 76 |
78 ReadStream* const stream_; // The stream backing the UDIF image. Weak. | 77 ReadStream* const stream_; // The stream backing the UDIF image. Weak. |
79 std::vector<std::string> partition_names_; // The names of all partitions. | 78 std::vector<std::string> partition_names_; // The names of all partitions. |
80 ScopedVector<const UDIFBlock> blocks_; // All blocks in the UDIF image. | 79 // All blocks in the UDIF image. |
| 80 std::vector<std::unique_ptr<const UDIFBlock>> blocks_; |
81 uint16_t block_size_; // The image's block size, in bytes. | 81 uint16_t block_size_; // The image's block size, in bytes. |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(UDIFParser); | 83 DISALLOW_COPY_AND_ASSIGN(UDIFParser); |
84 }; | 84 }; |
85 | 85 |
86 } // namespace dmg | 86 } // namespace dmg |
87 } // namespace safe_browsing | 87 } // namespace safe_browsing |
88 | 88 |
89 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ | 89 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ |
OLD | NEW |