summaryrefslogtreecommitdiffstats
path: root/remoting/host
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/host')
-rw-r--r--remoting/host/chromoting_host_context.cc2
-rw-r--r--remoting/host/setup/host_starter.h2
-rw-r--r--remoting/host/setup/start_host.cc2
-rw-r--r--remoting/host/setup/win/host_configurer.cc2
-rw-r--r--remoting/host/url_request_context.cc139
-rw-r--r--remoting/host/url_request_context.h64
-rw-r--r--remoting/host/vlog_net_log.cc52
-rw-r--r--remoting/host/vlog_net_log.h32
8 files changed, 4 insertions, 291 deletions
diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc
index 0d51f85..aa3146c 100644
--- a/remoting/host/chromoting_host_context.cc
+++ b/remoting/host/chromoting_host_context.cc
@@ -8,7 +8,7 @@
#include "base/bind.h"
#include "remoting/base/auto_thread.h"
-#include "remoting/host/url_request_context.h"
+#include "remoting/base/url_request_context.h"
namespace remoting {
diff --git a/remoting/host/setup/host_starter.h b/remoting/host/setup/host_starter.h
index 1d3b97f..606ef4b 100644
--- a/remoting/host/setup/host_starter.h
+++ b/remoting/host/setup/host_starter.h
@@ -10,9 +10,9 @@
#include "base/callback.h"
#include "google_apis/gaia/gaia_oauth_client.h"
#include "remoting/base/rsa_key_pair.h"
+#include "remoting/base/url_request_context.h"
#include "remoting/host/service_client.h"
#include "remoting/host/setup/daemon_controller.h"
-#include "remoting/host/url_request_context.h"
namespace remoting {
diff --git a/remoting/host/setup/start_host.cc b/remoting/host/setup/start_host.cc
index fc2390d..ac50a76 100644
--- a/remoting/host/setup/start_host.cc
+++ b/remoting/host/setup/start_host.cc
@@ -12,11 +12,11 @@
#include "base/threading/thread.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_context_getter.h"
+#include "remoting/base/url_request_context.h"
#include "remoting/host/service_urls.h"
#include "remoting/host/setup/host_starter.h"
#include "remoting/host/setup/oauth_helper.h"
#include "remoting/host/setup/pin_validator.h"
-#include "remoting/host/url_request_context.h"
// A simple command-line app that registers and starts a host.
diff --git a/remoting/host/setup/win/host_configurer.cc b/remoting/host/setup/win/host_configurer.cc
index c0d7d19..bf5b8a6 100644
--- a/remoting/host/setup/win/host_configurer.cc
+++ b/remoting/host/setup/win/host_configurer.cc
@@ -10,8 +10,8 @@
#include "base/command_line.h"
#include "base/run_loop.h"
#include "base/threading/thread.h"
+#include "remoting/base/url_request_context.h"
#include "remoting/host/setup/win/host_configurer_window.h"
-#include "remoting/host/url_request_context.h"
class HostConfigurerModule
: public ATL::CAtlExeModuleT<HostConfigurerModule> {
diff --git a/remoting/host/url_request_context.cc b/remoting/host/url_request_context.cc
deleted file mode 100644
index aec661f..0000000
--- a/remoting/host/url_request_context.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-// 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.
-
-#include "remoting/host/url_request_context.h"
-
-#include "base/message_loop/message_loop_proxy.h"
-#include "net/cert/cert_verifier.h"
-#include "net/dns/host_resolver.h"
-#include "net/http/http_auth_handler_factory.h"
-#include "net/http/http_network_layer.h"
-#include "net/http/http_network_session.h"
-#include "net/http/http_server_properties_impl.h"
-#include "net/http/transport_security_state.h"
-#include "net/proxy/proxy_config_service.h"
-#include "net/proxy/proxy_service.h"
-#include "net/ssl/ssl_config_service_defaults.h"
-#include "remoting/host/vlog_net_log.h"
-
-#if defined(OS_WIN)
-#include "net/proxy/proxy_config_service_win.h"
-#elif defined(OS_MACOSX)
-#include "net/proxy/proxy_config_service_mac.h"
-#elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
-#include "net/proxy/proxy_config_service_linux.h"
-#endif
-
-namespace remoting {
-
-namespace {
-
-// Config getter that always returns direct settings.
-class ProxyConfigServiceDirect : public net::ProxyConfigService {
- public:
- // ProxyConfigService implementation:
- virtual void AddObserver(Observer* observer) OVERRIDE {}
- virtual void RemoveObserver(Observer* observer) OVERRIDE {}
- virtual ConfigAvailability GetLatestProxyConfig(
- net::ProxyConfig* config) OVERRIDE {
- *config = net::ProxyConfig::CreateDirect();
- return CONFIG_VALID;
- }
-};
-
-net::ProxyConfigService* CreateSystemProxyConfigService(
- base::SingleThreadTaskRunner* ui_task_runner,
- base::SingleThreadTaskRunner* io_thread_task_runner) {
- DCHECK(ui_task_runner->BelongsToCurrentThread());
-
-#if defined(OS_WIN)
- return new net::ProxyConfigServiceWin();
-#elif defined(OS_MACOSX)
- return new net::ProxyConfigServiceMac(io_thread_task_runner);
-#elif defined(OS_CHROMEOS)
- NOTREACHED() << "ChromeOS is not a supported target for Chromoting host";
- return NULL;
-#elif defined(OS_LINUX)
- // TODO(sergeyu): Currently ProxyConfigServiceLinux depends on
- // base::OneShotTimer that doesn't work properly on main NPAPI
- // thread. Fix that and uncomment the code below.
- //
- // net::ProxyConfigServiceLinux* linux_config_service =
- // new net::ProxyConfigServiceLinux();
- // linux_config_service->SetupAndFetchInitialConfig(
- // ui_message_loop_, io_message_loop->message_loop_proxy(),
- // file_message_loop);
-
- // return linux_config_service;
- return new ProxyConfigServiceDirect();
-#else
- LOG(WARNING) << "Failed to choose a system proxy settings fetcher "
- "for this platform.";
- return new ProxyConfigServiceDirect();
-#endif
-}
-
-} // namespace
-
-// TODO(willchan): This is largely copied from service_url_request_context.cc,
-// which is in turn copied from some test code. Move it somewhere reusable.
-URLRequestContext::URLRequestContext(
- scoped_ptr<net::ProxyConfigService> proxy_config_service)
- : storage_(this) {
- scoped_ptr<VlogNetLog> net_log(new VlogNetLog());
- storage_.set_host_resolver(
- net::HostResolver::CreateDefaultResolver(net_log.get()));
- storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver(
- proxy_config_service.release(), 0u, net_log.get()));
- storage_.set_cert_verifier(net::CertVerifier::CreateDefault());
- storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults);
- storage_.set_http_auth_handler_factory(
- net::HttpAuthHandlerFactory::CreateDefault(host_resolver()));
- storage_.set_http_server_properties(new net::HttpServerPropertiesImpl);
- storage_.set_transport_security_state(new net::TransportSecurityState);
-
- net::HttpNetworkSession::Params session_params;
- session_params.host_resolver = host_resolver();
- session_params.cert_verifier = cert_verifier();
- session_params.transport_security_state = transport_security_state();
- session_params.proxy_service = proxy_service();
- session_params.ssl_config_service = ssl_config_service();
- session_params.http_auth_handler_factory = http_auth_handler_factory();
- session_params.http_server_properties = http_server_properties();
- session_params.net_log = net_log.get();
- scoped_refptr<net::HttpNetworkSession> network_session(
- new net::HttpNetworkSession(session_params));
- storage_.set_http_transaction_factory(
- new net::HttpNetworkLayer(network_session.get()));
- storage_.set_net_log(net_log.release());
-}
-
-URLRequestContext::~URLRequestContext() {
-}
-
-URLRequestContextGetter::URLRequestContextGetter(
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner)
- : network_task_runner_(network_task_runner) {
- proxy_config_service_.reset(CreateSystemProxyConfigService(
- ui_task_runner.get(), network_task_runner_.get()));
-}
-
-net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
- if (!url_request_context_.get()) {
- url_request_context_.reset(
- new URLRequestContext(proxy_config_service_.Pass()));
- }
- return url_request_context_.get();
-}
-
-scoped_refptr<base::SingleThreadTaskRunner>
-URLRequestContextGetter::GetNetworkTaskRunner() const {
- return network_task_runner_;
-}
-
-URLRequestContextGetter::~URLRequestContextGetter() {
-}
-
-} // namespace remoting
diff --git a/remoting/host/url_request_context.h b/remoting/host/url_request_context.h
deleted file mode 100644
index 5260247..0000000
--- a/remoting/host/url_request_context.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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_HOST_URL_REQUEST_CONTEXT_H_
-#define REMOTING_HOST_URL_REQUEST_CONTEXT_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop.h"
-#include "net/proxy/proxy_config_service.h"
-#include "net/url_request/url_request_context.h"
-#include "net/url_request/url_request_context_getter.h"
-#include "net/url_request/url_request_context_storage.h"
-
-namespace base {
-class MessageLoopProxy;
-} // namespace base
-
-namespace remoting {
-
-// Subclass of net::URLRequestContext which can be used to store extra
-// information for requests. This subclass is meant to be used in the
-// remoting Me2Me host process where the profile is not available.
-class URLRequestContext : public net::URLRequestContext {
- public:
- explicit URLRequestContext(
- scoped_ptr<net::ProxyConfigService> proxy_config_service);
-
- private:
- virtual ~URLRequestContext();
-
- net::URLRequestContextStorage storage_;
-
- DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
-};
-
-class URLRequestContextGetter : public net::URLRequestContextGetter {
- public:
- URLRequestContextGetter(
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner);
-
- // Overridden from net::URLRequestContextGetter:
- virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
- virtual scoped_refptr<base::SingleThreadTaskRunner>
- GetNetworkTaskRunner() const OVERRIDE;
-
- protected:
- virtual ~URLRequestContextGetter();
-
- private:
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
- scoped_ptr<net::ProxyConfigService> proxy_config_service_;
- scoped_ptr<net::URLRequestContext> url_request_context_;
-
- DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter);
-};
-
-} // namespace remoting
-
-#endif // REMOTING_HOST_URL_REQUEST_CONTEXT_H_
diff --git a/remoting/host/vlog_net_log.cc b/remoting/host/vlog_net_log.cc
deleted file mode 100644
index 583c075..0000000
--- a/remoting/host/vlog_net_log.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-// 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.
-
-#include "remoting/host/vlog_net_log.h"
-
-#include "base/json/json_writer.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/threading/thread_restrictions.h"
-#include "base/time/time.h"
-#include "base/values.h"
-
-namespace remoting {
-
-class VlogNetLog::Observer : public net::NetLog::ThreadSafeObserver {
- public:
- Observer();
- virtual ~Observer();
-
- // NetLog::ThreadSafeObserver overrides:
- virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Observer);
-};
-
-VlogNetLog::Observer::Observer() {
-}
-
-VlogNetLog::Observer::~Observer() {
-}
-
-void VlogNetLog::Observer::OnAddEntry(const net::NetLog::Entry& entry) {
- if (VLOG_IS_ON(4)) {
- scoped_ptr<Value> value(entry.ToValue());
- std::string json;
- base::JSONWriter::Write(value.get(), &json);
- VLOG(4) << json;
- }
-}
-
-VlogNetLog::VlogNetLog()
- : observer_(new Observer()) {
- AddThreadSafeObserver(observer_.get(), LOG_ALL_BUT_BYTES);
-}
-
-VlogNetLog::~VlogNetLog() {
- RemoveThreadSafeObserver(observer_.get());
-}
-
-} // namespace remoting
diff --git a/remoting/host/vlog_net_log.h b/remoting/host/vlog_net_log.h
deleted file mode 100644
index 393ab1c..0000000
--- a/remoting/host/vlog_net_log.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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_HOST_VLOG_NET_LOG_H_
-#define REMOTING_HOST_VLOG_NET_LOG_H_
-
-#include "base/memory/scoped_handle.h"
-#include "base/memory/scoped_ptr.h"
-#include "net/base/net_log.h"
-
-namespace remoting {
-
-// Redirectes all networking events (i.e. events logged through net::NetLog) to
-// VLOG(4). Note that an explicit reference to a net::NetLog object has to be
-// passed to networking classes to receive the events. There is no global
-// network events logger exists.
-class VlogNetLog : public net::NetLog {
- public:
- VlogNetLog();
- virtual ~VlogNetLog();
-
- private:
- class Observer;
- scoped_ptr<Observer> observer_;
-
- DISALLOW_COPY_AND_ASSIGN(VlogNetLog);
-};
-
-} // namespace remoting
-
-#endif // REMOTING_HOST_VLOG_NET_LOG_H_