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 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 | 160 |
161 // Adjust |http_network_session_params_.next_protos| to enable SPDY and QUIC. | 161 // Adjust |http_network_session_params_.next_protos| to enable SPDY and QUIC. |
162 void SetSpdyAndQuicEnabled(bool spdy_enabled, | 162 void SetSpdyAndQuicEnabled(bool spdy_enabled, |
163 bool quic_enabled); | 163 bool quic_enabled); |
164 | 164 |
165 void set_throttling_enabled(bool throttling_enabled) { | 165 void set_throttling_enabled(bool throttling_enabled) { |
166 throttling_enabled_ = throttling_enabled; | 166 throttling_enabled_ = throttling_enabled; |
167 } | 167 } |
168 | 168 |
| 169 void set_channel_id_enabled(bool enable) { |
| 170 channel_id_enabled_ = enable; |
| 171 } |
| 172 |
169 URLRequestContext* Build(); | 173 URLRequestContext* Build(); |
170 | 174 |
171 private: | 175 private: |
172 struct NET_EXPORT SchemeFactory { | 176 struct NET_EXPORT SchemeFactory { |
173 SchemeFactory(const std::string& scheme, | 177 SchemeFactory(const std::string& scheme, |
174 net::HttpAuthHandlerFactory* factory); | 178 net::HttpAuthHandlerFactory* factory); |
175 ~SchemeFactory(); | 179 ~SchemeFactory(); |
176 | 180 |
177 std::string scheme; | 181 std::string scheme; |
178 net::HttpAuthHandlerFactory* factory; | 182 net::HttpAuthHandlerFactory* factory; |
179 }; | 183 }; |
180 | 184 |
181 std::string accept_language_; | 185 std::string accept_language_; |
182 std::string user_agent_; | 186 std::string user_agent_; |
183 // Include support for data:// requests. | 187 // Include support for data:// requests. |
184 bool data_enabled_; | 188 bool data_enabled_; |
185 #if !defined(DISABLE_FILE_SUPPORT) | 189 #if !defined(DISABLE_FILE_SUPPORT) |
186 // Include support for file:// requests. | 190 // Include support for file:// requests. |
187 bool file_enabled_; | 191 bool file_enabled_; |
188 #endif | 192 #endif |
189 #if !defined(DISABLE_FTP_SUPPORT) | 193 #if !defined(DISABLE_FTP_SUPPORT) |
190 // Include support for ftp:// requests. | 194 // Include support for ftp:// requests. |
191 bool ftp_enabled_; | 195 bool ftp_enabled_; |
192 #endif | 196 #endif |
193 bool http_cache_enabled_; | 197 bool http_cache_enabled_; |
194 bool throttling_enabled_; | 198 bool throttling_enabled_; |
| 199 bool channel_id_enabled_; |
195 | 200 |
196 HttpCacheParams http_cache_params_; | 201 HttpCacheParams http_cache_params_; |
197 HttpNetworkSessionParams http_network_session_params_; | 202 HttpNetworkSessionParams http_network_session_params_; |
198 base::FilePath transport_security_persister_path_; | 203 base::FilePath transport_security_persister_path_; |
199 scoped_ptr<NetLog> net_log_; | 204 scoped_ptr<NetLog> net_log_; |
200 scoped_ptr<HostResolver> host_resolver_; | 205 scoped_ptr<HostResolver> host_resolver_; |
201 scoped_ptr<ProxyConfigService> proxy_config_service_; | 206 scoped_ptr<ProxyConfigService> proxy_config_service_; |
202 scoped_ptr<ProxyService> proxy_service_; | 207 scoped_ptr<ProxyService> proxy_service_; |
203 scoped_ptr<NetworkDelegate> network_delegate_; | 208 scoped_ptr<NetworkDelegate> network_delegate_; |
204 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 209 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; |
205 std::vector<SchemeFactory> extra_http_auth_handlers_; | 210 std::vector<SchemeFactory> extra_http_auth_handlers_; |
206 | 211 |
207 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 212 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
208 }; | 213 }; |
209 | 214 |
210 } // namespace net | 215 } // namespace net |
211 | 216 |
212 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 217 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |