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