| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/connection_to_host.h" | 5 #include "remoting/protocol/connection_to_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| 11 #include "remoting/base/constants.h" | 11 #include "remoting/base/constants.h" |
| 12 #include "remoting/jingle_glue/javascript_signal_strategy.h" | 12 #include "remoting/jingle_glue/javascript_signal_strategy.h" |
| 13 #include "remoting/jingle_glue/xmpp_signal_strategy.h" | 13 #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
| 14 #include "remoting/protocol/auth_util.h" | 14 #include "remoting/protocol/auth_util.h" |
| 15 #include "remoting/protocol/authenticator.h" | 15 #include "remoting/protocol/authenticator.h" |
| 16 #include "remoting/protocol/client_control_dispatcher.h" | 16 #include "remoting/protocol/client_control_dispatcher.h" |
| 17 #include "remoting/protocol/client_event_dispatcher.h" | 17 #include "remoting/protocol/client_event_dispatcher.h" |
| 18 #include "remoting/protocol/client_stub.h" | 18 #include "remoting/protocol/client_stub.h" |
| 19 #include "remoting/protocol/jingle_session_manager.h" | |
| 20 #include "remoting/protocol/pepper_session_manager.h" | 19 #include "remoting/protocol/pepper_session_manager.h" |
| 20 #include "remoting/protocol/pepper_transport_factory.h" |
| 21 #include "remoting/protocol/video_reader.h" | 21 #include "remoting/protocol/video_reader.h" |
| 22 #include "remoting/protocol/video_stub.h" | 22 #include "remoting/protocol/video_stub.h" |
| 23 #include "remoting/protocol/util.h" | 23 #include "remoting/protocol/util.h" |
| 24 | 24 |
| 25 namespace remoting { | 25 namespace remoting { |
| 26 namespace protocol { | 26 namespace protocol { |
| 27 | 27 |
| 28 ConnectionToHost::ConnectionToHost( | 28 ConnectionToHost::ConnectionToHost( |
| 29 base::MessageLoopProxy* message_loop, | 29 base::MessageLoopProxy* message_loop, |
| 30 pp::Instance* pp_instance, | 30 pp::Instance* pp_instance, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // |signal_strategy_| is connected. | 71 // |signal_strategy_| is connected. |
| 72 host_jid_ = host_jid; | 72 host_jid_ = host_jid; |
| 73 host_public_key_ = host_public_key; | 73 host_public_key_ = host_public_key; |
| 74 | 74 |
| 75 JavascriptSignalStrategy* strategy = new JavascriptSignalStrategy(local_jid); | 75 JavascriptSignalStrategy* strategy = new JavascriptSignalStrategy(local_jid); |
| 76 strategy->AttachXmppProxy(xmpp_proxy); | 76 strategy->AttachXmppProxy(xmpp_proxy); |
| 77 signal_strategy_.reset(strategy); | 77 signal_strategy_.reset(strategy); |
| 78 signal_strategy_->AddListener(this); | 78 signal_strategy_->AddListener(this); |
| 79 signal_strategy_->Connect(); | 79 signal_strategy_->Connect(); |
| 80 | 80 |
| 81 session_manager_.reset(new PepperSessionManager(pp_instance_)); | 81 scoped_ptr<TransportFactory> transport_factory( |
| 82 new PepperTransportFactory(pp_instance_)); |
| 83 session_manager_.reset(new PepperSessionManager(transport_factory.Pass())); |
| 82 session_manager_->Init(signal_strategy_.get(), this, | 84 session_manager_->Init(signal_strategy_.get(), this, |
| 83 NetworkSettings(allow_nat_traversal_)); | 85 NetworkSettings(allow_nat_traversal_)); |
| 84 } | 86 } |
| 85 | 87 |
| 86 void ConnectionToHost::Disconnect(const base::Closure& shutdown_task) { | 88 void ConnectionToHost::Disconnect(const base::Closure& shutdown_task) { |
| 87 if (!message_loop_->BelongsToCurrentThread()) { | 89 if (!message_loop_->BelongsToCurrentThread()) { |
| 88 message_loop_->PostTask( | 90 message_loop_->PostTask( |
| 89 FROM_HERE, base::Bind(&ConnectionToHost::Disconnect, | 91 FROM_HERE, base::Bind(&ConnectionToHost::Disconnect, |
| 90 base::Unretained(this), shutdown_task)); | 92 base::Unretained(this), shutdown_task)); |
| 91 return; | 93 return; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 244 |
| 243 if (state != state_) { | 245 if (state != state_) { |
| 244 state_ = state; | 246 state_ = state; |
| 245 error_ = error; | 247 error_ = error; |
| 246 event_callback_->OnConnectionState(state_, error_); | 248 event_callback_->OnConnectionState(state_, error_); |
| 247 } | 249 } |
| 248 } | 250 } |
| 249 | 251 |
| 250 } // namespace protocol | 252 } // namespace protocol |
| 251 } // namespace remoting | 253 } // namespace remoting |
| OLD | NEW |