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 | 18 |
19 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
20 #include "base/files/file_path.h" | 20 #include "base/files/file_path.h" |
21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
22 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
23 #include "base/task_runner.h" | |
23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
24 #include "net/base/net_export.h" | 25 #include "net/base/net_export.h" |
25 | 26 |
26 namespace net { | 27 namespace net { |
27 | 28 |
28 class FtpTransactionFactory; | 29 class FtpTransactionFactory; |
29 class HostMappingRules; | 30 class HostMappingRules; |
30 class ProxyConfigService; | 31 class ProxyConfigService; |
31 class URLRequestContext; | 32 class URLRequestContext; |
32 class NetworkDelegate; | 33 class NetworkDelegate; |
(...skipping 26 matching lines...) Expand all Loading... | |
59 | 60 |
60 // These fields mirror those in net::HttpNetworkSession::Params; | 61 // These fields mirror those in net::HttpNetworkSession::Params; |
61 bool ignore_certificate_errors; | 62 bool ignore_certificate_errors; |
62 HostMappingRules* host_mapping_rules; | 63 HostMappingRules* host_mapping_rules; |
63 bool http_pipelining_enabled; | 64 bool http_pipelining_enabled; |
64 uint16 testing_fixed_http_port; | 65 uint16 testing_fixed_http_port; |
65 uint16 testing_fixed_https_port; | 66 uint16 testing_fixed_https_port; |
66 std::string trusted_spdy_proxy; | 67 std::string trusted_spdy_proxy; |
67 }; | 68 }; |
68 | 69 |
69 URLRequestContextBuilder(); | 70 URLRequestContextBuilder(const scoped_refptr<base::TaskRunner> &task_runner); |
akalin
2013/08/15 17:43:05
' &' -> '& '
| |
70 ~URLRequestContextBuilder(); | 71 ~URLRequestContextBuilder(); |
71 | 72 |
72 #if defined(OS_LINUX) || defined(OS_ANDROID) | 73 #if defined(OS_LINUX) || defined(OS_ANDROID) |
73 void set_proxy_config_service(ProxyConfigService* proxy_config_service); | 74 void set_proxy_config_service(ProxyConfigService* proxy_config_service); |
74 #endif // defined(OS_LINUX) || defined(OS_ANDROID) | 75 #endif // defined(OS_LINUX) || defined(OS_ANDROID) |
75 | 76 |
76 // Call these functions to specify hard-coded Accept-Language | 77 // Call these functions to specify hard-coded Accept-Language |
77 // or User-Agent header values for all requests that don't | 78 // or User-Agent header values for all requests that don't |
78 // have the headers already set. | 79 // have the headers already set. |
79 void set_accept_language(const std::string& accept_language) { | 80 void set_accept_language(const std::string& accept_language) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 bool ftp_enabled_; | 137 bool ftp_enabled_; |
137 #endif | 138 #endif |
138 bool http_cache_enabled_; | 139 bool http_cache_enabled_; |
139 HttpCacheParams http_cache_params_; | 140 HttpCacheParams http_cache_params_; |
140 HttpNetworkSessionParams http_network_session_params_; | 141 HttpNetworkSessionParams http_network_session_params_; |
141 #if defined(OS_LINUX) || defined(OS_ANDROID) | 142 #if defined(OS_LINUX) || defined(OS_ANDROID) |
142 scoped_ptr<ProxyConfigService> proxy_config_service_; | 143 scoped_ptr<ProxyConfigService> proxy_config_service_; |
143 #endif // defined(OS_LINUX) || defined(OS_ANDROID) | 144 #endif // defined(OS_LINUX) || defined(OS_ANDROID) |
144 scoped_ptr<NetworkDelegate> network_delegate_; | 145 scoped_ptr<NetworkDelegate> network_delegate_; |
145 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 146 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; |
147 scoped_refptr<base::TaskRunner> task_runner_; | |
146 | 148 |
147 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 149 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
148 }; | 150 }; |
149 | 151 |
150 } // namespace net | 152 } // namespace net |
151 | 153 |
152 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 154 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |