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" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 host_public_key_ = host_public_key; | 74 host_public_key_ = host_public_key; |
75 | 75 |
76 JavascriptSignalStrategy* strategy = new JavascriptSignalStrategy(local_jid); | 76 JavascriptSignalStrategy* strategy = new JavascriptSignalStrategy(local_jid); |
77 strategy->AttachXmppProxy(xmpp_proxy); | 77 strategy->AttachXmppProxy(xmpp_proxy); |
78 signal_strategy_.reset(strategy); | 78 signal_strategy_.reset(strategy); |
79 signal_strategy_->AddListener(this); | 79 signal_strategy_->AddListener(this); |
80 signal_strategy_->Connect(); | 80 signal_strategy_->Connect(); |
81 | 81 |
82 scoped_ptr<TransportFactory> transport_factory( | 82 scoped_ptr<TransportFactory> transport_factory( |
83 new PepperTransportFactory(pp_instance_)); | 83 new PepperTransportFactory(pp_instance_)); |
84 session_manager_.reset(new JingleSessionManager(transport_factory.Pass())); | 84 session_manager_.reset(new JingleSessionManager( |
85 session_manager_->Init(signal_strategy_.get(), this, | 85 transport_factory.Pass(), true)); |
86 NetworkSettings(allow_nat_traversal_)); | 86 session_manager_->Init(signal_strategy_.get(), this); |
87 } | 87 } |
88 | 88 |
89 void ConnectionToHost::Disconnect(const base::Closure& shutdown_task) { | 89 void ConnectionToHost::Disconnect(const base::Closure& shutdown_task) { |
90 if (!message_loop_->BelongsToCurrentThread()) { | 90 if (!message_loop_->BelongsToCurrentThread()) { |
91 message_loop_->PostTask( | 91 message_loop_->PostTask( |
92 FROM_HERE, base::Bind(&ConnectionToHost::Disconnect, | 92 FROM_HERE, base::Bind(&ConnectionToHost::Disconnect, |
93 base::Unretained(this), shutdown_task)); | 93 base::Unretained(this), shutdown_task)); |
94 return; | 94 return; |
95 } | 95 } |
96 | 96 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 if (state != state_) { | 247 if (state != state_) { |
248 state_ = state; | 248 state_ = state; |
249 error_ = error; | 249 error_ = error; |
250 event_callback_->OnConnectionState(state_, error_); | 250 event_callback_->OnConnectionState(state_, error_); |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 } // namespace protocol | 254 } // namespace protocol |
255 } // namespace remoting | 255 } // namespace remoting |
OLD | NEW |