OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file is used to handle differences in Mach message IDs and structures | 5 // This file is used to handle differences in Mach message IDs and structures |
6 // that occur between different OS versions. The Mach messages that the sandbox | 6 // that occur between different OS versions. The Mach messages that the sandbox |
7 // is interested in are decoded using information derived from the open-source | 7 // is interested in are decoded using information derived from the open-source |
8 // libraries, i.e. <http://www.opensource.apple.com/source/launchd/>. While | 8 // libraries, i.e. <http://www.opensource.apple.com/source/launchd/>. While |
9 // these messages definitions are open source, they are not considered part of | 9 // these messages definitions are open source, they are not considered part of |
10 // the stable OS API, and so differences do exist between OS versions. | 10 // the stable OS API, and so differences do exist between OS versions. |
11 | 11 |
12 #ifndef SANDBOX_MAC_OS_COMPATIBILITY_H_ | 12 #ifndef SANDBOX_MAC_OS_COMPATIBILITY_H_ |
13 #define SANDBOX_MAC_OS_COMPATIBILITY_H_ | 13 #define SANDBOX_MAC_OS_COMPATIBILITY_H_ |
14 | 14 |
15 #include <mach/mach.h> | 15 #include <mach/mach.h> |
16 #include <stdint.h> | 16 #include <stdint.h> |
17 | 17 |
| 18 #include <memory> |
18 #include <string> | 19 #include <string> |
19 | 20 |
20 #include "base/memory/scoped_ptr.h" | |
21 #include "sandbox/mac/message_server.h" | 21 #include "sandbox/mac/message_server.h" |
22 | 22 |
23 namespace sandbox { | 23 namespace sandbox { |
24 | 24 |
25 class OSCompatibility { | 25 class OSCompatibility { |
26 public: | 26 public: |
27 // Creates an OSCompatibility instance for the current OS X version. | 27 // Creates an OSCompatibility instance for the current OS X version. |
28 static scoped_ptr<OSCompatibility> CreateForPlatform(); | 28 static std::unique_ptr<OSCompatibility> CreateForPlatform(); |
29 | 29 |
30 virtual ~OSCompatibility(); | 30 virtual ~OSCompatibility(); |
31 | 31 |
32 // Gets the message and subsystem ID of an IPC message. | 32 // Gets the message and subsystem ID of an IPC message. |
33 virtual uint64_t GetMessageSubsystem(const IPCMessage message) = 0; | 33 virtual uint64_t GetMessageSubsystem(const IPCMessage message) = 0; |
34 virtual uint64_t GetMessageID(const IPCMessage message) = 0; | 34 virtual uint64_t GetMessageID(const IPCMessage message) = 0; |
35 | 35 |
36 // Returns true if the message is a Launchd look up request. | 36 // Returns true if the message is a Launchd look up request. |
37 virtual bool IsServiceLookUpRequest(const IPCMessage message) = 0; | 37 virtual bool IsServiceLookUpRequest(const IPCMessage message) = 0; |
38 | 38 |
(...skipping 14 matching lines...) Expand all Loading... |
53 | 53 |
54 // A function to take a swap_integer message and return true if the message | 54 // A function to take a swap_integer message and return true if the message |
55 // is only getting the value of a key, neither setting it directly, nor | 55 // is only getting the value of a key, neither setting it directly, nor |
56 // swapping two keys. | 56 // swapping two keys. |
57 virtual bool IsSwapIntegerReadOnly(const IPCMessage message) = 0; | 57 virtual bool IsSwapIntegerReadOnly(const IPCMessage message) = 0; |
58 }; | 58 }; |
59 | 59 |
60 } // namespace sandbox | 60 } // namespace sandbox |
61 | 61 |
62 #endif // SANDBOX_MAC_OS_COMPATIBILITY_H_ | 62 #endif // SANDBOX_MAC_OS_COMPATIBILITY_H_ |
OLD | NEW |