| 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_DMG_ITERATOR_H_ | 5 #ifndef CHROME_UTILITY_SAFE_BROWSING_MAC_DMG_ITERATOR_H_ |
| 6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_DMG_ITERATOR_H_ | 6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_DMG_ITERATOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // of the stream. | 30 // of the stream. |
| 31 explicit DMGIterator(ReadStream* stream); | 31 explicit DMGIterator(ReadStream* stream); |
| 32 ~DMGIterator(); | 32 ~DMGIterator(); |
| 33 | 33 |
| 34 // Opens the DMG file for iteration. This must be called before any other | 34 // Opens the DMG file for iteration. This must be called before any other |
| 35 // method. If this returns false, it is illegal to call any other methods | 35 // method. If this returns false, it is illegal to call any other methods |
| 36 // on this class. If this returns true, the iterator is advanced to an | 36 // on this class. If this returns true, the iterator is advanced to an |
| 37 // invalid element before the first item. | 37 // invalid element before the first item. |
| 38 bool Open(); | 38 bool Open(); |
| 39 | 39 |
| 40 // Returns the raw code signature file metadata. This will be empty for DMGs |
| 41 // that are not signed. |
| 42 const std::vector<uint8_t>& GetCodeSignature(); |
| 43 |
| 40 // Advances the iterator to the next file item. Returns true on success | 44 // Advances the iterator to the next file item. Returns true on success |
| 41 // and false on end-of-iterator. | 45 // and false on end-of-iterator. |
| 42 bool Next(); | 46 bool Next(); |
| 43 | 47 |
| 44 // Returns the full path in a DMG filesystem to the current file item. | 48 // Returns the full path in a DMG filesystem to the current file item. |
| 45 base::string16 GetPath(); | 49 base::string16 GetPath(); |
| 46 | 50 |
| 47 // Returns a ReadStream for the current file item. | 51 // Returns a ReadStream for the current file item. |
| 48 std::unique_ptr<ReadStream> GetReadStream(); | 52 std::unique_ptr<ReadStream> GetReadStream(); |
| 49 | 53 |
| 50 private: | 54 private: |
| 51 UDIFParser udif_; // The UDIF parser that accesses the partitions. | 55 UDIFParser udif_; // The UDIF parser that accesses the partitions. |
| 52 // Streams for all the HFS partitions. | 56 // Streams for all the HFS partitions. |
| 53 std::vector<std::unique_ptr<ReadStream>> partitions_; | 57 std::vector<std::unique_ptr<ReadStream>> partitions_; |
| 54 size_t current_partition_; // The index in |partitions_| of the current one. | 58 size_t current_partition_; // The index in |partitions_| of the current one. |
| 55 std::unique_ptr<HFSIterator> | 59 std::unique_ptr<HFSIterator> |
| 56 hfs_; // The HFSIterator for |current_partition_|. | 60 hfs_; // The HFSIterator for |current_partition_|. |
| 57 | 61 |
| 58 DISALLOW_COPY_AND_ASSIGN(DMGIterator); | 62 DISALLOW_COPY_AND_ASSIGN(DMGIterator); |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 } // namespace dmg | 65 } // namespace dmg |
| 62 } // namespace safe_browsing | 66 } // namespace safe_browsing |
| 63 | 67 |
| 64 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_DMG_ITERATOR_H_ | 68 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_DMG_ITERATOR_H_ |
| OLD | NEW |