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/host_window_proxy.h" | 5 #include "remoting/host/host_window_proxy.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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 : caller_task_runner_(caller_task_runner), | 95 : caller_task_runner_(caller_task_runner), |
96 ui_task_runner_(ui_task_runner), | 96 ui_task_runner_(ui_task_runner), |
97 host_window_(host_window.Pass()), | 97 host_window_(host_window.Pass()), |
98 weak_factory_(this) { | 98 weak_factory_(this) { |
99 DCHECK(caller_task_runner->BelongsToCurrentThread()); | 99 DCHECK(caller_task_runner->BelongsToCurrentThread()); |
100 } | 100 } |
101 | 101 |
102 void HostWindowProxy::Core::Start( | 102 void HostWindowProxy::Core::Start( |
103 const base::WeakPtr<ClientSessionControl>& client_session_control) { | 103 const base::WeakPtr<ClientSessionControl>& client_session_control) { |
104 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 104 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
105 DCHECK(!client_session_control_); | 105 DCHECK(!client_session_control_.get()); |
106 DCHECK(client_session_control); | 106 DCHECK(client_session_control.get()); |
107 | 107 |
108 client_session_control_ = client_session_control; | 108 client_session_control_ = client_session_control; |
109 ui_task_runner_->PostTask( | 109 ui_task_runner_->PostTask( |
110 FROM_HERE, base::Bind(&Core::StartOnUiThread, this, | 110 FROM_HERE, base::Bind(&Core::StartOnUiThread, this, |
111 client_session_control->client_jid())); | 111 client_session_control->client_jid())); |
112 } | 112 } |
113 | 113 |
114 void HostWindowProxy::Core::Stop() { | 114 void HostWindowProxy::Core::Stop() { |
115 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 115 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
116 | 116 |
(...skipping 24 matching lines...) Expand all Loading... |
141 return client_jid_; | 141 return client_jid_; |
142 } | 142 } |
143 | 143 |
144 void HostWindowProxy::Core::DisconnectSession() { | 144 void HostWindowProxy::Core::DisconnectSession() { |
145 if (!caller_task_runner_->BelongsToCurrentThread()) { | 145 if (!caller_task_runner_->BelongsToCurrentThread()) { |
146 caller_task_runner_->PostTask(FROM_HERE, | 146 caller_task_runner_->PostTask(FROM_HERE, |
147 base::Bind(&Core::DisconnectSession, this)); | 147 base::Bind(&Core::DisconnectSession, this)); |
148 return; | 148 return; |
149 } | 149 } |
150 | 150 |
151 if (client_session_control_) | 151 if (client_session_control_.get()) |
152 client_session_control_->DisconnectSession(); | 152 client_session_control_->DisconnectSession(); |
153 } | 153 } |
154 | 154 |
155 void HostWindowProxy::Core::OnLocalMouseMoved(const SkIPoint& position) { | 155 void HostWindowProxy::Core::OnLocalMouseMoved(const SkIPoint& position) { |
156 if (!caller_task_runner_->BelongsToCurrentThread()) { | 156 if (!caller_task_runner_->BelongsToCurrentThread()) { |
157 caller_task_runner_->PostTask( | 157 caller_task_runner_->PostTask( |
158 FROM_HERE, base::Bind(&Core::OnLocalMouseMoved, this, position)); | 158 FROM_HERE, base::Bind(&Core::OnLocalMouseMoved, this, position)); |
159 return; | 159 return; |
160 } | 160 } |
161 | 161 |
162 if (client_session_control_) | 162 if (client_session_control_.get()) |
163 client_session_control_->OnLocalMouseMoved(position); | 163 client_session_control_->OnLocalMouseMoved(position); |
164 } | 164 } |
165 | 165 |
166 void HostWindowProxy::Core::SetDisableInputs(bool disable_inputs) { | 166 void HostWindowProxy::Core::SetDisableInputs(bool disable_inputs) { |
167 if (!caller_task_runner_->BelongsToCurrentThread()) { | 167 if (!caller_task_runner_->BelongsToCurrentThread()) { |
168 caller_task_runner_->PostTask( | 168 caller_task_runner_->PostTask( |
169 FROM_HERE, base::Bind(&Core::SetDisableInputs, this, disable_inputs)); | 169 FROM_HERE, base::Bind(&Core::SetDisableInputs, this, disable_inputs)); |
170 return; | 170 return; |
171 } | 171 } |
172 | 172 |
173 if (client_session_control_) | 173 if (client_session_control_.get()) |
174 client_session_control_->SetDisableInputs(disable_inputs); | 174 client_session_control_->SetDisableInputs(disable_inputs); |
175 } | 175 } |
176 | 176 |
177 } // namespace remoting | 177 } // namespace remoting |
OLD | NEW |