summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-08 02:33:53 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-08 02:33:53 +0000
commit305ed87d5bb35fbdde0240c3d0f801be47909453 (patch)
tree61810b2987d2c51a0ce169fcfa25144c489552a1 /remoting
parent176fe9ad192f383d92336af2e7721d6cf7b59a50 (diff)
downloadchromium_src-305ed87d5bb35fbdde0240c3d0f801be47909453.zip
chromium_src-305ed87d5bb35fbdde0240c3d0f801be47909453.tar.gz
chromium_src-305ed87d5bb35fbdde0240c3d0f801be47909453.tar.bz2
Switch to using URLRequestContextBuilder to create some contexts.
Also add missing functionality to URLRequestContextBuilder to fit their needs. This is intended to simplify code to initialize the network stack, and make it easier to refactor network stack initialization. BUG=388836 Review URL: https://codereview.chromium.org/354693004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281638 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/base/url_request_context_getter.cc (renamed from remoting/base/url_request_context.cc)61
-rw-r--r--remoting/base/url_request_context_getter.h (renamed from remoting/base/url_request_context.h)24
-rw-r--r--remoting/client/jni/chromoting_jni_runtime.cc2
-rw-r--r--remoting/host/chromoting_host_context.cc2
-rw-r--r--remoting/host/daemon_process.cc1
-rw-r--r--remoting/host/setup/host_starter.cc2
-rw-r--r--remoting/host/setup/host_starter.h6
-rw-r--r--remoting/host/setup/me2me_native_messaging_host_main.cc1
-rw-r--r--remoting/host/setup/oauth_client.cc2
-rw-r--r--remoting/host/setup/oauth_client.h7
-rw-r--r--remoting/host/setup/start_host.cc2
-rw-r--r--remoting/ios/bridge/client_instance.cc2
-rw-r--r--remoting/remoting_nacl.gyp2
-rw-r--r--remoting/remoting_srcs.gypi4
14 files changed, 35 insertions, 83 deletions
diff --git a/remoting/base/url_request_context.cc b/remoting/base/url_request_context_getter.cc
index 39985ab..b07ccf9 100644
--- a/remoting/base/url_request_context.cc
+++ b/remoting/base/url_request_context_getter.cc
@@ -1,21 +1,12 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 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/base/url_request_context.h"
+#include "remoting/base/url_request_context_getter.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 "net/url_request/url_request_job_factory_impl.h"
+#include "net/url_request/url_request_context_builder.h"
#include "remoting/base/vlog_net_log.h"
#if defined(OS_WIN)
@@ -78,45 +69,6 @@ net::ProxyConfigService* CreateSystemProxyConfigService(
} // 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(
- scoped_ptr<net::HttpServerProperties>(
- new net::HttpServerPropertiesImpl()));
- storage_.set_transport_security_state(new net::TransportSecurityState);
- storage_.set_job_factory(new net::URLRequestJobFactoryImpl());
-
- 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> network_task_runner)
: network_task_runner_(network_task_runner) {
@@ -126,8 +78,11 @@ URLRequestContextGetter::URLRequestContextGetter(
net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
if (!url_request_context_.get()) {
- url_request_context_.reset(
- new URLRequestContext(proxy_config_service_.Pass()));
+ net::URLRequestContextBuilder builder;
+ builder.set_net_log(new VlogNetLog());
+ builder.DisableHttpCache();
+ builder.set_proxy_config_service(proxy_config_service_.release());
+ url_request_context_.reset(builder.Build());
}
return url_request_context_.get();
}
diff --git a/remoting/base/url_request_context.h b/remoting/base/url_request_context_getter.h
index 6ce2d572..13de06a 100644
--- a/remoting/base/url_request_context.h
+++ b/remoting/base/url_request_context_getter.h
@@ -1,9 +1,9 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 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_BASE_URL_REQUEST_CONTEXT_H_
-#define REMOTING_BASE_URL_REQUEST_CONTEXT_H_
+#ifndef REMOTING_BASE_URL_REQUEST_CONTEXT_GETTER_H_
+#define REMOTING_BASE_URL_REQUEST_CONTEXT_GETTER_H_
#include <string>
@@ -21,22 +21,6 @@ class MessageLoopProxy;
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(
@@ -60,4 +44,4 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
} // namespace remoting
-#endif // REMOTING_BASE_URL_REQUEST_CONTEXT_H_
+#endif // REMOTING_BASE_URL_REQUEST_CONTEXT_GETTER_H_
diff --git a/remoting/client/jni/chromoting_jni_runtime.cc b/remoting/client/jni/chromoting_jni_runtime.cc
index f7a3ff1..c271973 100644
--- a/remoting/client/jni/chromoting_jni_runtime.cc
+++ b/remoting/client/jni/chromoting_jni_runtime.cc
@@ -16,7 +16,7 @@
#include "google_apis/google_api_keys.h"
#include "jni/JniInterface_jni.h"
#include "media/base/yuv_convert.h"
-#include "remoting/base/url_request_context.h"
+#include "remoting/base/url_request_context_getter.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
using base::android::ConvertJavaStringToUTF8;
diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc
index 350404b..0145f99 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/base/url_request_context.h"
+#include "remoting/base/url_request_context_getter.h"
namespace remoting {
diff --git a/remoting/host/daemon_process.cc b/remoting/host/daemon_process.cc
index 9d4ae11..360bb1a 100644
--- a/remoting/host/daemon_process.cc
+++ b/remoting/host/daemon_process.cc
@@ -16,7 +16,6 @@
#include "base/single_thread_task_runner.h"
#include "net/base/net_util.h"
#include "remoting/base/auto_thread_task_runner.h"
-#include "remoting/base/url_request_context.h"
#include "remoting/host/branding.h"
#include "remoting/host/chromoting_messages.h"
#include "remoting/host/config_file_watcher.h"
diff --git a/remoting/host/setup/host_starter.cc b/remoting/host/setup/host_starter.cc
index 298be8e..1246777 100644
--- a/remoting/host/setup/host_starter.cc
+++ b/remoting/host/setup/host_starter.cc
@@ -4,7 +4,9 @@
#include "remoting/host/setup/host_starter.h"
+#include "base/bind.h"
#include "base/guid.h"
+#include "base/location.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "google_apis/google_api_keys.h"
diff --git a/remoting/host/setup/host_starter.h b/remoting/host/setup/host_starter.h
index 60a28acb..1570315 100644
--- a/remoting/host/setup/host_starter.h
+++ b/remoting/host/setup/host_starter.h
@@ -9,12 +9,16 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.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/setup/daemon_controller.h"
#include "remoting/host/setup/service_client.h"
+namespace net {
+class URLRequestContextGetter;
+}
+
namespace remoting {
// A helper class that registers and starts a host.
diff --git a/remoting/host/setup/me2me_native_messaging_host_main.cc b/remoting/host/setup/me2me_native_messaging_host_main.cc
index e47b244..5309879 100644
--- a/remoting/host/setup/me2me_native_messaging_host_main.cc
+++ b/remoting/host/setup/me2me_native_messaging_host_main.cc
@@ -12,6 +12,7 @@
#include "base/strings/string_number_conversions.h"
#include "net/url_request/url_fetcher.h"
#include "remoting/base/breakpad.h"
+#include "remoting/base/url_request_context_getter.h"
#include "remoting/host/host_exit_codes.h"
#include "remoting/host/logging.h"
#include "remoting/host/pairing_registry_delegate.h"
diff --git a/remoting/host/setup/oauth_client.cc b/remoting/host/setup/oauth_client.cc
index 9de0723..74a6bfe 100644
--- a/remoting/host/setup/oauth_client.cc
+++ b/remoting/host/setup/oauth_client.cc
@@ -4,6 +4,8 @@
#include "remoting/host/setup/oauth_client.h"
+#include "base/logging.h"
+
namespace {
const int kMaxGaiaRetries = 3;
} // namespace
diff --git a/remoting/host/setup/oauth_client.h b/remoting/host/setup/oauth_client.h
index 2fdcbfe..54bd48ce 100644
--- a/remoting/host/setup/oauth_client.h
+++ b/remoting/host/setup/oauth_client.h
@@ -9,8 +9,13 @@
#include <string>
#include "base/callback.h"
+#include "base/memory/ref_counted.h"
#include "google_apis/gaia/gaia_oauth_client.h"
-#include "remoting/base/url_request_context.h"
+#include "net/url_request/url_request_context_getter.h"
+
+namespace net {
+class URLRequestContext;
+}
namespace remoting {
diff --git a/remoting/host/setup/start_host.cc b/remoting/host/setup/start_host.cc
index 3331eb4..9958041 100644
--- a/remoting/host/setup/start_host.cc
+++ b/remoting/host/setup/start_host.cc
@@ -13,7 +13,7 @@
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_context_getter.h"
#include "remoting/base/service_urls.h"
-#include "remoting/base/url_request_context.h"
+#include "remoting/base/url_request_context_getter.h"
#include "remoting/host/setup/host_starter.h"
#include "remoting/host/setup/oauth_helper.h"
#include "remoting/host/setup/pin_validator.h"
diff --git a/remoting/ios/bridge/client_instance.cc b/remoting/ios/bridge/client_instance.cc
index 6066f95..45f0b3fc 100644
--- a/remoting/ios/bridge/client_instance.cc
+++ b/remoting/ios/bridge/client_instance.cc
@@ -8,7 +8,7 @@
#include "base/logging.h"
#include "base/synchronization/waitable_event.h"
#include "net/socket/client_socket_factory.h"
-#include "remoting/base/url_request_context.h"
+#include "remoting/base/url_request_context_getter.h"
#include "remoting/client/audio_player.h"
#include "remoting/client/plugin/delegating_signal_strategy.h"
#include "remoting/ios/bridge/client_proxy.h"
diff --git a/remoting/remoting_nacl.gyp b/remoting/remoting_nacl.gyp
index 81dc8da..0337491 100644
--- a/remoting/remoting_nacl.gyp
+++ b/remoting/remoting_nacl.gyp
@@ -121,7 +121,7 @@
'<@(remoting_protocol_sources)',
],
'sources!': [
- 'base/url_request_context.cc',
+ 'base/url_request_context_getter.cc',
'jingle_glue/chromium_socket_factory.cc',
],
diff --git a/remoting/remoting_srcs.gypi b/remoting/remoting_srcs.gypi
index 648f847..489f98c 100644
--- a/remoting/remoting_srcs.gypi
+++ b/remoting/remoting_srcs.gypi
@@ -35,8 +35,8 @@
'base/socket_reader.cc',
'base/socket_reader.h',
'base/typed_buffer.h',
- 'base/url_request_context.cc',
- 'base/url_request_context.h',
+ 'base/url_request_context_getter.cc',
+ 'base/url_request_context_getter.h',
'base/util.cc',
'base/util.h',
'base/vlog_net_log.cc',