Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: remoting/host/setup/daemon_controller_delegate_linux.cc

Issue 159753008: Disable Me2Me host controls on unsupported Linux systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/tools/me2me_virtual_host.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/setup/daemon_controller_delegate_linux.cc
diff --git a/remoting/host/setup/daemon_controller_delegate_linux.cc b/remoting/host/setup/daemon_controller_delegate_linux.cc
index d323e1c66e8a23030a26ccf7ebfe2aa8f6b6e7d6..7e7804612ff43616d6141b8aadb24b4decffc464 100644
--- a/remoting/host/setup/daemon_controller_delegate_linux.cc
+++ b/remoting/host/setup/daemon_controller_delegate_linux.cc
@@ -114,8 +114,7 @@ bool RunHostScriptWithTimeout(
return true;
}
-bool RunHostScript(const std::vector<std::string>& args,
- int* exit_code) {
+bool RunHostScript(const std::vector<std::string>& args, int* exit_code) {
return RunHostScriptWithTimeout(
args, base::TimeDelta::FromMilliseconds(kDaemonTimeoutMs), exit_code);
}
@@ -129,20 +128,43 @@ DaemonControllerDelegateLinux::~DaemonControllerDelegateLinux() {
}
DaemonController::State DaemonControllerDelegateLinux::GetState() {
- std::vector<std::string> args;
- args.push_back("--check-running");
+ base::FilePath script_path;
+ if (!GetScriptPath(&script_path)) {
+ return DaemonController::STATE_NOT_IMPLEMENTED;
+ }
+ CommandLine command_line(script_path);
+ command_line.AppendArg("--get-status");
+
+ std::string status;
int exit_code = 0;
- if (!RunHostScript(args, &exit_code)) {
+ bool result =
+ base::GetAppOutputWithExitCode(command_line, &status, &exit_code);
+ if (!result) {
// TODO(jamiewalch): When we have a good story for installing, return
// NOT_INSTALLED rather than NOT_IMPLEMENTED (the former suppresses
// the relevant UI in the web-app).
return DaemonController::STATE_NOT_IMPLEMENTED;
}
- if (exit_code == 0) {
+ if (exit_code != 0) {
+ LOG(ERROR) << "Failed to run \"" << command_line.GetCommandLineString()
+ << "\". Exit code: " << exit_code;
+ return DaemonController::STATE_UNKNOWN;
+ }
+
+ TrimWhitespaceASCII(status, TRIM_ALL, &status);
+
+ if (status == "STARTED") {
return DaemonController::STATE_STARTED;
- } else {
+ } else if (status == "STOPPED") {
return DaemonController::STATE_STOPPED;
+ } else if (status == "NOT_IMPLEMENTED") {
+ return DaemonController::STATE_NOT_IMPLEMENTED;
+ } else {
+ LOG(ERROR) << "Unknown status string returned from \""
+ << command_line.GetCommandLineString()
+ << "\": " << status;
+ return DaemonController::STATE_UNKNOWN;
}
}
« no previous file with comments | « no previous file | remoting/tools/me2me_virtual_host.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698