Add a Notification Settings Button to all web notifications behind the web platform...
[chromium-blink-merge.git] / sandbox / mac / os_compatibility.h
bloba1f51f27dc6771996b3dcf9155e36d5a47abdcd3
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
3 // found in the LICENSE file.
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
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
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.
12 #ifndef SANDBOX_MAC_OS_COMPATIBILITY_H_
13 #define SANDBOX_MAC_OS_COMPATIBILITY_H_
15 #include <mach/mach.h>
17 #include <string>
19 #include "base/memory/scoped_ptr.h"
20 #include "sandbox/mac/message_server.h"
22 namespace sandbox {
24 class OSCompatibility {
25 public:
26 // Creates an OSCompatibility instance for the current OS X version.
27 static scoped_ptr<OSCompatibility> CreateForPlatform();
29 virtual ~OSCompatibility();
31 // Gets the message and subsystem ID of an IPC message.
32 virtual uint64_t GetMessageSubsystem(const IPCMessage message) = 0;
33 virtual uint64_t GetMessageID(const IPCMessage message) = 0;
35 // Returns true if the message is a Launchd look up request.
36 virtual bool IsServiceLookUpRequest(const IPCMessage message) = 0;
38 // Returns true if the message is a Launchd vproc swap_integer request.
39 virtual bool IsVprocSwapInteger(const IPCMessage message) = 0;
41 // Returns true if the message is an XPC domain management message.
42 virtual bool IsXPCDomainManagement(const IPCMessage message) = 0;
44 // A function to take a look_up2 message and return the string service name
45 // that was requested via the message.
46 virtual std::string GetServiceLookupName(const IPCMessage message) = 0;
48 // A function to formulate a reply to a look_up2 message, given the reply
49 // message and the port to return as the service.
50 virtual void WriteServiceLookUpReply(IPCMessage reply,
51 mach_port_t service_port) = 0;
53 // A function to take a swap_integer message and return true if the message
54 // is only getting the value of a key, neither setting it directly, nor
55 // swapping two keys.
56 virtual bool IsSwapIntegerReadOnly(const IPCMessage message) = 0;
59 } // namespace sandbox
61 #endif // SANDBOX_MAC_OS_COMPATIBILITY_H_