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

Side by Side Diff: components/cronet/ios/cronet_environment.mm

Issue 2567093002: [cronet] Add a Builder class for UrlRequestContextConfig (Closed)
Patch Set: per #4 Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "components/cronet/ios/cronet_environment.h" 5 #include "components/cronet/ios/cronet_environment.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 if (user_agent_partial_) 263 if (user_agent_partial_)
264 user_agent_ = web::BuildUserAgentFromProduct(user_agent_); 264 user_agent_ = web::BuildUserAgentFromProduct(user_agent_);
265 265
266 // Cache 266 // Cache
267 base::FilePath cache_path; 267 base::FilePath cache_path;
268 if (!PathService::Get(base::DIR_CACHE, &cache_path)) 268 if (!PathService::Get(base::DIR_CACHE, &cache_path))
269 return; 269 return;
270 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet")); 270 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet"));
271 271
272 std::unique_ptr<URLRequestContextConfig> config(new URLRequestContextConfig( 272 URLRequestContextConfigBuilder context_config_builder;
273 quic_enabled_, // Enable QUIC. 273 context_config_builder.enable_quic = quic_enabled_; // Enable QUIC.
274 "", // QUIC User Agent ID. 274 context_config_builder.enable_spdy = http2_enabled_; // Enable SPDY
275 http2_enabled_, // Enable SPDY. 275 context_config_builder.storage_path =
276 false, // Enable SDCH 276 cache_path.value(); // Storage path for http cache and cookie storage.
277 URLRequestContextConfig::DISK, // Type of http cache. 277 context_config_builder.user_agent =
278 0, // Max size of http cache in bytes. 278 user_agent_; // User-Agent request header field.
279 false, // Disable caching for HTTP responses. 279 context_config_builder.mock_cert_verifier = std::move(
280 cache_path.value(), // Storage path for http cache and cookie storage. 280 mock_cert_verifier_); // MockCertVerifier to use for testing purposes.
281 user_agent_, // User-Agent request header field. 281 std::unique_ptr<URLRequestContextConfig> config =
282 "{}", // JSON encoded experimental options. 282 context_config_builder.Build();
283 "", // Data reduction proxy key.
284 "", // Data reduction proxy.
285 "", // Fallback data reduction proxy.
286 "", // Data reduction proxy secure proxy check URL.
287 std::move(mock_cert_verifier_), // MockCertVerifier to use for testing
288 // purposes.
289 false, // Enable network quality estimator.
290 true, // Enable bypassing of public key pinning for local trust anchors
291 "")); // Certificate verifier cache data.
292 283
293 net::URLRequestContextBuilder context_builder; 284 net::URLRequestContextBuilder context_builder;
294 285
295 context_builder.set_accept_language(accept_language_); 286 context_builder.set_accept_language(accept_language_);
296 287
297 config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get(), 288 config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get(),
298 file_thread_.get()->task_runner()); 289 file_thread_.get()->task_runner());
299 290
300 std::unique_ptr<net::MappedHostResolver> mapped_host_resolver( 291 std::unique_ptr<net::MappedHostResolver> mapped_host_resolver(
301 new net::MappedHostResolver( 292 new net::MappedHostResolver(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 343
353 void CronetEnvironment::SetHostResolverRulesOnNetworkThread( 344 void CronetEnvironment::SetHostResolverRulesOnNetworkThread(
354 const std::string& rules, 345 const std::string& rules,
355 base::WaitableEvent* event) { 346 base::WaitableEvent* event) {
356 static_cast<net::MappedHostResolver*>(main_context_->host_resolver()) 347 static_cast<net::MappedHostResolver*>(main_context_->host_resolver())
357 ->SetRulesFromString(rules); 348 ->SetRulesFromString(rules);
358 event->Signal(); 349 event->Signal();
359 } 350 }
360 351
361 } // namespace cronet 352 } // namespace cronet
OLDNEW
« no previous file with comments | « no previous file | components/cronet/url_request_context_config.h » ('j') | components/cronet/url_request_context_config.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698