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/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // the relevant UI in the web-app). | 145 // the relevant UI in the web-app). |
146 return DaemonController::STATE_NOT_IMPLEMENTED; | 146 return DaemonController::STATE_NOT_IMPLEMENTED; |
147 } | 147 } |
148 | 148 |
149 if (exit_code != 0) { | 149 if (exit_code != 0) { |
150 LOG(ERROR) << "Failed to run \"" << command_line.GetCommandLineString() | 150 LOG(ERROR) << "Failed to run \"" << command_line.GetCommandLineString() |
151 << "\". Exit code: " << exit_code; | 151 << "\". Exit code: " << exit_code; |
152 return DaemonController::STATE_UNKNOWN; | 152 return DaemonController::STATE_UNKNOWN; |
153 } | 153 } |
154 | 154 |
155 TrimWhitespaceASCII(status, TRIM_ALL, &status); | 155 base::TrimWhitespaceASCII(status, base::TRIM_ALL, &status); |
156 | 156 |
157 if (status == "STARTED") { | 157 if (status == "STARTED") { |
158 return DaemonController::STATE_STARTED; | 158 return DaemonController::STATE_STARTED; |
159 } else if (status == "STOPPED") { | 159 } else if (status == "STOPPED") { |
160 return DaemonController::STATE_STOPPED; | 160 return DaemonController::STATE_STOPPED; |
161 } else if (status == "NOT_IMPLEMENTED") { | 161 } else if (status == "NOT_IMPLEMENTED") { |
162 return DaemonController::STATE_NOT_IMPLEMENTED; | 162 return DaemonController::STATE_NOT_IMPLEMENTED; |
163 } else { | 163 } else { |
164 LOG(ERROR) << "Unknown status string returned from \"" | 164 LOG(ERROR) << "Unknown status string returned from \"" |
165 << command_line.GetCommandLineString() | 165 << command_line.GetCommandLineString() |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 std::string version; | 283 std::string version; |
284 int exit_code = 0; | 284 int exit_code = 0; |
285 int result = | 285 int result = |
286 base::GetAppOutputWithExitCode(command_line, &version, &exit_code); | 286 base::GetAppOutputWithExitCode(command_line, &version, &exit_code); |
287 if (!result || exit_code != 0) { | 287 if (!result || exit_code != 0) { |
288 LOG(ERROR) << "Failed to run \"" << command_line.GetCommandLineString() | 288 LOG(ERROR) << "Failed to run \"" << command_line.GetCommandLineString() |
289 << "\". Exit code: " << exit_code; | 289 << "\". Exit code: " << exit_code; |
290 return std::string(); | 290 return std::string(); |
291 } | 291 } |
292 | 292 |
293 TrimWhitespaceASCII(version, TRIM_ALL, &version); | 293 base::TrimWhitespaceASCII(version, base::TRIM_ALL, &version); |
294 if (!ContainsOnlyChars(version, "0123456789.")) { | 294 if (!ContainsOnlyChars(version, "0123456789.")) { |
295 LOG(ERROR) << "Received invalid host version number: " << version; | 295 LOG(ERROR) << "Received invalid host version number: " << version; |
296 return std::string(); | 296 return std::string(); |
297 } | 297 } |
298 | 298 |
299 return version; | 299 return version; |
300 } | 300 } |
301 | 301 |
302 DaemonController::UsageStatsConsent | 302 DaemonController::UsageStatsConsent |
303 DaemonControllerDelegateLinux::GetUsageStatsConsent() { | 303 DaemonControllerDelegateLinux::GetUsageStatsConsent() { |
304 // Crash dump collection is not implemented on Linux yet. | 304 // Crash dump collection is not implemented on Linux yet. |
305 // http://crbug.com/130678. | 305 // http://crbug.com/130678. |
306 DaemonController::UsageStatsConsent consent; | 306 DaemonController::UsageStatsConsent consent; |
307 consent.supported = false; | 307 consent.supported = false; |
308 consent.allowed = false; | 308 consent.allowed = false; |
309 consent.set_by_policy = false; | 309 consent.set_by_policy = false; |
310 return consent; | 310 return consent; |
311 } | 311 } |
312 | 312 |
313 scoped_refptr<DaemonController> DaemonController::Create() { | 313 scoped_refptr<DaemonController> DaemonController::Create() { |
314 scoped_ptr<DaemonController::Delegate> delegate( | 314 scoped_ptr<DaemonController::Delegate> delegate( |
315 new DaemonControllerDelegateLinux()); | 315 new DaemonControllerDelegateLinux()); |
316 return new DaemonController(delegate.Pass()); | 316 return new DaemonController(delegate.Pass()); |
317 } | 317 } |
318 | 318 |
319 } // namespace remoting | 319 } // namespace remoting |
OLD | NEW |