| 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_COMMON_SAFE_BROWSING_MACH_O_IMAGE_READER_MAC_H_ | 5 #ifndef CHROME_COMMON_SAFE_BROWSING_MACH_O_IMAGE_READER_MAC_H_ |
| 6 #define CHROME_COMMON_SAFE_BROWSING_MACH_O_IMAGE_READER_MAC_H_ | 6 #define CHROME_COMMON_SAFE_BROWSING_MACH_O_IMAGE_READER_MAC_H_ |
| 7 | 7 |
| 8 #include <mach-o/loader.h> | 8 #include <mach-o/loader.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 | 11 |
| 12 #include <memory> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/scoped_ptr.h" | |
| 17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
| 18 | 18 |
| 19 namespace safe_browsing { | 19 namespace safe_browsing { |
| 20 | 20 |
| 21 class ByteSlice; | 21 class ByteSlice; |
| 22 | 22 |
| 23 // MachOImageReader is used to extract information about a Mach-O binary image. | 23 // MachOImageReader is used to extract information about a Mach-O binary image. |
| 24 // This class supports fat and thin images. Initialize() must be called before | 24 // This class supports fat and thin images. Initialize() must be called before |
| 25 // any other methods; if it returns false, it is illegal to call any other | 25 // any other methods; if it returns false, it is illegal to call any other |
| 26 // methods on this class. | 26 // methods on this class. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 uint32_t GetFileType(); | 85 uint32_t GetFileType(); |
| 86 | 86 |
| 87 // Returns an array of all the load commands in the image. | 87 // Returns an array of all the load commands in the image. |
| 88 const std::vector<MachOImageReader::LoadCommand>& GetLoadCommands(); | 88 const std::vector<MachOImageReader::LoadCommand>& GetLoadCommands(); |
| 89 | 89 |
| 90 // If the image has a LC_CODE_SIGNATURE command, this retreives the code | 90 // If the image has a LC_CODE_SIGNATURE command, this retreives the code |
| 91 // signature blob in the __LINKEDIT segment. | 91 // signature blob in the __LINKEDIT segment. |
| 92 bool GetCodeSignatureInfo(std::vector<uint8_t>* info); | 92 bool GetCodeSignatureInfo(std::vector<uint8_t>* info); |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 scoped_ptr<ByteSlice> data_; | 95 std::unique_ptr<ByteSlice> data_; |
| 96 | 96 |
| 97 bool is_fat_; | 97 bool is_fat_; |
| 98 ScopedVector<MachOImageReader> fat_images_; | 98 ScopedVector<MachOImageReader> fat_images_; |
| 99 | 99 |
| 100 bool is_64_bit_; | 100 bool is_64_bit_; |
| 101 std::vector<LoadCommand> commands_; | 101 std::vector<LoadCommand> commands_; |
| 102 | 102 |
| 103 DISALLOW_COPY_AND_ASSIGN(MachOImageReader); | 103 DISALLOW_COPY_AND_ASSIGN(MachOImageReader); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace safe_browsing | 106 } // namespace safe_browsing |
| 107 | 107 |
| 108 #endif // CHROME_COMMON_SAFE_BROWSING_MACH_O_IMAGE_READER_MAC_H_ | 108 #endif // CHROME_COMMON_SAFE_BROWSING_MACH_O_IMAGE_READER_MAC_H_ |
| OLD | NEW |