| 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/channel_dispatcher_base.h" | 5 #include "remoting/protocol/channel_dispatcher_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "net/socket/stream_socket.h" | 8 #include "net/socket/stream_socket.h" |
| 9 #include "remoting/protocol/session.h" | 9 #include "remoting/protocol/session.h" |
| 10 #include "remoting/protocol/session_config.h" | 10 #include "remoting/protocol/session_config.h" |
| 11 #include "remoting/protocol/stream_channel_factory.h" | 11 #include "remoting/protocol/stream_channel_factory.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 namespace protocol { | 14 namespace protocol { |
| 15 | 15 |
| 16 ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name) | 16 ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name) |
| 17 : channel_name_(channel_name), | 17 : channel_name_(channel_name), |
| 18 channel_factory_(NULL) { | 18 channel_factory_(nullptr) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 ChannelDispatcherBase::~ChannelDispatcherBase() { | 21 ChannelDispatcherBase::~ChannelDispatcherBase() { |
| 22 if (channel_factory_) | 22 if (channel_factory_) |
| 23 channel_factory_->CancelChannelCreation(channel_name_); | 23 channel_factory_->CancelChannelCreation(channel_name_); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void ChannelDispatcherBase::Init(Session* session, | 26 void ChannelDispatcherBase::Init(Session* session, |
| 27 const ChannelConfig& config, | 27 const ChannelConfig& config, |
| 28 const InitializedCallback& callback) { | 28 const InitializedCallback& callback) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 48 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this))); | 48 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this))); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void ChannelDispatcherBase::OnChannelReady( | 51 void ChannelDispatcherBase::OnChannelReady( |
| 52 scoped_ptr<net::StreamSocket> socket) { | 52 scoped_ptr<net::StreamSocket> socket) { |
| 53 if (!socket.get()) { | 53 if (!socket.get()) { |
| 54 initialized_callback_.Run(false); | 54 initialized_callback_.Run(false); |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 | 57 |
| 58 channel_factory_ = NULL; | 58 channel_factory_ = nullptr; |
| 59 channel_ = socket.Pass(); | 59 channel_ = socket.Pass(); |
| 60 | 60 |
| 61 OnInitialized(); | 61 OnInitialized(); |
| 62 | 62 |
| 63 initialized_callback_.Run(true); | 63 initialized_callback_.Run(true); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace protocol | 66 } // namespace protocol |
| 67 } // namespace remoting | 67 } // namespace remoting |
| OLD | NEW |