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 #include "mojo/edk/embedder/embedder.h" | 5 #include "mojo/edk/embedder/embedder.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 ChildProcessLaunched(child_process, channel.PassServerHandle()); | 42 ChildProcessLaunched(child_process, channel.PassServerHandle()); |
43 return channel.PassClientHandle(); | 43 return channel.PassClientHandle(); |
44 } | 44 } |
45 | 45 |
46 void ChildProcessLaunched(base::ProcessHandle child_process, | 46 void ChildProcessLaunched(base::ProcessHandle child_process, |
47 ScopedPlatformHandle server_pipe) { | 47 ScopedPlatformHandle server_pipe) { |
48 CHECK(internal::g_core); | 48 CHECK(internal::g_core); |
49 internal::g_core->AddChild(child_process, std::move(server_pipe)); | 49 internal::g_core->AddChild(child_process, std::move(server_pipe)); |
50 } | 50 } |
51 | 51 |
| 52 void ChildProcessLaunched(base::ProcessHandle child_process, |
| 53 ScopedPlatformHandle server_pipe, |
| 54 const std::string& secret) { |
| 55 CHECK(internal::g_core); |
| 56 internal::g_core->AddChild(child_process, std::move(server_pipe), secret); |
| 57 } |
| 58 |
52 void SetParentPipeHandle(ScopedPlatformHandle pipe) { | 59 void SetParentPipeHandle(ScopedPlatformHandle pipe) { |
53 CHECK(internal::g_core); | 60 CHECK(internal::g_core); |
54 internal::g_core->InitChild(std::move(pipe)); | 61 internal::g_core->InitChild(std::move(pipe)); |
55 } | 62 } |
56 | 63 |
| 64 void SetParentPipeHandle(ScopedPlatformHandle pipe, const std::string& secret) { |
| 65 CHECK(internal::g_core); |
| 66 internal::g_core->InitChild(std::move(pipe), secret); |
| 67 } |
| 68 |
57 void Init() { | 69 void Init() { |
58 internal::g_core = new Core(); | 70 internal::g_core = new Core(); |
59 } | 71 } |
60 | 72 |
61 MojoResult AsyncWait(MojoHandle handle, | 73 MojoResult AsyncWait(MojoHandle handle, |
62 MojoHandleSignals signals, | 74 MojoHandleSignals signals, |
63 const base::Callback<void(MojoResult)>& callback) { | 75 const base::Callback<void(MojoResult)>& callback) { |
64 CHECK(internal::g_core); | 76 CHECK(internal::g_core); |
65 return internal::g_core->AsyncWait(handle, signals, callback); | 77 return internal::g_core->AsyncWait(handle, signals, callback); |
66 } | 78 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 134 } |
123 | 135 |
124 std::string GenerateRandomToken() { | 136 std::string GenerateRandomToken() { |
125 char random_bytes[16]; | 137 char random_bytes[16]; |
126 crypto::RandBytes(random_bytes, 16); | 138 crypto::RandBytes(random_bytes, 16); |
127 return base::HexEncode(random_bytes, 16); | 139 return base::HexEncode(random_bytes, 16); |
128 } | 140 } |
129 | 141 |
130 } // namespace edk | 142 } // namespace edk |
131 } // namespace mojo | 143 } // namespace mojo |
OLD | NEW |