| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "remoting/host/setup/daemon_controller_delegate_linux.h" | 5 #include "remoting/host/setup/daemon_controller_delegate_linux.h" |
| 6 | 6 |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 | 8 |
| 9 #include "base/base_paths.h" |
| 9 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/environment.h" | 14 #include "base/environment.h" |
| 14 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 16 #include "base/json/json_writer.h" | 17 #include "base/json/json_writer.h" |
| 17 #include "base/logging.h" | 18 #include "base/logging.h" |
| 18 #include "base/md5.h" | 19 #include "base/md5.h" |
| 20 #include "base/path_service.h" |
| 19 #include "base/process/kill.h" | 21 #include "base/process/kill.h" |
| 20 #include "base/process/launch.h" | 22 #include "base/process/launch.h" |
| 21 #include "base/process/process_handle.h" | 23 #include "base/process/process_handle.h" |
| 22 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
| 23 #include "base/strings/string_split.h" | 25 #include "base/strings/string_split.h" |
| 24 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
| 25 #include "base/thread_task_runner_handle.h" | 27 #include "base/thread_task_runner_handle.h" |
| 26 #include "base/values.h" | 28 #include "base/values.h" |
| 27 #include "net/base/net_util.h" | 29 #include "net/base/net_util.h" |
| 28 #include "remoting/host/host_config.h" | 30 #include "remoting/host/host_config.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 48 base::MD5Context ctx; | 50 base::MD5Context ctx; |
| 49 base::MD5Init(&ctx); | 51 base::MD5Init(&ctx); |
| 50 base::MD5Update(&ctx, value); | 52 base::MD5Update(&ctx, value); |
| 51 base::MD5Digest digest; | 53 base::MD5Digest digest; |
| 52 base::MD5Final(&digest, &ctx); | 54 base::MD5Final(&digest, &ctx); |
| 53 return StringToLowerASCII(base::HexEncode(digest.a, sizeof(digest.a))); | 55 return StringToLowerASCII(base::HexEncode(digest.a, sizeof(digest.a))); |
| 54 } | 56 } |
| 55 | 57 |
| 56 base::FilePath GetConfigPath() { | 58 base::FilePath GetConfigPath() { |
| 57 std::string filename = "host#" + GetMd5(net::GetHostName()) + ".json"; | 59 std::string filename = "host#" + GetMd5(net::GetHostName()) + ".json"; |
| 58 return base::GetHomeDir(). | 60 base::FilePath homedir; |
| 59 Append(".config/chrome-remote-desktop").Append(filename); | 61 PathService::Get(base::DIR_HOME, &homedir); |
| 62 return homedir.Append(".config/chrome-remote-desktop").Append(filename); |
| 60 } | 63 } |
| 61 | 64 |
| 62 bool GetScriptPath(base::FilePath* result) { | 65 bool GetScriptPath(base::FilePath* result) { |
| 63 base::FilePath candidate_exe(kDaemonScript); | 66 base::FilePath candidate_exe(kDaemonScript); |
| 64 if (access(candidate_exe.value().c_str(), X_OK) == 0) { | 67 if (access(candidate_exe.value().c_str(), X_OK) == 0) { |
| 65 *result = candidate_exe; | 68 *result = candidate_exe; |
| 66 return true; | 69 return true; |
| 67 } | 70 } |
| 68 return false; | 71 return false; |
| 69 } | 72 } |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 return consent; | 318 return consent; |
| 316 } | 319 } |
| 317 | 320 |
| 318 scoped_refptr<DaemonController> DaemonController::Create() { | 321 scoped_refptr<DaemonController> DaemonController::Create() { |
| 319 scoped_ptr<DaemonController::Delegate> delegate( | 322 scoped_ptr<DaemonController::Delegate> delegate( |
| 320 new DaemonControllerDelegateLinux()); | 323 new DaemonControllerDelegateLinux()); |
| 321 return new DaemonController(delegate.Pass()); | 324 return new DaemonController(delegate.Pass()); |
| 322 } | 325 } |
| 323 | 326 |
| 324 } // namespace remoting | 327 } // namespace remoting |
| OLD | NEW |