| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   63   // |signal_strategy_| is connected. |   63   // |signal_strategy_| is connected. | 
|   64   host_jid_ = host_jid; |   64   host_jid_ = host_jid; | 
|   65   host_public_key_ = host_public_key; |   65   host_public_key_ = host_public_key; | 
|   66  |   66  | 
|   67   JavascriptSignalStrategy* strategy = new JavascriptSignalStrategy(local_jid); |   67   JavascriptSignalStrategy* strategy = new JavascriptSignalStrategy(local_jid); | 
|   68   strategy->AttachXmppProxy(xmpp_proxy); |   68   strategy->AttachXmppProxy(xmpp_proxy); | 
|   69   signal_strategy_.reset(strategy); |   69   signal_strategy_.reset(strategy); | 
|   70   signal_strategy_->AddListener(this); |   70   signal_strategy_->AddListener(this); | 
|   71   signal_strategy_->Connect(); |   71   signal_strategy_->Connect(); | 
|   72  |   72  | 
|   73   session_manager_.reset(new PepperSessionManager(pp_instance_)); |   73   scoped_ptr<TransportFactory> transport_factory( | 
 |   74       new PepperTransportFactory(pp_instance_)); | 
 |   75   session_manager_.reset(new PepperSessionManager(transport_factory.Pass())); | 
|   74   session_manager_->Init(signal_strategy_.get(), this, |   76   session_manager_->Init(signal_strategy_.get(), this, | 
|   75                          NetworkSettings(allow_nat_traversal_)); |   77                          NetworkSettings(allow_nat_traversal_)); | 
|   76 } |   78 } | 
|   77  |   79  | 
|   78 void ConnectionToHost::Disconnect(const base::Closure& shutdown_task) { |   80 void ConnectionToHost::Disconnect(const base::Closure& shutdown_task) { | 
|   79   if (!message_loop_->BelongsToCurrentThread()) { |   81   if (!message_loop_->BelongsToCurrentThread()) { | 
|   80     message_loop_->PostTask( |   82     message_loop_->PostTask( | 
|   81         FROM_HERE, base::Bind(&ConnectionToHost::Disconnect, |   83         FROM_HERE, base::Bind(&ConnectionToHost::Disconnect, | 
|   82                               base::Unretained(this), shutdown_task)); |   84                               base::Unretained(this), shutdown_task)); | 
|   83     return; |   85     return; | 
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  237  |  239  | 
|  238   if (state != state_) { |  240   if (state != state_) { | 
|  239     state_ = state; |  241     state_ = state; | 
|  240     error_ = error; |  242     error_ = error; | 
|  241     event_callback_->OnConnectionState(state_, error_); |  243     event_callback_->OnConnectionState(state_, error_); | 
|  242   } |  244   } | 
|  243 } |  245 } | 
|  244  |  246  | 
|  245 }  // namespace protocol |  247 }  // namespace protocol | 
|  246 }  // namespace remoting |  248 }  // namespace remoting | 
| OLD | NEW |