OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cast_extension_session.h" | 5 #include "remoting/host/cast_extension_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, | 178 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, |
179 const protocol::NetworkSettings& network_settings, | 179 const protocol::NetworkSettings& network_settings, |
180 ClientSessionControl* client_session_control, | 180 ClientSessionControl* client_session_control, |
181 protocol::ClientStub* client_stub) { | 181 protocol::ClientStub* client_stub) { |
182 scoped_ptr<CastExtensionSession> cast_extension_session( | 182 scoped_ptr<CastExtensionSession> cast_extension_session( |
183 new CastExtensionSession(caller_task_runner, | 183 new CastExtensionSession(caller_task_runner, |
184 url_request_context_getter, | 184 url_request_context_getter, |
185 network_settings, | 185 network_settings, |
186 client_session_control, | 186 client_session_control, |
187 client_stub)); | 187 client_stub)); |
188 if (!cast_extension_session->WrapTasksAndSave()) { | 188 if (!cast_extension_session->WrapTasksAndSave() || |
189 return scoped_ptr<CastExtensionSession>(); | 189 !cast_extension_session->InitializePeerConnection()) { |
190 } | 190 return nullptr; |
191 if (!cast_extension_session->InitializePeerConnection()) { | |
192 return scoped_ptr<CastExtensionSession>(); | |
193 } | 191 } |
194 return cast_extension_session.Pass(); | 192 return cast_extension_session.Pass(); |
195 } | 193 } |
196 | 194 |
197 void CastExtensionSession::OnCreateSessionDescription( | 195 void CastExtensionSession::OnCreateSessionDescription( |
198 webrtc::SessionDescriptionInterface* desc) { | 196 webrtc::SessionDescriptionInterface* desc) { |
199 if (!caller_task_runner_->BelongsToCurrentThread()) { | 197 if (!caller_task_runner_->BelongsToCurrentThread()) { |
200 caller_task_runner_->PostTask( | 198 caller_task_runner_->PostTask( |
201 FROM_HERE, | 199 FROM_HERE, |
202 base::Bind(&CastExtensionSession::OnCreateSessionDescription, | 200 base::Bind(&CastExtensionSession::OnCreateSessionDescription, |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 json->SetString(kWebRtcCandidate, candidate_str); | 661 json->SetString(kWebRtcCandidate, candidate_str); |
664 std::string json_str; | 662 std::string json_str; |
665 if (!base::JSONWriter::Write(json.get(), &json_str)) { | 663 if (!base::JSONWriter::Write(json.get(), &json_str)) { |
666 LOG(ERROR) << "Failed to serialize candidate message."; | 664 LOG(ERROR) << "Failed to serialize candidate message."; |
667 return; | 665 return; |
668 } | 666 } |
669 SendMessageToClient(kSubjectNewCandidate, json_str); | 667 SendMessageToClient(kSubjectNewCandidate, json_str); |
670 } | 668 } |
671 | 669 |
672 } // namespace remoting | 670 } // namespace remoting |
OLD | NEW |