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

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: Created 5 years, 8 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 net::HttpAuthHandlerFactory* factory) { 149 net::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, 209 SchemeFactory(const std::string& scheme,
204 net::HttpAuthHandlerFactory* factory); 210 net::HttpAuthHandlerFactory* factory);
205 ~SchemeFactory(); 211 ~SchemeFactory();
206 212
207 std::string scheme; 213 std::string scheme;
208 net::HttpAuthHandlerFactory* factory; 214 net::HttpAuthHandlerFactory* factory;
209 }; 215 };
210 216
211 std::string accept_language_; 217 std::string accept_language_;
212 std::string user_agent_; 218 std::string user_agent_;
213 // Include support for data:// requests. 219 // Include support for data:// requests.
214 bool data_enabled_; 220 bool data_enabled_;
215 #if !defined(DISABLE_FILE_SUPPORT) 221 #if !defined(DISABLE_FILE_SUPPORT)
216 // Include support for file:// requests. 222 // Include support for file:// requests.
217 bool file_enabled_; 223 bool file_enabled_;
218 #endif 224 #endif
219 #if !defined(DISABLE_FTP_SUPPORT) 225 #if !defined(DISABLE_FTP_SUPPORT)
220 // Include support for ftp:// requests. 226 // Include support for ftp:// requests.
221 bool ftp_enabled_; 227 bool ftp_enabled_;
222 #endif 228 #endif
223 bool http_cache_enabled_; 229 bool http_cache_enabled_;
224 bool throttling_enabled_; 230 bool throttling_enabled_;
231 bool sdch_enabled_;
225 232
226 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; 233 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
227 HttpCacheParams http_cache_params_; 234 HttpCacheParams http_cache_params_;
228 HttpNetworkSessionParams http_network_session_params_; 235 HttpNetworkSessionParams http_network_session_params_;
229 base::FilePath transport_security_persister_path_; 236 base::FilePath transport_security_persister_path_;
230 scoped_ptr<NetLog> net_log_; 237 scoped_ptr<NetLog> net_log_;
231 scoped_ptr<HostResolver> host_resolver_; 238 scoped_ptr<HostResolver> host_resolver_;
232 scoped_ptr<ChannelIDService> channel_id_service_; 239 scoped_ptr<ChannelIDService> channel_id_service_;
233 scoped_ptr<ProxyConfigService> proxy_config_service_; 240 scoped_ptr<ProxyConfigService> proxy_config_service_;
234 scoped_ptr<ProxyService> proxy_service_; 241 scoped_ptr<ProxyService> proxy_service_;
235 scoped_ptr<NetworkDelegate> network_delegate_; 242 scoped_ptr<NetworkDelegate> network_delegate_;
236 scoped_refptr<CookieStore> cookie_store_; 243 scoped_refptr<CookieStore> cookie_store_;
237 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; 244 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_;
238 std::vector<SchemeFactory> extra_http_auth_handlers_; 245 std::vector<SchemeFactory> extra_http_auth_handlers_;
239 246
240 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); 247 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder);
241 }; 248 };
242 249
243 } // namespace net 250 } // namespace net
244 251
245 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ 252 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698