| 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/remote_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_remote_security_key_ipc_channel_name = | |
| 12 LAZY_INSTANCE_INITIALIZER; | |
| 13 | |
| 14 const char kRemoteSecurityKeyIpcChannelName[] = | |
| 15 "remote_security_key_ipc_channel"; | |
| 16 | |
| 17 } // namespace | |
| 18 | |
| 19 namespace remoting { | |
| 20 | |
| 21 extern const char kRemoteSecurityKeyConnectionError[] = | |
| 22 "remote_ssh_connection_error"; | |
| 23 | |
| 24 const std::string& GetRemoteSecurityKeyIpcChannelName() { | |
| 25 if (g_remote_security_key_ipc_channel_name.Get().empty()) { | |
| 26 g_remote_security_key_ipc_channel_name.Get() = | |
| 27 kRemoteSecurityKeyIpcChannelName; | |
| 28 } | |
| 29 | |
| 30 return g_remote_security_key_ipc_channel_name.Get(); | |
| 31 } | |
| 32 | |
| 33 void SetRemoteSecurityKeyIpcChannelNameForTest( | |
| 34 const std::string& channel_name) { | |
| 35 g_remote_security_key_ipc_channel_name.Get() = channel_name; | |
| 36 } | |
| 37 | |
| 38 std::string GetChannelNamePathPrefixForTest() { | |
| 39 std::string path_prefix; | |
| 40 #if defined(OS_LINUX) | |
| 41 path_prefix = "/dev/socket/"; | |
| 42 std::unique_ptr<base::Environment> env(base::Environment::Create()); | |
| 43 if (env->GetVar(base::env_vars::kHome, &path_prefix)) | |
| 44 path_prefix += "/"; | |
| 45 #endif | |
| 46 return path_prefix; | |
| 47 } | |
| 48 | |
| 49 } // namespace remoting | |
| OLD | NEW |