Chromium Code Reviews| Index: remoting/host/security_key/security_key_ipc_constants.cc |
| diff --git a/remoting/host/security_key/security_key_ipc_constants.cc b/remoting/host/security_key/security_key_ipc_constants.cc |
| index e9aeb8685750951c6d5d1ea5598e9240d23c27da..4c70453a28149f3a237ca26063f58d1f7bb59bbf 100644 |
| --- a/remoting/host/security_key/security_key_ipc_constants.cc |
| +++ b/remoting/host/security_key/security_key_ipc_constants.cc |
| @@ -4,8 +4,10 @@ |
| #include "remoting/host/security_key/security_key_ipc_constants.h" |
| -#include "base/environment.h" |
| +#include "base/files/file_path.h" |
| +#include "base/files/file_util.h" |
| #include "base/lazy_instance.h" |
| +#include "base/macros.h" |
|
Lei Zhang
2016/07/19 22:55:04
It's great that you are trying to IWYU, but what i
joedow
2016/07/19 23:04:12
Done.
|
| namespace { |
| base::LazyInstance<std::string> g_security_key_ipc_channel_name = |
| @@ -17,7 +19,7 @@ const char kSecurityKeyIpcChannelName[] = "security_key_ipc_channel"; |
| namespace remoting { |
| -extern const char kSecurityKeyConnectionError[] = "ssh_connection_error"; |
| +const char kSecurityKeyConnectionError[] = "ssh_connection_error"; |
| const std::string& GetSecurityKeyIpcChannelName() { |
| if (g_security_key_ipc_channel_name.Get().empty()) { |
| @@ -32,14 +34,16 @@ void SetSecurityKeyIpcChannelNameForTest(const std::string& channel_name) { |
| } |
| std::string GetChannelNamePathPrefixForTest() { |
| - std::string path_prefix; |
| -#if defined(OS_LINUX) |
| - path_prefix = "/dev/socket/"; |
| - std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| - if (env->GetVar(base::env_vars::kHome, &path_prefix)) |
| - path_prefix += "/"; |
| + std::string base_path; |
| +#if defined(OS_POSIX) |
| + base::FilePath base_file_path; |
| + if (!base::GetTempDir(&base_file_path)) { |
| + LOG(ERROR) << "Failed to retrieve temporary directory."; |
| + } else { |
| + base_path = base_file_path.value() + "/"; |
| + } |
| #endif |
| - return path_prefix; |
| + return base_path; |
| } |
| } // namespace remoting |