| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugin/daemon_controller.h" | 5 #include "remoting/host/plugin/daemon_controller.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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 DaemonControllerLinux(); | 56 DaemonControllerLinux(); |
| 57 | 57 |
| 58 virtual State GetState() OVERRIDE; | 58 virtual State GetState() OVERRIDE; |
| 59 virtual void GetConfig(const GetConfigCallback& callback) OVERRIDE; | 59 virtual void GetConfig(const GetConfigCallback& callback) OVERRIDE; |
| 60 virtual void SetConfigAndStart( | 60 virtual void SetConfigAndStart( |
| 61 scoped_ptr<base::DictionaryValue> config, | 61 scoped_ptr<base::DictionaryValue> config, |
| 62 const CompletionCallback& done_callback) OVERRIDE; | 62 const CompletionCallback& done_callback) OVERRIDE; |
| 63 virtual void UpdateConfig(scoped_ptr<base::DictionaryValue> config, | 63 virtual void UpdateConfig(scoped_ptr<base::DictionaryValue> config, |
| 64 const CompletionCallback& done_callback) OVERRIDE; | 64 const CompletionCallback& done_callback) OVERRIDE; |
| 65 virtual void Stop(const CompletionCallback& done_callback) OVERRIDE; | 65 virtual void Stop(const CompletionCallback& done_callback) OVERRIDE; |
| 66 virtual void SetWindow(void* window_handle) OVERRIDE; |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 FilePath GetConfigPath(); | 69 FilePath GetConfigPath(); |
| 69 | 70 |
| 70 void DoGetConfig(const GetConfigCallback& callback); | 71 void DoGetConfig(const GetConfigCallback& callback); |
| 71 void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config, | 72 void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config, |
| 72 const CompletionCallback& done_callback); | 73 const CompletionCallback& done_callback); |
| 73 void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config, | 74 void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config, |
| 74 const CompletionCallback& done_callback); | 75 const CompletionCallback& done_callback); |
| 75 void DoStop(const CompletionCallback& done_callback); | 76 void DoStop(const CompletionCallback& done_callback); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 &DaemonControllerLinux::DoUpdateConfig, base::Unretained(this), | 174 &DaemonControllerLinux::DoUpdateConfig, base::Unretained(this), |
| 174 base::Passed(&config), done_callback)); | 175 base::Passed(&config), done_callback)); |
| 175 } | 176 } |
| 176 | 177 |
| 177 void DaemonControllerLinux::Stop(const CompletionCallback& done_callback) { | 178 void DaemonControllerLinux::Stop(const CompletionCallback& done_callback) { |
| 178 file_io_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 179 file_io_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
| 179 &DaemonControllerLinux::DoStop, base::Unretained(this), | 180 &DaemonControllerLinux::DoStop, base::Unretained(this), |
| 180 done_callback)); | 181 done_callback)); |
| 181 } | 182 } |
| 182 | 183 |
| 184 void DaemonControllerLinux::SetWindow(void* window_handle) { |
| 185 // noop |
| 186 } |
| 187 |
| 183 FilePath DaemonControllerLinux::GetConfigPath() { | 188 FilePath DaemonControllerLinux::GetConfigPath() { |
| 184 std::string filename = "host#" + GetMd5(net::GetHostName()) + ".json"; | 189 std::string filename = "host#" + GetMd5(net::GetHostName()) + ".json"; |
| 185 return file_util::GetHomeDir(). | 190 return file_util::GetHomeDir(). |
| 186 Append(".config/chrome-remote-desktop").Append(filename); | 191 Append(".config/chrome-remote-desktop").Append(filename); |
| 187 } | 192 } |
| 188 | 193 |
| 189 void DaemonControllerLinux::DoGetConfig(const GetConfigCallback& callback) { | 194 void DaemonControllerLinux::DoGetConfig(const GetConfigCallback& callback) { |
| 190 JsonHostConfig config(GetConfigPath()); | 195 JsonHostConfig config(GetConfigPath()); |
| 191 scoped_ptr<base::DictionaryValue> result; | 196 scoped_ptr<base::DictionaryValue> result; |
| 192 if (config.Read()) { | 197 if (config.Read()) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 done_callback.Run(result); | 260 done_callback.Run(result); |
| 256 } | 261 } |
| 257 | 262 |
| 258 } // namespace | 263 } // namespace |
| 259 | 264 |
| 260 scoped_ptr<DaemonController> remoting::DaemonController::Create() { | 265 scoped_ptr<DaemonController> remoting::DaemonController::Create() { |
| 261 return scoped_ptr<DaemonController>(new DaemonControllerLinux()); | 266 return scoped_ptr<DaemonController>(new DaemonControllerLinux()); |
| 262 } | 267 } |
| 263 | 268 |
| 264 } // namespace remoting | 269 } // namespace remoting |
| OLD | NEW |