OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ | |
6 #define REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "ppapi/cpp/instance_handle.h" | |
12 #include "remoting/protocol/port_allocator_base.h" | |
13 #include "remoting/protocol/port_allocator_factory.h" | |
14 | |
15 namespace remoting { | |
16 | |
17 // An implementation of cricket::PortAllocator for libjingle that is used by the | |
18 // client plugin. It uses Pepper URLLoader API when creating relay sessions. | |
19 class PepperPortAllocator : public protocol::PortAllocatorBase { | |
20 public: | |
21 PepperPortAllocator( | |
22 scoped_refptr<protocol::TransportContext> transport_context, | |
23 pp::InstanceHandle pp_instance); | |
24 ~PepperPortAllocator() override; | |
25 | |
26 pp::InstanceHandle pp_instance() { return pp_instance_; } | |
27 | |
28 // PortAllocatorBase overrides. | |
29 cricket::PortAllocatorSession* CreateSessionInternal( | |
30 const std::string& content_name, | |
31 int component, | |
32 const std::string& ice_username_fragment, | |
33 const std::string& ice_password) override; | |
34 | |
35 private: | |
36 pp::InstanceHandle pp_instance_; | |
37 scoped_ptr<rtc::NetworkManager> network_manager_; | |
38 scoped_ptr<rtc::PacketSocketFactory> socket_factory_; | |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(PepperPortAllocator); | |
41 }; | |
42 | |
43 class PepperPortAllocatorFactory : public protocol::PortAllocatorFactory { | |
44 public: | |
45 PepperPortAllocatorFactory(pp::InstanceHandle pp_instance); | |
46 ~PepperPortAllocatorFactory() override; | |
47 | |
48 // PortAllocatorFactory interface. | |
49 scoped_ptr<cricket::PortAllocator> CreatePortAllocator( | |
50 scoped_refptr<protocol::TransportContext> transport_context) override; | |
51 | |
52 private: | |
53 pp::InstanceHandle pp_instance_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(PepperPortAllocatorFactory); | |
56 }; | |
57 | |
58 } // namespace remoting | |
59 | |
60 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ | |
OLD | NEW |