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

Unified Diff: remoting/host/plugin/daemon_controller_linux.cc

Issue 10909090: Implement DaemonController::GetVersion() method on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/host/remoting_me2me_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/plugin/daemon_controller_linux.cc
diff --git a/remoting/host/plugin/daemon_controller_linux.cc b/remoting/host/plugin/daemon_controller_linux.cc
index 71857cd74bd2d2a3a229cac89b836c27678b763f..ab2e087f9f243710e69151f88f69eb6ef29d6e9d 100644
--- a/remoting/host/plugin/daemon_controller_linux.cc
+++ b/remoting/host/plugin/daemon_controller_linux.cc
@@ -76,6 +76,7 @@ class DaemonControllerLinux : public remoting::DaemonController {
void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config,
const CompletionCallback& done_callback);
void DoStop(const CompletionCallback& done_callback);
+ void DoGetVersion(const GetVersionCallback& done_callback);
base::Thread file_io_thread_;
@@ -194,9 +195,9 @@ void DaemonControllerLinux::SetWindow(void* window_handle) {
void DaemonControllerLinux::GetVersion(
const GetVersionCallback& done_callback) {
- // TODO(sergeyu): Implement this method.
- NOTIMPLEMENTED();
- done_callback.Run("");
+ file_io_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
+ &DaemonControllerLinux::DoGetVersion, base::Unretained(this),
+ done_callback));
}
FilePath DaemonControllerLinux::GetConfigPath() {
@@ -302,6 +303,37 @@ void DaemonControllerLinux::DoStop(const CompletionCallback& done_callback) {
done_callback.Run(result);
}
+void DaemonControllerLinux::DoGetVersion(
+ const GetVersionCallback& done_callback) {
+ FilePath script_path;
+ if (!GetScriptPath(&script_path)) {
+ done_callback.Run("");
+ return;
+ }
+ CommandLine command_line(script_path);
+ command_line.AppendArg("--host-version");
+
+ std::string version;
+ int exit_code = 0;
+ int result =
+ base::GetAppOutputWithExitCode(command_line, &version, &exit_code);
+ if (!result || exit_code != 0) {
+ LOG(ERROR) << "Failed to run \"" << command_line.GetCommandLineString()
+ << "\". Exit code: " << exit_code;
+ done_callback.Run("");
+ return;
+ }
+
+ TrimWhitespaceASCII(version, TRIM_ALL, &version);
+ if (!ContainsOnlyChars(version, "0123456789.")) {
+ LOG(ERROR) << "Received invalid host version number: " << version;
+ done_callback.Run("");
+ return;
+ }
+
+ done_callback.Run(version);
+}
+
} // namespace
scoped_ptr<DaemonController> remoting::DaemonController::Create() {
« no previous file with comments | « no previous file | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698