[MD settings] moving attached() code
[chromium-blink-merge.git] / sandbox / mac / pre_exec_delegate.h
blob61a16552ee0cd857d772cfb21e0e887ba8d6931c
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
3 // found in the LICENSE file.
5 #ifndef SANDBOX_MAC_PRE_EXEC_DELEGATE_H_
6 #define SANDBOX_MAC_PRE_EXEC_DELEGATE_H_
8 #include "base/process/launch.h"
10 namespace sandbox {
12 // This PreExecDelegate will communicate with the BootstrapSandbox running
13 // the Mach server registered under |sandbox_server_bootstrap_name|. It will
14 // check in with th BootstrapSandbox using the |sandbox_token| and will
15 // replace the task's bootstrap port with one provided by the sandbox.
16 class PreExecDelegate : public base::LaunchOptions::PreExecDelegate {
17 public:
18 PreExecDelegate(const std::string& sandbox_server_bootstrap_name,
19 uint64_t sandbox_token);
20 ~PreExecDelegate() override;
22 void RunAsyncSafe() override;
24 uint64_t sandbox_token() const { return sandbox_token_; }
26 private:
27 const std::string sandbox_server_bootstrap_name_;
28 const char* const sandbox_server_bootstrap_name_ptr_;
29 const uint64_t sandbox_token_;
30 const bool is_yosemite_or_later_;
32 DISALLOW_COPY_AND_ASSIGN(PreExecDelegate);
35 } // namespace sandbox
37 #endif // SANDBOX_MAC_PRE_EXEC_DELEGATE_H_