blob: 19fb03d5cef362fb00224f1c8c2329994f19d61b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_
#define REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "ppapi/cpp/instance_handle.h"
#include "remoting/protocol/port_allocator_base.h"
#include "remoting/protocol/port_allocator_factory.h"
namespace remoting {
// An implementation of cricket::PortAllocator for libjingle that is used by the
// client plugin. It uses Pepper URLLoader API when creating relay sessions.
class PepperPortAllocator : public protocol::PortAllocatorBase {
public:
static scoped_ptr<PepperPortAllocator> Create(
const pp::InstanceHandle& instance);
~PepperPortAllocator() override;
// PortAllocatorBase overrides.
cricket::PortAllocatorSession* CreateSessionInternal(
const std::string& content_name,
int component,
const std::string& ice_username_fragment,
const std::string& ice_password) override;
private:
PepperPortAllocator(
const pp::InstanceHandle& instance,
scoped_ptr<rtc::NetworkManager> network_manager,
scoped_ptr<rtc::PacketSocketFactory> socket_factory);
pp::InstanceHandle instance_;
scoped_ptr<rtc::NetworkManager> network_manager_;
scoped_ptr<rtc::PacketSocketFactory> socket_factory_;
DISALLOW_COPY_AND_ASSIGN(PepperPortAllocator);
};
class PepperPortAllocatorFactory : public protocol::PortAllocatorFactory {
public:
PepperPortAllocatorFactory(const pp::InstanceHandle& instance);
~PepperPortAllocatorFactory() override;
// PortAllocatorFactory interface.
scoped_ptr<protocol::PortAllocatorBase> CreatePortAllocator() override;
private:
pp::InstanceHandle instance_;
DISALLOW_COPY_AND_ASSIGN(PepperPortAllocatorFactory);
};
} // namespace remoting
#endif // REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_
|