| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_PROTOCOL_PEPPER_STREAM_CHANNEL_H_ | |
| 6 #define REMOTING_PROTOCOL_PEPPER_STREAM_CHANNEL_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "net/base/completion_callback.h" | |
| 13 #include "remoting/protocol/channel_authenticator.h" | |
| 14 #include "remoting/protocol/pepper_channel.h" | |
| 15 #include "remoting/protocol/pepper_transport_socket_adapter.h" | |
| 16 #include "remoting/protocol/session.h" | |
| 17 | |
| 18 namespace net { | |
| 19 class CertVerifier; | |
| 20 class StreamSocket; | |
| 21 class SSLClientSocket; | |
| 22 } // namespace net | |
| 23 | |
| 24 namespace remoting { | |
| 25 namespace protocol { | |
| 26 | |
| 27 class PepperSession; | |
| 28 | |
| 29 class PepperStreamChannel : public PepperChannel, | |
| 30 public PepperTransportSocketAdapter::Observer { | |
| 31 public: | |
| 32 PepperStreamChannel(PepperSession* session, | |
| 33 const std::string& name, | |
| 34 const Session::StreamChannelCallback& callback); | |
| 35 virtual ~PepperStreamChannel(); | |
| 36 | |
| 37 // PepperChannel implementation. | |
| 38 virtual void Connect(pp::Instance* pp_instance, | |
| 39 const TransportConfig& transport_config, | |
| 40 scoped_ptr<ChannelAuthenticator> authenticator) OVERRIDE; | |
| 41 virtual void AddRemoteCandidate(const cricket::Candidate& candidate) OVERRIDE; | |
| 42 virtual const std::string& name() const OVERRIDE; | |
| 43 virtual bool is_connected() const OVERRIDE; | |
| 44 | |
| 45 // PepperTransportSocketAdapter implementation. | |
| 46 virtual void OnChannelDeleted() OVERRIDE; | |
| 47 virtual void OnChannelNewLocalCandidate( | |
| 48 const std::string& candidate) OVERRIDE; | |
| 49 | |
| 50 private: | |
| 51 void OnP2PConnect(int result); | |
| 52 void OnAuthenticationDone(net::Error error, | |
| 53 scoped_ptr<net::StreamSocket> socket); | |
| 54 | |
| 55 void NotifyConnected(scoped_ptr<net::StreamSocket> socket); | |
| 56 void NotifyConnectFailed(); | |
| 57 | |
| 58 PepperSession* session_; | |
| 59 std::string name_; | |
| 60 Session::StreamChannelCallback callback_; | |
| 61 scoped_ptr<ChannelAuthenticator> authenticator_; | |
| 62 | |
| 63 // We own |channel_| until it is connected. After that | |
| 64 // |authenticator_| owns it. | |
| 65 scoped_ptr<PepperTransportSocketAdapter> owned_channel_; | |
| 66 PepperTransportSocketAdapter* channel_; | |
| 67 | |
| 68 // Indicates that we've finished connecting. | |
| 69 bool connected_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(PepperStreamChannel); | |
| 72 }; | |
| 73 | |
| 74 } // namespace protocol | |
| 75 } // namespace remoting | |
| 76 | |
| 77 #endif // REMOTING_PROTOCOL_PEPPER_STREAM_CHANNEL_H_ | |
| OLD | NEW |