Fix crash on app list start page keyboard navigation with <4 apps.
[chromium-blink-merge.git] / sandbox / mac / os_compatibility.h
blob1205cd686895ddf4e42e2108a693b77d04f18ddc
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 "sandbox/mac/message_server.h"
21 namespace sandbox {
23 typedef uint64_t (*IPCMessageGetID)(const IPCMessage);
25 typedef std::string (*LookUp2GetRequestName)(const IPCMessage);
26 typedef void (*LookUp2FillReply)(IPCMessage, mach_port_t service_port);
28 typedef bool (*SwapIntegerIsGetOnly)(const IPCMessage);
30 struct LaunchdCompatibilityShim {
31 // Gets the message ID of an IPC message.
32 IPCMessageGetID ipc_message_get_id;
34 // The msgh_id for look_up2.
35 uint64_t msg_id_look_up2;
37 // The msgh_id for swap_integer.
38 uint64_t msg_id_swap_integer;
40 // A function to take a look_up2 message and return the string service name
41 // that was requested via the message.
42 LookUp2GetRequestName look_up2_get_request_name;
44 // A function to formulate a reply to a look_up2 message, given the reply
45 // message and the port to return as the service.
46 LookUp2FillReply look_up2_fill_reply;
48 // A function to take a swap_integer message and return true if the message
49 // is only getting the value of a key, neither setting it directly, nor
50 // swapping two keys.
51 SwapIntegerIsGetOnly swap_integer_is_get_only;
54 // Gets the compatibility shim for the launchd job subsystem.
55 const LaunchdCompatibilityShim GetLaunchdCompatibilityShim();
57 } // namespace sandbox
59 #endif // SANDBOX_MAC_OS_COMPATIBILITY_H_