Chromium Code Reviews| Index: remoting/host/plugin/daemon_controller_win.cc |
| diff --git a/remoting/host/plugin/daemon_controller_win.cc b/remoting/host/plugin/daemon_controller_win.cc |
| index 13f372520b77f66555d88beee0a22b90a5420e0f..416aed2f3fa7cca52b97e4e520c8bad1d997170d 100644 |
| --- a/remoting/host/plugin/daemon_controller_win.cc |
| +++ b/remoting/host/plugin/daemon_controller_win.cc |
| @@ -102,6 +102,8 @@ class DaemonControllerWin : public remoting::DaemonController { |
| const CompletionCallback& done_callback); |
| void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config, |
| const CompletionCallback& done_callback); |
| + void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config, |
| + const CompletionCallback& done_callback); |
| void DoStop(const CompletionCallback& done_callback); |
| // The worker thread used for servicing long running operations. |
| @@ -212,8 +214,11 @@ void DaemonControllerWin::SetConfigAndStart( |
| void DaemonControllerWin::UpdateConfig( |
| scoped_ptr<base::DictionaryValue> config, |
| const CompletionCallback& done_callback) { |
| - NOTIMPLEMENTED(); |
| - done_callback.Run(RESULT_FAILED); |
| + |
|
Sergey Ulanov
2012/04/17 05:42:18
nit: don't need this empty line.
simonmorris
2012/04/17 15:55:47
Done.
|
| + worker_thread_.message_loop_proxy()->PostTask( |
| + FROM_HERE, base::Bind( |
| + &DaemonControllerWin::DoUpdateConfig, |
| + base::Unretained(this), base::Passed(&config), done_callback)); |
| } |
| void DaemonControllerWin::Stop(const CompletionCallback& done_callback) { |
| @@ -405,6 +410,34 @@ void DaemonControllerWin::DoSetConfigAndStart( |
| done_callback.Run(HResultToAsyncResult(hr)); |
| } |
| +void DaemonControllerWin::DoUpdateConfig( |
| + scoped_ptr<base::DictionaryValue> config, |
| + const CompletionCallback& done_callback) { |
| + // TODO(simonmorris): Much of this code was copied from DoSetConfigAndStart(). |
| + // Refactor. |
| + DCHECK(worker_thread_.message_loop_proxy()->BelongsToCurrentThread()); |
| + |
| + IDaemonControl* control = NULL; |
| + HRESULT hr = worker_thread_.ActivateElevatedController(&control); |
| + if (FAILED(hr)) { |
| + done_callback.Run(HResultToAsyncResult(hr)); |
| + return; |
| + } |
| + |
| + // Store the configuration. |
| + std::string file_content; |
| + base::JSONWriter::Write(config.get(), &file_content); |
| + |
| + ScopedBstr host_config(UTF8ToUTF16(file_content).c_str()); |
| + if (host_config == NULL) { |
| + done_callback.Run(HResultToAsyncResult(E_OUTOFMEMORY)); |
| + return; |
| + } |
| + |
| + hr = control->UpdateConfig(host_config); |
| + done_callback.Run(HResultToAsyncResult(hr)); |
| +} |
| + |
| void DaemonControllerWin::DoStop(const CompletionCallback& done_callback) { |
| DCHECK(worker_thread_.message_loop_proxy()->BelongsToCurrentThread()); |