OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/protocol/webrtc_connection_to_client.h" | 5 #include "remoting/protocol/webrtc_connection_to_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 void WebrtcConnectionToClient::OnWebrtcTransportConnecting() { | 142 void WebrtcConnectionToClient::OnWebrtcTransportConnecting() { |
143 control_dispatcher_->Init(transport_.outgoing_channel_factory(), this); | 143 control_dispatcher_->Init(transport_.outgoing_channel_factory(), this); |
144 | 144 |
145 event_dispatcher_->Init(transport_.incoming_channel_factory(), this); | 145 event_dispatcher_->Init(transport_.incoming_channel_factory(), this); |
146 event_dispatcher_->set_on_input_event_callback(base::Bind( | 146 event_dispatcher_->set_on_input_event_callback(base::Bind( |
147 &ConnectionToClient::OnInputEventReceived, base::Unretained(this))); | 147 &ConnectionToClient::OnInputEventReceived, base::Unretained(this))); |
148 } | 148 } |
149 | 149 |
150 void WebrtcConnectionToClient::OnWebrtcTransportConnected() { | 150 void WebrtcConnectionToClient::OnWebrtcTransportConnected() { |
151 DCHECK(thread_checker_.CalledOnValidThread()); | 151 DCHECK(thread_checker_.CalledOnValidThread()); |
152 event_handler_->OnConnectionChannelsConnected(this); | |
153 } | 152 } |
154 | 153 |
155 void WebrtcConnectionToClient::OnWebrtcTransportError(ErrorCode error) { | 154 void WebrtcConnectionToClient::OnWebrtcTransportError(ErrorCode error) { |
156 DCHECK(thread_checker_.CalledOnValidThread()); | 155 DCHECK(thread_checker_.CalledOnValidThread()); |
157 Disconnect(error); | 156 Disconnect(error); |
158 } | 157 } |
159 | 158 |
160 void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamAdded( | 159 void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamAdded( |
161 scoped_refptr<webrtc::MediaStreamInterface> stream) { | 160 scoped_refptr<webrtc::MediaStreamInterface> stream) { |
162 LOG(WARNING) << "The client created an unexpected media stream."; | 161 LOG(WARNING) << "The client created an unexpected media stream."; |
163 } | 162 } |
164 | 163 |
165 void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamRemoved( | 164 void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamRemoved( |
166 scoped_refptr<webrtc::MediaStreamInterface> stream) {} | 165 scoped_refptr<webrtc::MediaStreamInterface> stream) {} |
167 | 166 |
168 void WebrtcConnectionToClient::OnChannelInitialized( | 167 void WebrtcConnectionToClient::OnChannelInitialized( |
169 ChannelDispatcherBase* channel_dispatcher) { | 168 ChannelDispatcherBase* channel_dispatcher) { |
170 DCHECK(thread_checker_.CalledOnValidThread()); | 169 DCHECK(thread_checker_.CalledOnValidThread()); |
| 170 |
| 171 if (control_dispatcher_ && control_dispatcher_->is_connected() && |
| 172 event_dispatcher_ && event_dispatcher_->is_connected()) { |
| 173 event_handler_->OnConnectionChannelsConnected(this); |
| 174 } |
171 } | 175 } |
172 | 176 |
173 void WebrtcConnectionToClient::OnChannelError( | 177 void WebrtcConnectionToClient::OnChannelError( |
174 ChannelDispatcherBase* channel_dispatcher, | 178 ChannelDispatcherBase* channel_dispatcher, |
175 ErrorCode error) { | 179 ErrorCode error) { |
176 DCHECK(thread_checker_.CalledOnValidThread()); | 180 DCHECK(thread_checker_.CalledOnValidThread()); |
177 | 181 |
178 LOG(ERROR) << "Failed to connect channel " | 182 LOG(ERROR) << "Failed to connect channel " |
179 << channel_dispatcher->channel_name(); | 183 << channel_dispatcher->channel_name(); |
180 Disconnect(error); | 184 Disconnect(error); |
181 } | 185 } |
182 | 186 |
183 } // namespace protocol | 187 } // namespace protocol |
184 } // namespace remoting | 188 } // namespace remoting |
OLD | NEW |