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

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

Issue 10103010: [Chromoting] Implement UpdateConfig() for the Windows host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 8 years, 8 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 | « remoting/host/elevated_controller_win.cc ('k') | 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_win.cc
diff --git a/remoting/host/plugin/daemon_controller_win.cc b/remoting/host/plugin/daemon_controller_win.cc
index 13f372520b77f66555d88beee0a22b90a5420e0f..cb9bebfd83660fdcb58fcf90d224d334e21ad95b 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.
@@ -202,7 +204,6 @@ void DaemonControllerWin::GetConfig(const GetConfigCallback& callback) {
void DaemonControllerWin::SetConfigAndStart(
scoped_ptr<base::DictionaryValue> config,
const CompletionCallback& done_callback) {
-
worker_thread_.message_loop_proxy()->PostTask(
FROM_HERE, base::Bind(
&DaemonControllerWin::DoInstallAsNeededAndStart,
@@ -212,8 +213,10 @@ void DaemonControllerWin::SetConfigAndStart(
void DaemonControllerWin::UpdateConfig(
scoped_ptr<base::DictionaryValue> config,
const CompletionCallback& done_callback) {
- NOTIMPLEMENTED();
- done_callback.Run(RESULT_FAILED);
+ 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 +408,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());
« no previous file with comments | « remoting/host/elevated_controller_win.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698