OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/jingle_session.h" | 5 #include "remoting/protocol/jingle_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "crypto/hmac.h" | 11 #include "crypto/hmac.h" |
12 #include "crypto/rsa_private_key.h" | 12 #include "crypto/rsa_private_key.h" |
13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
14 #include "net/socket/stream_socket.h" | 14 #include "net/socket/stream_socket.h" |
15 #include "remoting/base/constants.h" | 15 #include "remoting/base/constants.h" |
16 #include "remoting/protocol/jingle_datagram_connector.h" | 16 #include "remoting/protocol/jingle_datagram_connector.h" |
17 #include "remoting/protocol/jingle_session_manager.h" | 17 #include "remoting/protocol/jingle_session_manager.h" |
18 #include "remoting/protocol/jingle_stream_connector.h" | 18 #include "remoting/protocol/jingle_stream_connector.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 if (cricket_session_->initiator()) { | 311 if (cricket_session_->initiator()) { |
312 // Set state to CONNECTING if this is an outgoing message. We need | 312 // Set state to CONNECTING if this is an outgoing message. We need |
313 // to post this task because channel creation works only after we | 313 // to post this task because channel creation works only after we |
314 // return from this method. This is because | 314 // return from this method. This is because |
315 // JingleChannelConnector::Connect() needs to call | 315 // JingleChannelConnector::Connect() needs to call |
316 // set_incoming_only() on P2PTransportChannel, but | 316 // set_incoming_only() on P2PTransportChannel, but |
317 // P2PTransportChannel is created only after we return from this | 317 // P2PTransportChannel is created only after we return from this |
318 // method. | 318 // method. |
319 // TODO(sergeyu): Add set_incoming_only() in TransportChannelProxy. | 319 // TODO(sergeyu): Add set_incoming_only() in TransportChannelProxy. |
320 MessageLoop::current()->PostTask( | 320 jingle_session_manager_->message_loop_->PostTask( |
321 FROM_HERE, task_factory_.NewRunnableMethod( | 321 FROM_HERE, task_factory_.NewRunnableMethod( |
322 &JingleSession::SetState, CONNECTING)); | 322 &JingleSession::SetState, CONNECTING)); |
323 } else { | 323 } else { |
324 MessageLoop::current()->PostTask( | 324 jingle_session_manager_->message_loop_->PostTask( |
325 FROM_HERE, task_factory_.NewRunnableMethod( | 325 FROM_HERE, task_factory_.NewRunnableMethod( |
326 &JingleSession::AcceptConnection)); | 326 &JingleSession::AcceptConnection)); |
327 } | 327 } |
328 } | 328 } |
329 | 329 |
330 bool JingleSession::InitializeConfigFromDescription( | 330 bool JingleSession::InitializeConfigFromDescription( |
331 const cricket::SessionDescription* description) { | 331 const cricket::SessionDescription* description) { |
332 // We should only be called after ParseContent has succeeded, in which | 332 // We should only be called after ParseContent has succeeded, in which |
333 // case there will always be a Chromoting session configuration. | 333 // case there will always be a Chromoting session configuration. |
334 const cricket::ContentInfo* content = | 334 const cricket::ContentInfo* content = |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 478 |
479 state_ = new_state; | 479 state_ = new_state; |
480 if (!closed_ && state_change_callback_.get()) | 480 if (!closed_ && state_change_callback_.get()) |
481 state_change_callback_->Run(new_state); | 481 state_change_callback_->Run(new_state); |
482 } | 482 } |
483 } | 483 } |
484 | 484 |
485 } // namespace protocol | 485 } // namespace protocol |
486 | 486 |
487 } // namespace remoting | 487 } // namespace remoting |
OLD | NEW |