| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/setup/daemon_controller.h" | 5 #include "remoting/host/setup/daemon_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 void DaemonController::GetConfig(const GetConfigCallback& done) { | 40 void DaemonController::GetConfig(const GetConfigCallback& done) { |
| 41 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 41 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 42 | 42 |
| 43 DaemonController::GetConfigCallback wrapped_done = base::Bind( | 43 DaemonController::GetConfigCallback wrapped_done = base::Bind( |
| 44 &DaemonController::InvokeConfigCallbackAndScheduleNext, this, done); | 44 &DaemonController::InvokeConfigCallbackAndScheduleNext, this, done); |
| 45 base::Closure request = base::Bind( | 45 base::Closure request = base::Bind( |
| 46 &DaemonController::DoGetConfig, this, wrapped_done); | 46 &DaemonController::DoGetConfig, this, wrapped_done); |
| 47 ServiceOrQueueRequest(request); | 47 ServiceOrQueueRequest(request); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void DaemonController::InstallHost(const CompletionCallback& done) { |
| 51 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 52 |
| 53 DaemonController::CompletionCallback wrapped_done = base::Bind( |
| 54 &DaemonController::InvokeCompletionCallbackAndScheduleNext, this, done); |
| 55 base::Closure request = base::Bind( |
| 56 &DaemonController::DoInstallHost, this, wrapped_done); |
| 57 ServiceOrQueueRequest(request); |
| 58 } |
| 59 |
| 50 void DaemonController::SetConfigAndStart( | 60 void DaemonController::SetConfigAndStart( |
| 51 scoped_ptr<base::DictionaryValue> config, | 61 scoped_ptr<base::DictionaryValue> config, |
| 52 bool consent, | 62 bool consent, |
| 53 const CompletionCallback& done) { | 63 const CompletionCallback& done) { |
| 54 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 64 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 55 | 65 |
| 56 DaemonController::CompletionCallback wrapped_done = base::Bind( | 66 DaemonController::CompletionCallback wrapped_done = base::Bind( |
| 57 &DaemonController::InvokeCompletionCallbackAndScheduleNext, this, done); | 67 &DaemonController::InvokeCompletionCallbackAndScheduleNext, this, done); |
| 58 base::Closure request = base::Bind( | 68 base::Closure request = base::Bind( |
| 59 &DaemonController::DoSetConfigAndStart, this, base::Passed(&config), | 69 &DaemonController::DoSetConfigAndStart, this, base::Passed(&config), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 133 } |
| 124 | 134 |
| 125 void DaemonController::DoGetConfig(const GetConfigCallback& done) { | 135 void DaemonController::DoGetConfig(const GetConfigCallback& done) { |
| 126 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); | 136 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); |
| 127 | 137 |
| 128 scoped_ptr<base::DictionaryValue> config = delegate_->GetConfig(); | 138 scoped_ptr<base::DictionaryValue> config = delegate_->GetConfig(); |
| 129 caller_task_runner_->PostTask(FROM_HERE, | 139 caller_task_runner_->PostTask(FROM_HERE, |
| 130 base::Bind(done, base::Passed(&config))); | 140 base::Bind(done, base::Passed(&config))); |
| 131 } | 141 } |
| 132 | 142 |
| 143 void DaemonController::DoInstallHost(const CompletionCallback& done) { |
| 144 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); |
| 145 |
| 146 delegate_->InstallHost(done); |
| 147 } |
| 148 |
| 133 void DaemonController::DoSetConfigAndStart( | 149 void DaemonController::DoSetConfigAndStart( |
| 134 scoped_ptr<base::DictionaryValue> config, | 150 scoped_ptr<base::DictionaryValue> config, |
| 135 bool consent, | 151 bool consent, |
| 136 const CompletionCallback& done) { | 152 const CompletionCallback& done) { |
| 137 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); | 153 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); |
| 138 | 154 |
| 139 delegate_->SetConfigAndStart(config.Pass(), consent, done); | 155 delegate_->SetConfigAndStart(config.Pass(), consent, done); |
| 140 } | 156 } |
| 141 | 157 |
| 142 void DaemonController::DoUpdateConfig( | 158 void DaemonController::DoUpdateConfig( |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 if (!servicing_request) | 248 if (!servicing_request) |
| 233 ServiceNextRequest(); | 249 ServiceNextRequest(); |
| 234 } | 250 } |
| 235 | 251 |
| 236 void DaemonController::ServiceNextRequest() { | 252 void DaemonController::ServiceNextRequest() { |
| 237 if (!pending_requests_.empty()) | 253 if (!pending_requests_.empty()) |
| 238 delegate_task_runner_->PostTask(FROM_HERE, pending_requests_.front()); | 254 delegate_task_runner_->PostTask(FROM_HERE, pending_requests_.front()); |
| 239 } | 255 } |
| 240 | 256 |
| 241 } // namespace remoting | 257 } // namespace remoting |
| OLD | NEW |