| 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_HFS_H_ | 5 #ifndef CHROME_UTILITY_SAFE_BROWSING_MAC_HFS_H_ |
| 6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_HFS_H_ | 6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_HFS_H_ |
| 7 | 7 |
| 8 #include <hfs/hfs_format.h> | 8 #include <hfs/hfs_format.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> |
| 12 |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 14 | 15 |
| 15 namespace safe_browsing { | 16 namespace safe_browsing { |
| 16 namespace dmg { | 17 namespace dmg { |
| 17 | 18 |
| 18 class ReadStream; | 19 class ReadStream; |
| 19 class HFSBTreeIterator; | 20 class HFSBTreeIterator; |
| 20 class HFSForkReadStream; | 21 class HFSForkReadStream; |
| 21 | 22 |
| 22 // HFSIterator is a read-only iterator over an HFS+ file system. It provides | 23 // HFSIterator is a read-only iterator over an HFS+ file system. It provides |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 bool IsHardLink(); | 62 bool IsHardLink(); |
| 62 | 63 |
| 63 // Returns true if the current iterator item is decmpfs-compressed. | 64 // Returns true if the current iterator item is decmpfs-compressed. |
| 64 bool IsDecmpfsCompressed(); | 65 bool IsDecmpfsCompressed(); |
| 65 | 66 |
| 66 // Returns the full filesystem path of the current iterator item. | 67 // Returns the full filesystem path of the current iterator item. |
| 67 base::string16 GetPath(); | 68 base::string16 GetPath(); |
| 68 | 69 |
| 69 // Returns a stream for the data fork of the current iterator item. This may | 70 // Returns a stream for the data fork of the current iterator item. This may |
| 70 // only be called if IsDirectory() and IsHardLink() returns false. | 71 // only be called if IsDirectory() and IsHardLink() returns false. |
| 71 scoped_ptr<ReadStream> GetReadStream(); | 72 std::unique_ptr<ReadStream> GetReadStream(); |
| 72 | 73 |
| 73 private: | 74 private: |
| 74 friend class HFSForkReadStream; | 75 friend class HFSForkReadStream; |
| 75 | 76 |
| 76 // Moves the |stream_| position to a specific HFS+ |block|. | 77 // Moves the |stream_| position to a specific HFS+ |block|. |
| 77 bool SeekToBlock(uint64_t block); | 78 bool SeekToBlock(uint64_t block); |
| 78 | 79 |
| 79 // Reads the catalog file to initialize the iterator. | 80 // Reads the catalog file to initialize the iterator. |
| 80 bool ReadCatalogFile(); | 81 bool ReadCatalogFile(); |
| 81 | 82 |
| 82 uint32_t block_size() const { return volume_header_.blockSize; } | 83 uint32_t block_size() const { return volume_header_.blockSize; } |
| 83 ReadStream* stream() const { return stream_; } | 84 ReadStream* stream() const { return stream_; } |
| 84 | 85 |
| 85 ReadStream* const stream_; // The stream backing the filesystem. | 86 ReadStream* const stream_; // The stream backing the filesystem. |
| 86 HFSPlusVolumeHeader volume_header_; | 87 HFSPlusVolumeHeader volume_header_; |
| 87 scoped_ptr<HFSForkReadStream> catalog_file_; // Data of the catalog file. | 88 std::unique_ptr<HFSForkReadStream> |
| 88 scoped_ptr<HFSBTreeIterator> catalog_; // Iterator over the catalog file. | 89 catalog_file_; // Data of the catalog file. |
| 90 std::unique_ptr<HFSBTreeIterator> |
| 91 catalog_; // Iterator over the catalog file. |
| 89 | 92 |
| 90 DISALLOW_COPY_AND_ASSIGN(HFSIterator); | 93 DISALLOW_COPY_AND_ASSIGN(HFSIterator); |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 } // namespace dmg | 96 } // namespace dmg |
| 94 } // namespace safe_browsing | 97 } // namespace safe_browsing |
| 95 | 98 |
| 96 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_HFS_H_ | 99 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_HFS_H_ |
| OLD | NEW |