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/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
30 #include "remoting/host/host_config.h" | 30 #include "remoting/host/host_config.h" |
31 #include "remoting/host/usage_stats_consent.h" | 31 #include "remoting/host/usage_stats_consent.h" |
32 | 32 |
33 namespace remoting { | 33 namespace remoting { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 const char kDaemonScript[] = | 37 const char kDaemonScript[] = |
38 "/opt/google/chrome-remote-desktop/chrome-remote-desktop"; | 38 "/opt/google/chrome-remote-desktop/chrome-remote-desktop"; |
39 | 39 |
40 // The name of the command-line switch used to specify the host configuration | |
41 // file to use. | |
42 const char kHostConfigSwitchName[] = "host-config"; | |
43 | |
40 base::FilePath GetConfigPath() { | 44 base::FilePath GetConfigPath() { |
45 base::CommandLine* current_process = base::CommandLine::ForCurrentProcess(); | |
Sergey Ulanov
2016/12/16 22:22:11
This code runs in native messaging host. How are y
| |
46 if (current_process->HasSwitch(kHostConfigSwitchName)) { | |
47 return current_process->GetSwitchValuePath(kHostConfigSwitchName); | |
48 } | |
41 std::string filename = | 49 std::string filename = |
42 "host#" + base::MD5String(net::GetHostName()) + ".json"; | 50 "host#" + base::MD5String(net::GetHostName()) + ".json"; |
43 base::FilePath homedir; | 51 base::FilePath homedir; |
44 PathService::Get(base::DIR_HOME, &homedir); | 52 PathService::Get(base::DIR_HOME, &homedir); |
45 return homedir.Append(".config/chrome-remote-desktop").Append(filename); | 53 return homedir.Append(".config/chrome-remote-desktop").Append(filename); |
46 } | 54 } |
47 | 55 |
48 bool GetScriptPath(base::FilePath* result) { | 56 bool GetScriptPath(base::FilePath* result) { |
49 base::FilePath candidate_exe(kDaemonScript); | 57 base::FilePath candidate_exe(kDaemonScript); |
50 if (access(candidate_exe.value().c_str(), X_OK) == 0) { | 58 if (access(candidate_exe.value().c_str(), X_OK) == 0) { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 consent.set_by_policy = false; | 237 consent.set_by_policy = false; |
230 return consent; | 238 return consent; |
231 } | 239 } |
232 | 240 |
233 scoped_refptr<DaemonController> DaemonController::Create() { | 241 scoped_refptr<DaemonController> DaemonController::Create() { |
234 return new DaemonController( | 242 return new DaemonController( |
235 base::WrapUnique(new DaemonControllerDelegateLinux())); | 243 base::WrapUnique(new DaemonControllerDelegateLinux())); |
236 } | 244 } |
237 | 245 |
238 } // namespace remoting | 246 } // namespace remoting |
OLD | NEW |