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