Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: content/renderer/p2p/p2p_transport_impl.h

Issue 7762008: Implement STUN support for P2P Transport API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/p2p/host_address_request.h ('k') | content/renderer/p2p/p2p_transport_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 #ifndef CONTENT_RENDERER_P2P_P2P_TRANSPORT_IMPL_H_ 5 #ifndef CONTENT_RENDERER_P2P_P2P_TRANSPORT_IMPL_H_
6 #define CONTENT_RENDERER_P2P_P2P_TRANSPORT_IMPL_H_ 6 #define CONTENT_RENDERER_P2P_P2P_TRANSPORT_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 15 matching lines...) Expand all
26 class PseudoTcpAdapter; 26 class PseudoTcpAdapter;
27 } // namespace jingle_glue 27 } // namespace jingle_glue
28 28
29 namespace talk_base { 29 namespace talk_base {
30 class NetworkManager; 30 class NetworkManager;
31 class PacketSocketFactory; 31 class PacketSocketFactory;
32 } // namespace talk_base 32 } // namespace talk_base
33 33
34 namespace content { 34 namespace content {
35 35
36 class P2PPortAllocator;
36 class P2PSocketDispatcher; 37 class P2PSocketDispatcher;
37 38
38 class P2PTransportImpl : public webkit_glue::P2PTransport, 39 class P2PTransportImpl : public webkit_glue::P2PTransport,
39 public sigslot::has_slots<> { 40 public sigslot::has_slots<> {
40 public: 41 public:
41 // Create P2PTransportImpl using specified NetworkManager and 42 // Creates P2PTransportImpl using specified NetworkManager and
42 // PacketSocketFactory. Takes ownership of |network_manager| and 43 // PacketSocketFactory. Takes ownership of |network_manager| and
43 // |socket_factory|. 44 // |socket_factory|. Provided to be used for tests only.
44 P2PTransportImpl(talk_base::NetworkManager* network_manager, 45 P2PTransportImpl(talk_base::NetworkManager* network_manager,
45 talk_base::PacketSocketFactory* socket_factory); 46 talk_base::PacketSocketFactory* socket_factory);
46 47
47 // Creates P2PTransportImpl using specified 48 // Creates P2PTransportImpl using specified
48 // P2PSocketDispatcher. This constructor creates IpcNetworkManager 49 // P2PSocketDispatcher. This constructor creates IpcNetworkManager
49 // and IpcPacketSocketFactory, and keeps ownership of these objects. 50 // and IpcPacketSocketFactory, and keeps ownership of these objects.
50 explicit P2PTransportImpl(P2PSocketDispatcher* socket_dispatcher); 51 explicit P2PTransportImpl(P2PSocketDispatcher* socket_dispatcher);
51 52
52 virtual ~P2PTransportImpl(); 53 virtual ~P2PTransportImpl();
53 54
54 // webkit_glue::P2PTransport interface. 55 // webkit_glue::P2PTransport interface.
55 virtual bool Init(const std::string& name, 56 virtual bool Init(const std::string& name,
56 Protocol protocol, 57 Protocol protocol,
57 const Config& config, 58 const Config& config,
58 EventHandler* event_handler) OVERRIDE; 59 EventHandler* event_handler) OVERRIDE;
59 virtual bool AddRemoteCandidate(const std::string& address) OVERRIDE; 60 virtual bool AddRemoteCandidate(const std::string& address) OVERRIDE;
60 virtual net::Socket* GetChannel() OVERRIDE; 61 virtual net::Socket* GetChannel() OVERRIDE;
61 62
62 private: 63 private:
63 class ChannelAdapter; 64 class ChannelAdapter;
64 65
65 void OnRequestSignaling(); 66 void OnRequestSignaling();
66 void OnCandidateReady(cricket::TransportChannelImpl* channel, 67 void OnCandidateReady(cricket::TransportChannelImpl* channel,
67 const cricket::Candidate& candidate); 68 const cricket::Candidate& candidate);
68 void OnReadableState(cricket::TransportChannel* channel); 69 void OnReadableState(cricket::TransportChannel* channel);
69 void OnWriteableState(cricket::TransportChannel* channel); 70 void OnWriteableState(cricket::TransportChannel* channel);
70 71
71 void OnTcpConnected(int result); 72 void OnTcpConnected(int result);
72 73
74 P2PSocketDispatcher* socket_dispatcher_;
73 std::string name_; 75 std::string name_;
74 EventHandler* event_handler_; 76 EventHandler* event_handler_;
75 State state_; 77 State state_;
76 78
77 scoped_ptr<talk_base::NetworkManager> network_manager_; 79 scoped_ptr<talk_base::NetworkManager> network_manager_;
78 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; 80 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_;
79 81
80 scoped_ptr<cricket::PortAllocator> allocator_; 82 scoped_ptr<cricket::PortAllocator> allocator_;
81 scoped_ptr<cricket::P2PTransportChannel> channel_; 83 scoped_ptr<cricket::P2PTransportChannel> channel_;
82 84
83 scoped_ptr<jingle_glue::TransportChannelSocketAdapter> channel_adapter_; 85 scoped_ptr<jingle_glue::TransportChannelSocketAdapter> channel_adapter_;
84 scoped_ptr<jingle_glue::PseudoTcpAdapter> pseudo_tcp_adapter_; 86 scoped_ptr<jingle_glue::PseudoTcpAdapter> pseudo_tcp_adapter_;
85 87
86 net::CompletionCallbackImpl<P2PTransportImpl> connect_callback_; 88 net::CompletionCallbackImpl<P2PTransportImpl> connect_callback_;
87 89
88 DISALLOW_COPY_AND_ASSIGN(P2PTransportImpl); 90 DISALLOW_COPY_AND_ASSIGN(P2PTransportImpl);
89 }; 91 };
90 92
91 } // namespace content 93 } // namespace content
92 94
93 #endif // CONTENT_RENDERER_P2P_P2P_TRANSPORT_IMPL_H_ 95 #endif // CONTENT_RENDERER_P2P_P2P_TRANSPORT_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/p2p/host_address_request.h ('k') | content/renderer/p2p/p2p_transport_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698