| 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 #ifndef SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ | 5 #ifndef SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ |
| 6 #define SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ | 6 #define SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ |
| 7 | 7 |
| 8 #include <dispatch/dispatch.h> | 8 #include <dispatch/dispatch.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_mach_port.h" | 10 #include "base/mac/scoped_mach_port.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 public: | 26 public: |
| 27 explicit LaunchdInterceptionServer(const BootstrapSandbox* sandbox); | 27 explicit LaunchdInterceptionServer(const BootstrapSandbox* sandbox); |
| 28 virtual ~LaunchdInterceptionServer(); | 28 virtual ~LaunchdInterceptionServer(); |
| 29 | 29 |
| 30 // Initializes the class and starts running the message server. If the | 30 // Initializes the class and starts running the message server. If the |
| 31 // |server_receive_right| is non-NULL, this class will take ownership of | 31 // |server_receive_right| is non-NULL, this class will take ownership of |
| 32 // the receive right and intercept messages sent to that port. | 32 // the receive right and intercept messages sent to that port. |
| 33 bool Initialize(mach_port_t server_receive_right); | 33 bool Initialize(mach_port_t server_receive_right); |
| 34 | 34 |
| 35 // MessageDemuxer: | 35 // MessageDemuxer: |
| 36 virtual void DemuxMessage(IPCMessage request) OVERRIDE; | 36 virtual void DemuxMessage(IPCMessage request) override; |
| 37 | 37 |
| 38 mach_port_t server_port() const { return message_server_->GetServerPort(); } | 38 mach_port_t server_port() const { return message_server_->GetServerPort(); } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // Given a look_up2 request message, this looks up the appropriate sandbox | 41 // Given a look_up2 request message, this looks up the appropriate sandbox |
| 42 // policy for the service name then formulates and sends the reply message. | 42 // policy for the service name then formulates and sends the reply message. |
| 43 void HandleLookUp(IPCMessage request, const BootstrapSandboxPolicy* policy); | 43 void HandleLookUp(IPCMessage request, const BootstrapSandboxPolicy* policy); |
| 44 | 44 |
| 45 // Given a swap_integer request message, this verifies that it is safe, and | 45 // Given a swap_integer request message, this verifies that it is safe, and |
| 46 // if so, forwards it on to launchd for servicing. If the request is unsafe, | 46 // if so, forwards it on to launchd for servicing. If the request is unsafe, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 64 base::mac::ScopedMachSendRight sandbox_send_port_; | 64 base::mac::ScopedMachSendRight sandbox_send_port_; |
| 65 | 65 |
| 66 // The compatibility shim that handles differences in message header IDs and | 66 // The compatibility shim that handles differences in message header IDs and |
| 67 // request/reply structures between different OS X versions. | 67 // request/reply structures between different OS X versions. |
| 68 const LaunchdCompatibilityShim compat_shim_; | 68 const LaunchdCompatibilityShim compat_shim_; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace sandbox | 71 } // namespace sandbox |
| 72 | 72 |
| 73 #endif // SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ | 73 #endif // SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ |
| OLD | NEW |