 Chromium Code Reviews
 Chromium Code Reviews Issue 1175733002:
  [Cronet] Set up HttpServerPropertiesManager  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1175733002:
  [Cronet] Set up HttpServerPropertiesManager  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 // This class is useful for building a simple URLRequestContext. Most creators | 5 // This class is useful for building a simple URLRequestContext. Most creators | 
| 6 // of new URLRequestContexts should use this helper class to construct it. Call | 6 // of new URLRequestContexts should use this helper class to construct it. Call | 
| 7 // any configuration params, and when done, invoke Build() to construct the | 7 // any configuration params, and when done, invoke Build() to construct the | 
| 8 // URLRequestContext. This URLRequestContext will own all its own storage. | 8 // URLRequestContext. This URLRequestContext will own all its own storage. | 
| 9 // | 9 // | 
| 10 // URLRequestContextBuilder and its associated params classes are initially | 10 // URLRequestContextBuilder and its associated params classes are initially | 
| 11 // populated with "sane" default values. Read through the comments to figure out | 11 // populated with "sane" default values. Read through the comments to figure out | 
| 12 // what these are. | 12 // what these are. | 
| 13 | 13 | 
| 14 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 14 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 
| 15 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 15 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 
| 16 | 16 | 
| 17 #include <string> | 17 #include <string> | 
| 18 #include <vector> | 18 #include <vector> | 
| 19 | 19 | 
| 20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" | 
| 21 #include "base/files/file_path.h" | 21 #include "base/files/file_path.h" | 
| 22 #include "base/memory/ref_counted.h" | 22 #include "base/memory/ref_counted.h" | 
| 23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" | 
| 24 #include "base/memory/scoped_vector.h" | 24 #include "base/memory/scoped_vector.h" | 
| 25 #include "base/memory/weak_ptr.h" | |
| 25 #include "build/build_config.h" | 26 #include "build/build_config.h" | 
| 26 #include "net/base/net_export.h" | 27 #include "net/base/net_export.h" | 
| 27 #include "net/base/network_delegate.h" | 28 #include "net/base/network_delegate.h" | 
| 28 #include "net/dns/host_resolver.h" | 29 #include "net/dns/host_resolver.h" | 
| 29 #include "net/proxy/proxy_config_service.h" | 30 #include "net/proxy/proxy_config_service.h" | 
| 30 #include "net/proxy/proxy_service.h" | 31 #include "net/proxy/proxy_service.h" | 
| 31 #include "net/quic/quic_protocol.h" | 32 #include "net/quic/quic_protocol.h" | 
| 32 #include "net/socket/next_proto.h" | 33 #include "net/socket/next_proto.h" | 
| 33 | 34 | 
| 34 namespace base { | 35 namespace base { | 
| 35 class SingleThreadTaskRunner; | 36 class SingleThreadTaskRunner; | 
| 36 } | 37 } | 
| 37 | 38 | 
| 38 namespace net { | 39 namespace net { | 
| 39 | 40 | 
| 40 class ChannelIDService; | 41 class ChannelIDService; | 
| 41 class CookieStore; | 42 class CookieStore; | 
| 42 class FtpTransactionFactory; | 43 class FtpTransactionFactory; | 
| 43 class HostMappingRules; | 44 class HostMappingRules; | 
| 44 class HttpAuthHandlerFactory; | 45 class HttpAuthHandlerFactory; | 
| 46 class HttpServerProperties; | |
| 45 class ProxyConfigService; | 47 class ProxyConfigService; | 
| 46 class URLRequestContext; | 48 class URLRequestContext; | 
| 47 class URLRequestInterceptor; | 49 class URLRequestInterceptor; | 
| 48 | 50 | 
| 49 class NET_EXPORT URLRequestContextBuilder { | 51 class NET_EXPORT URLRequestContextBuilder { | 
| 50 public: | 52 public: | 
| 51 struct NET_EXPORT HttpCacheParams { | 53 struct NET_EXPORT HttpCacheParams { | 
| 52 enum Type { | 54 enum Type { | 
| 53 IN_MEMORY, | 55 IN_MEMORY, | 
| 54 DISK, | 56 DISK, | 
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 void SetFileTaskRunner( | 202 void SetFileTaskRunner( | 
| 201 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 203 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 
| 202 | 204 | 
| 203 // Note that if SDCH is enabled without a policy object observing | 205 // Note that if SDCH is enabled without a policy object observing | 
| 204 // the SDCH manager and handling at least Get-Dictionary events, the | 206 // the SDCH manager and handling at least Get-Dictionary events, the | 
| 205 // result will be "Content-Encoding: sdch" advertisements, but no | 207 // result will be "Content-Encoding: sdch" advertisements, but no | 
| 206 // dictionaries fetches and no specific dictionaries advertised. | 208 // dictionaries fetches and no specific dictionaries advertised. | 
| 207 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object. | 209 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object. | 
| 208 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } | 210 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } | 
| 209 | 211 | 
| 212 // Sets a specific HttpServerPropertiesManager for use in the | |
| 213 // URLRequestContext rather than creating a HttpServerPropertiesImpl by | |
| 214 // default. | |
| 215 void SetHttpServerProperties( | |
| 216 base::WeakPtr<HttpServerProperties> http_server_properties); | |
| 
mmenke
2015/07/09 16:18:03
This should probably take ownership (And then the
 
xunjieli
2015/07/09 17:18:10
Done. I see. Thanks for the explanation! I didn't
 | |
| 217 | |
| 210 URLRequestContext* Build(); | 218 URLRequestContext* Build(); | 
| 211 | 219 | 
| 212 private: | 220 private: | 
| 213 struct NET_EXPORT SchemeFactory { | 221 struct NET_EXPORT SchemeFactory { | 
| 214 SchemeFactory(const std::string& scheme, HttpAuthHandlerFactory* factory); | 222 SchemeFactory(const std::string& scheme, HttpAuthHandlerFactory* factory); | 
| 215 ~SchemeFactory(); | 223 ~SchemeFactory(); | 
| 216 | 224 | 
| 217 std::string scheme; | 225 std::string scheme; | 
| 218 HttpAuthHandlerFactory* factory; | 226 HttpAuthHandlerFactory* factory; | 
| 219 }; | 227 }; | 
| (...skipping 21 matching lines...) Expand all Loading... | |
| 241 scoped_ptr<NetLog> net_log_; | 249 scoped_ptr<NetLog> net_log_; | 
| 242 scoped_ptr<HostResolver> host_resolver_; | 250 scoped_ptr<HostResolver> host_resolver_; | 
| 243 scoped_ptr<ChannelIDService> channel_id_service_; | 251 scoped_ptr<ChannelIDService> channel_id_service_; | 
| 244 scoped_ptr<ProxyConfigService> proxy_config_service_; | 252 scoped_ptr<ProxyConfigService> proxy_config_service_; | 
| 245 scoped_ptr<ProxyService> proxy_service_; | 253 scoped_ptr<ProxyService> proxy_service_; | 
| 246 scoped_ptr<NetworkDelegate> network_delegate_; | 254 scoped_ptr<NetworkDelegate> network_delegate_; | 
| 247 scoped_refptr<CookieStore> cookie_store_; | 255 scoped_refptr<CookieStore> cookie_store_; | 
| 248 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 256 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 
| 249 std::vector<SchemeFactory> extra_http_auth_handlers_; | 257 std::vector<SchemeFactory> extra_http_auth_handlers_; | 
| 250 ScopedVector<URLRequestInterceptor> url_request_interceptors_; | 258 ScopedVector<URLRequestInterceptor> url_request_interceptors_; | 
| 259 base::WeakPtr<HttpServerProperties> http_server_properties_; | |
| 251 | 260 | 
| 252 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 261 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 
| 253 }; | 262 }; | 
| 254 | 263 | 
| 255 } // namespace net | 264 } // namespace net | 
| 256 | 265 | 
| 257 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 266 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 
| OLD | NEW |