Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: net/url_request/url_request_context_builder.h

Issue 1085903002: Enable Sdch in Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: constants Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 host_resolver_.reset(host_resolver); 134 host_resolver_.reset(host_resolver);
135 } 135 }
136 136
137 // Uses BasicNetworkDelegate by default. Note that calling Build will unset 137 // Uses BasicNetworkDelegate by default. Note that calling Build will unset
138 // any custom delegate in builder, so this must be called each time before 138 // any custom delegate in builder, so this must be called each time before
139 // Build is called. 139 // Build is called.
140 void set_network_delegate(NetworkDelegate* delegate) { 140 void set_network_delegate(NetworkDelegate* delegate) {
141 network_delegate_.reset(delegate); 141 network_delegate_.reset(delegate);
142 } 142 }
143 143
144
145 // Adds additional auth handler factories to be used in addition to what is 144 // Adds additional auth handler factories to be used in addition to what is
146 // provided in the default |HttpAuthHandlerRegistryFactory|. The auth |scheme| 145 // provided in the default |HttpAuthHandlerRegistryFactory|. The auth |scheme|
147 // and |factory| are provided. The builder takes ownership of the factory and 146 // and |factory| are provided. The builder takes ownership of the factory and
148 // Build() must be called after this method. 147 // Build() must be called after this method.
149 void add_http_auth_handler_factory(const std::string& scheme, 148 void add_http_auth_handler_factory(const std::string& scheme,
150 HttpAuthHandlerFactory* factory) { 149 HttpAuthHandlerFactory* factory) {
151 extra_http_auth_handlers_.push_back(SchemeFactory(scheme, factory)); 150 extra_http_auth_handlers_.push_back(SchemeFactory(scheme, factory));
152 } 151 }
153 152
154 // By default HttpCache is enabled with a default constructed HttpCacheParams. 153 // By default HttpCache is enabled with a default constructed HttpCacheParams.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // store). 188 // store).
190 void SetCookieAndChannelIdStores( 189 void SetCookieAndChannelIdStores(
191 const scoped_refptr<CookieStore>& cookie_store, 190 const scoped_refptr<CookieStore>& cookie_store,
192 scoped_ptr<ChannelIDService> channel_id_service); 191 scoped_ptr<ChannelIDService> channel_id_service);
193 192
194 // Sets the task runner used to perform file operations. If not set, one will 193 // Sets the task runner used to perform file operations. If not set, one will
195 // be created. 194 // be created.
196 void SetFileTaskRunner( 195 void SetFileTaskRunner(
197 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 196 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
198 197
198 // Note that if SDCH is enabled without a policy object observing
199 // the SDCH manager and handling at least Get-Dictionary events, the
200 // result will be "Content-Encoding: sdch" advertisements, but no
201 // dictionaries fetches and no specific dictionaries advertised.
202 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object.
203 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; }
204
199 URLRequestContext* Build(); 205 URLRequestContext* Build();
200 206
201 private: 207 private:
202 struct NET_EXPORT SchemeFactory { 208 struct NET_EXPORT SchemeFactory {
203 SchemeFactory(const std::string& scheme, HttpAuthHandlerFactory* factory); 209 SchemeFactory(const std::string& scheme, HttpAuthHandlerFactory* factory);
204 ~SchemeFactory(); 210 ~SchemeFactory();
205 211
206 std::string scheme; 212 std::string scheme;
207 HttpAuthHandlerFactory* factory; 213 HttpAuthHandlerFactory* factory;
208 }; 214 };
209 215
210 std::string accept_language_; 216 std::string accept_language_;
211 std::string user_agent_; 217 std::string user_agent_;
212 // Include support for data:// requests. 218 // Include support for data:// requests.
213 bool data_enabled_; 219 bool data_enabled_;
214 #if !defined(DISABLE_FILE_SUPPORT) 220 #if !defined(DISABLE_FILE_SUPPORT)
215 // Include support for file:// requests. 221 // Include support for file:// requests.
216 bool file_enabled_; 222 bool file_enabled_;
217 #endif 223 #endif
218 #if !defined(DISABLE_FTP_SUPPORT) 224 #if !defined(DISABLE_FTP_SUPPORT)
219 // Include support for ftp:// requests. 225 // Include support for ftp:// requests.
220 bool ftp_enabled_; 226 bool ftp_enabled_;
221 #endif 227 #endif
222 bool http_cache_enabled_; 228 bool http_cache_enabled_;
223 bool throttling_enabled_; 229 bool throttling_enabled_;
230 bool sdch_enabled_;
224 231
225 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; 232 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
226 HttpCacheParams http_cache_params_; 233 HttpCacheParams http_cache_params_;
227 HttpNetworkSessionParams http_network_session_params_; 234 HttpNetworkSessionParams http_network_session_params_;
228 base::FilePath transport_security_persister_path_; 235 base::FilePath transport_security_persister_path_;
229 scoped_ptr<NetLog> net_log_; 236 scoped_ptr<NetLog> net_log_;
230 scoped_ptr<HostResolver> host_resolver_; 237 scoped_ptr<HostResolver> host_resolver_;
231 scoped_ptr<ChannelIDService> channel_id_service_; 238 scoped_ptr<ChannelIDService> channel_id_service_;
232 scoped_ptr<ProxyConfigService> proxy_config_service_; 239 scoped_ptr<ProxyConfigService> proxy_config_service_;
233 scoped_ptr<ProxyService> proxy_service_; 240 scoped_ptr<ProxyService> proxy_service_;
234 scoped_ptr<NetworkDelegate> network_delegate_; 241 scoped_ptr<NetworkDelegate> network_delegate_;
235 scoped_refptr<CookieStore> cookie_store_; 242 scoped_refptr<CookieStore> cookie_store_;
236 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; 243 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_;
237 std::vector<SchemeFactory> extra_http_auth_handlers_; 244 std::vector<SchemeFactory> extra_http_auth_handlers_;
238 245
239 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); 246 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder);
240 }; 247 };
241 248
242 } // namespace net 249 } // namespace net
243 250
244 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ 251 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_
OLDNEW
« no previous file with comments | « components/cronet/url_request_context_config_list.h ('k') | net/url_request/url_request_context_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698