Commit a8742f45 authored by sergeyu's avatar sergeyu Committed by Commit bot
Browse files

Move ChromiumPortAllocatorFactory to remoting/protocol

BUG=547158

Review URL: https://codereview.chromium.org/1419783013

Cr-Commit-Position: refs/heads/master@{#358751}
parent a18267b4
......@@ -11,9 +11,9 @@
#include "base/synchronization/waitable_event.h"
#include "net/url_request/url_request_context_getter.h"
#include "remoting/host/cast_video_capturer_adapter.h"
#include "remoting/host/chromium_port_allocator_factory.h"
#include "remoting/host/client_session.h"
#include "remoting/proto/control.pb.h"
#include "remoting/protocol/chromium_port_allocator_factory.h"
#include "remoting/protocol/client_stub.h"
#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
#include "third_party/libjingle/source/talk/app/webrtc/test/fakeconstraints.h"
......@@ -498,7 +498,7 @@ bool CastExtensionSession::InitializePeerConnection() {
webrtc::MediaConstraintsInterface::kValueTrue);
rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
port_allocator_factory = ChromiumPortAllocatorFactory::Create(
port_allocator_factory = protocol::ChromiumPortAllocatorFactory::Create(
network_settings_, url_request_context_getter_);
peer_connection_ = peer_conn_factory_->CreatePeerConnection(
......
......@@ -32,6 +32,7 @@ source_set("protocol") {
if (is_nacl) {
sources -= [
"chromium_port_allocator.cc",
"chromium_port_allocator_factory.cc",
"chromium_socket_factory.cc",
]
}
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Copyright 2015 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.
#include "remoting/host/chromium_port_allocator_factory.h"
#include "remoting/protocol/chromium_port_allocator_factory.h"
#include "base/logging.h"
#include "net/url_request/url_request_context_getter.h"
......@@ -10,19 +10,19 @@
#include "remoting/protocol/network_settings.h"
namespace remoting {
namespace protocol {
ChromiumPortAllocatorFactory::ChromiumPortAllocatorFactory(
const protocol::NetworkSettings& network_settings,
const NetworkSettings& network_settings,
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter)
: network_settings_(network_settings),
url_request_context_getter_(url_request_context_getter) {
}
url_request_context_getter_(url_request_context_getter) {}
ChromiumPortAllocatorFactory::~ChromiumPortAllocatorFactory() {}
rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
ChromiumPortAllocatorFactory::Create(
const protocol::NetworkSettings& network_settings,
const NetworkSettings& network_settings,
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) {
rtc::RefCountedObject<ChromiumPortAllocatorFactory>* allocator_factory =
new rtc::RefCountedObject<ChromiumPortAllocatorFactory>(
......@@ -33,13 +33,12 @@ ChromiumPortAllocatorFactory::Create(
cricket::PortAllocator* ChromiumPortAllocatorFactory::CreatePortAllocator(
const std::vector<StunConfiguration>& stun_servers,
const std::vector<TurnConfiguration>& turn_configurations) {
scoped_ptr<protocol::ChromiumPortAllocator> port_allocator(
protocol::ChromiumPortAllocator::Create(url_request_context_getter_,
scoped_ptr<ChromiumPortAllocator> port_allocator(
ChromiumPortAllocator::Create(url_request_context_getter_,
network_settings_));
std::vector<rtc::SocketAddress> stun_hosts;
typedef std::vector<StunConfiguration>::const_iterator StunIt;
for (StunIt stun_it = stun_servers.begin(); stun_it != stun_servers.end();
for (auto stun_it = stun_servers.begin(); stun_it != stun_servers.end();
++stun_it) {
stun_hosts.push_back(stun_it->server);
}
......@@ -51,5 +50,6 @@ cricket::PortAllocator* ChromiumPortAllocatorFactory::CreatePortAllocator(
return port_allocator.release();
}
} // namespace protocol
} // namespace remoting
// Copyright 2014 The Chromium Authors. All rights reserved.
// Copyright 2015 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_HOST_CHROMIUM_PORT_ALLOCATOR_FACTORY_H_
#define REMOTING_HOST_CHROMIUM_PORT_ALLOCATOR_FACTORY_H_
#ifndef REMOTING_PROTOCOL_CHROMIUM_PORT_ALLOCATOR_FACTORY_H_
#define REMOTING_PROTOCOL_CHROMIUM_PORT_ALLOCATOR_FACTORY_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "remoting/protocol/network_settings.h"
#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h"
namespace net {
......@@ -13,16 +15,13 @@ class URLRequestContextGetter;
} // namespace net
namespace remoting {
namespace protocol {
struct NetworkSettings;
} // namespace protocol
class ChromiumPortAllocatorFactory
: public webrtc::PortAllocatorFactoryInterface {
public:
static rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> Create(
const protocol::NetworkSettings& network_settings,
const NetworkSettings& network_settings,
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter);
// webrtc::PortAllocatorFactoryInterface implementation.
......@@ -32,18 +31,19 @@ class ChromiumPortAllocatorFactory
protected:
ChromiumPortAllocatorFactory(
const protocol::NetworkSettings& network_settings,
const NetworkSettings& network_settings,
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter);
~ChromiumPortAllocatorFactory() override;
private:
const protocol::NetworkSettings& network_settings_;
NetworkSettings network_settings_;
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
DISALLOW_COPY_AND_ASSIGN(ChromiumPortAllocatorFactory);
};
} // namespace protocol
} // namespace remoting
#endif // REMOTING_HOST_CHROMIUM_PORT_ALLOCATOR_FACTORY_H_
#endif // REMOTING_PROTOCOL_CHROMIUM_PORT_ALLOCATOR_FACTORY_H_
......@@ -36,8 +36,6 @@
'host/chromeos/point_transformer.h',
'host/chromeos/skia_bitmap_desktop_frame.cc',
'host/chromeos/skia_bitmap_desktop_frame.h',
'host/chromium_port_allocator_factory.cc',
'host/chromium_port_allocator_factory.h',
'host/chromoting_host.cc',
'host/chromoting_host.h',
'host/chromoting_host_context.cc',
......
......@@ -124,6 +124,7 @@
'sources!': [
'base/url_request_context_getter.cc',
'protocol/chromium_socket_factory.cc',
'protocol/chromium_port_allocator_factory.cc',
],
# Include normalizing_input_filter_*.cc excluded by the filename
......
......@@ -88,6 +88,8 @@
'protocol/channel_socket_adapter.h',
'protocol/chromium_port_allocator.cc',
'protocol/chromium_port_allocator.h',
'protocol/chromium_port_allocator_factory.cc',
'protocol/chromium_port_allocator_factory.h',
'protocol/chromium_socket_factory.cc',
'protocol/chromium_socket_factory.h',
'protocol/client_control_dispatcher.cc',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment