Chromium Code Reviews| 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 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ |
| 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ | 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ppapi/cpp/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
| 11 #include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" | 11 #include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 | 14 |
| 15 // An implementation of cricket::PortAllocator for libjingle that is | 15 // An implementation of cricket::PortAllocator for libjingle that is |
| 16 // used by the client plugin. The main difference from | 16 // used by the client plugin. There are two differences from |
| 17 // cricket::HttpPortAllocator is that it uses Pepper URLLoader API | 17 // cricket::HttpPortAllocator: |
| 18 // when creating relay sessions. | 18 // * PepperPortAllocator uses Pepper URLLoader API when creating |
| 19 // relay sessions. | |
| 20 // * PepperPortAllocator resolves STUN IP addresses before passing | |
|
Wez
2012/05/15 23:11:29
nit: Presumably it resolves STUN host DNS names, n
Sergey Ulanov
2012/05/16 00:22:30
Done.
| |
| 21 // them to BasicPortAllocator (it uses HostResolverPrivate API for that). | |
| 22 // This is needed because libjingle's DNS resolution code doesn't work | |
| 23 // in sandbox. | |
| 19 class PepperPortAllocator : public cricket::HttpPortAllocatorBase { | 24 class PepperPortAllocator : public cricket::HttpPortAllocatorBase { |
| 20 public: | 25 public: |
| 21 static scoped_ptr<PepperPortAllocator> Create( | 26 static scoped_ptr<PepperPortAllocator> Create( |
| 22 const pp::InstanceHandle& instance); | 27 const pp::InstanceHandle& instance); |
| 23 virtual ~PepperPortAllocator(); | 28 virtual ~PepperPortAllocator(); |
| 24 | 29 |
| 25 // cricket::HttpPortAllocatorBase overrides. | 30 // cricket::HttpPortAllocatorBase overrides. |
| 26 virtual cricket::PortAllocatorSession* CreateSession( | 31 virtual cricket::PortAllocatorSession* CreateSession( |
| 27 const std::string& channel_name, | 32 const std::string& channel_name, |
| 28 int component) OVERRIDE; | 33 int component) OVERRIDE; |
| 29 | 34 |
| 30 private: | 35 private: |
| 31 PepperPortAllocator( | 36 PepperPortAllocator( |
| 32 const pp::InstanceHandle& instance, | 37 const pp::InstanceHandle& instance, |
| 33 scoped_ptr<talk_base::NetworkManager> network_manager, | 38 scoped_ptr<talk_base::NetworkManager> network_manager, |
| 34 scoped_ptr<talk_base::PacketSocketFactory> socket_factory); | 39 scoped_ptr<talk_base::PacketSocketFactory> socket_factory); |
| 35 | 40 |
| 36 pp::InstanceHandle instance_; | 41 pp::InstanceHandle instance_; |
| 37 scoped_ptr<talk_base::NetworkManager> network_manager_; | 42 scoped_ptr<talk_base::NetworkManager> network_manager_; |
| 38 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; | 43 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; |
| 39 | 44 |
| 40 DISALLOW_COPY_AND_ASSIGN(PepperPortAllocator); | 45 DISALLOW_COPY_AND_ASSIGN(PepperPortAllocator); |
| 41 }; | 46 }; |
| 42 | 47 |
| 43 } // namespace remoting | 48 } // namespace remoting |
| 44 | 49 |
| 45 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ | 50 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ |
| OLD | NEW |