OLD | NEW |
| (Empty) |
1 // Copyright 2016 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. | |
4 | |
5 #include "remoting/host/security_key/security_key_ipc_constants.h" | |
6 | |
7 #include "base/environment.h" | |
8 #include "base/lazy_instance.h" | |
9 | |
10 namespace { | |
11 base::LazyInstance<std::string> g_security_key_ipc_channel_name = | |
12 LAZY_INSTANCE_INITIALIZER; | |
13 | |
14 const char kSecurityKeyIpcChannelName[] = "security_key_ipc_channel"; | |
15 | |
16 } // namespace | |
17 | |
18 namespace remoting { | |
19 | |
20 extern const char kSecurityKeyConnectionError[] = "ssh_connection_error"; | |
21 | |
22 const std::string& GetSecurityKeyIpcChannelName() { | |
23 if (g_security_key_ipc_channel_name.Get().empty()) { | |
24 g_security_key_ipc_channel_name.Get() = kSecurityKeyIpcChannelName; | |
25 } | |
26 | |
27 return g_security_key_ipc_channel_name.Get(); | |
28 } | |
29 | |
30 void SetSecurityKeyIpcChannelNameForTest(const std::string& channel_name) { | |
31 g_security_key_ipc_channel_name.Get() = channel_name; | |
32 } | |
33 | |
34 std::string GetChannelNamePathPrefixForTest() { | |
35 std::string path_prefix; | |
36 #if defined(OS_LINUX) | |
37 path_prefix = "/dev/socket/"; | |
38 std::unique_ptr<base::Environment> env(base::Environment::Create()); | |
39 if (env->GetVar(base::env_vars::kHome, &path_prefix)) | |
40 path_prefix += "/"; | |
41 #endif | |
42 return path_prefix; | |
43 } | |
44 | |
45 } // namespace remoting | |
OLD | NEW |