15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This class represents contextual information (cookies, cache, etc.)
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// that's useful when processing resource requests.
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The class is reference-counted so that it can be cleaned up after any
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// requests that are using it have been completed.
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <set>
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/ref_counted.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/weak_ptr.h"
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/threading/non_thread_safe.h"
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/net_export.h"
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/net_log.h"
220f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#include "net/base/request_priority.h"
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/http/http_network_session.h"
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/http/http_server_properties.h"
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/http/transport_security_state.h"
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/ssl/ssl_config_service.h"
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/url_request/url_request.h"
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net {
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CertVerifier;
315f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)class ChannelIDService;
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CookieStore;
33a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class CTVerifier;
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class FraudulentCertificateReporter;
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HostResolver;
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HttpAuthHandlerFactory;
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HttpTransactionFactory;
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HttpUserAgentSettings;
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class NetworkDelegate;
40f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)class SdchManager;
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProxyService;
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequest;
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequestJobFactory;
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequestThrottlerManager;
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Subclass to provide application-specific context for URLRequest
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// instances. Note that URLRequestContext typically does not provide storage for
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// these member variables, since they may be shared. For the ones that aren't
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// shared, URLRequestContextStorage can be helpful in defining their storage.
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class NET_EXPORT URLRequestContext
51eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    : NON_EXPORTED_BASE(public base::NonThreadSafe) {
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  URLRequestContext();
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~URLRequestContext();
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Copies the state from |other| into this context.
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CopyFrom(const URLRequestContext* other);
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // May return NULL if this context doesn't have an associated network session.
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const HttpNetworkSession::Params* GetNetworkSessionParams() const;
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  // Creates a URLRequest. If |cookie_store| is non-NULL, it will be used
6303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  // instead of the context's cookie store.
640f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  scoped_ptr<URLRequest> CreateRequest(const GURL& url,
650f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)                                       RequestPriority priority,
66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                       URLRequest::Delegate* delegate,
67a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                       CookieStore* cookie_store) const;
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NetLog* net_log() const {
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return net_log_;
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_net_log(NetLog* net_log) {
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    net_log_ = net_log;
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  HostResolver* host_resolver() const {
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return host_resolver_;
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_host_resolver(HostResolver* host_resolver) {
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    host_resolver_ = host_resolver;
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CertVerifier* cert_verifier() const {
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return cert_verifier_;
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_cert_verifier(CertVerifier* cert_verifier) {
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    cert_verifier_ = cert_verifier;
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
935f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  ChannelIDService* channel_id_service() const {
945f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    return channel_id_service_;
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
975f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void set_channel_id_service(
985f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      ChannelIDService* channel_id_service) {
995f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    channel_id_service_ = channel_id_service;
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  FraudulentCertificateReporter* fraudulent_certificate_reporter() const {
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return fraudulent_certificate_reporter_;
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_fraudulent_certificate_reporter(
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      FraudulentCertificateReporter* fraudulent_certificate_reporter) {
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    fraudulent_certificate_reporter_ = fraudulent_certificate_reporter;
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Get the proxy service for this context.
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ProxyService* proxy_service() const { return proxy_service_; }
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_proxy_service(ProxyService* proxy_service) {
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    proxy_service_ = proxy_service;
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Get the ssl config service for this context.
117868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  SSLConfigService* ssl_config_service() const {
118868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    return ssl_config_service_.get();
119868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  }
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_ssl_config_service(SSLConfigService* service) {
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ssl_config_service_ = service;
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Gets the HTTP Authentication Handler Factory for this context.
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The factory is only valid for the lifetime of this URLRequestContext
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  HttpAuthHandlerFactory* http_auth_handler_factory() const {
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return http_auth_handler_factory_;
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_http_auth_handler_factory(HttpAuthHandlerFactory* factory) {
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    http_auth_handler_factory_ = factory;
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Gets the http transaction factory for this context.
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  HttpTransactionFactory* http_transaction_factory() const {
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return http_transaction_factory_;
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_http_transaction_factory(HttpTransactionFactory* factory) {
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    http_transaction_factory_ = factory;
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_network_delegate(NetworkDelegate* network_delegate) {
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    network_delegate_ = network_delegate;
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NetworkDelegate* network_delegate() const { return network_delegate_; }
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_http_server_properties(
147ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch      const base::WeakPtr<HttpServerProperties>& http_server_properties) {
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    http_server_properties_ = http_server_properties;
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
150ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  base::WeakPtr<HttpServerProperties> http_server_properties() const {
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return http_server_properties_;
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Gets the cookie store for this context (may be null, in which case
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // cookies are not stored).
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CookieStore* cookie_store() const { return cookie_store_.get(); }
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_cookie_store(CookieStore* cookie_store);
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  TransportSecurityState* transport_security_state() const {
160a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    return transport_security_state_;
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_transport_security_state(
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      TransportSecurityState* state) {
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    transport_security_state_ = state;
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
167a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  CTVerifier* cert_transparency_verifier() const {
168a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    return cert_transparency_verifier_;
169a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  }
170a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  void set_cert_transparency_verifier(CTVerifier* verifier) {
171a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    cert_transparency_verifier_ = verifier;
172a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  }
173a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const URLRequestJobFactory* job_factory() const { return job_factory_; }
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_job_factory(const URLRequestJobFactory* job_factory) {
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    job_factory_ = job_factory;
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // May be NULL.
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  URLRequestThrottlerManager* throttler_manager() const {
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return throttler_manager_;
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_throttler_manager(URLRequestThrottlerManager* throttler_manager) {
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    throttler_manager_ = throttler_manager;
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
187f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  // May be NULL.
188f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  SdchManager* sdch_manager() const {
189f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    return sdch_manager_;
190f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  }
191f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  void set_sdch_manager(SdchManager* sdch_manager) {
192f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    sdch_manager_ = sdch_manager;
193f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  }
194f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Gets the URLRequest objects that hold a reference to this
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // URLRequestContext.
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  std::set<const URLRequest*>* url_requests() const {
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return url_requests_.get();
1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2015f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // CHECKs that no URLRequests using this context remain. Subclasses should
2025f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // additionally call AssertNoURLRequests() within their own destructor,
2035f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // prior to implicit destruction of subclass-owned state.
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void AssertNoURLRequests() const;
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Get the underlying |HttpUserAgentSettings| implementation that provides
2072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // the HTTP Accept-Language and User-Agent header values.
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const HttpUserAgentSettings* http_user_agent_settings() const {
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return http_user_agent_settings_;
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_http_user_agent_settings(
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      HttpUserAgentSettings* http_user_agent_settings) {
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    http_user_agent_settings_ = http_user_agent_settings;
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ---------------------------------------------------------------------------
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Important: When adding any new members below, consider whether they need to
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // be added to CopyFrom.
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ---------------------------------------------------------------------------
2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Ownership for these members are not defined here. Clients should either
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // provide storage elsewhere or have a subclass take ownership.
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NetLog* net_log_;
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  HostResolver* host_resolver_;
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CertVerifier* cert_verifier_;
2275f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  ChannelIDService* channel_id_service_;
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  FraudulentCertificateReporter* fraudulent_certificate_reporter_;
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  HttpAuthHandlerFactory* http_auth_handler_factory_;
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ProxyService* proxy_service_;
2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<SSLConfigService> ssl_config_service_;
2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NetworkDelegate* network_delegate_;
233ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  base::WeakPtr<HttpServerProperties> http_server_properties_;
2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  HttpUserAgentSettings* http_user_agent_settings_;
2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<CookieStore> cookie_store_;
2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  TransportSecurityState* transport_security_state_;
237a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  CTVerifier* cert_transparency_verifier_;
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  HttpTransactionFactory* http_transaction_factory_;
2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const URLRequestJobFactory* job_factory_;
2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  URLRequestThrottlerManager* throttler_manager_;
241f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  SdchManager* sdch_manager_;
2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ---------------------------------------------------------------------------
2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Important: When adding any new members below, consider whether they need to
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // be added to CopyFrom.
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ---------------------------------------------------------------------------
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<std::set<const URLRequest*> > url_requests_;
2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace net
2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
256