Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 std::unique_ptr<URLRequestContextConfig> config(new URLRequestContextConfig( |
| 273 quic_enabled_, // Enable QUIC. | 273 quic_enabled_, // Enable QUIC. |
| 274 "", // QUIC User Agent ID. | 274 quic_enabled_ && !quic_user_agent_id_.size() |
|
mef
2016/12/13 20:46:43
nit: !quic_user_agent_id_.size() => quic_user_agen
| |
| 275 ? getDefaultQuicUserAgentId() | |
| 276 : quic_user_agent_id_, // QUIC User Agent ID. | |
|
mef
2016/12/13 20:46:43
Maybe move it into explicit if (...) construction
lilyhoughton
2016/12/14 18:32:15
It's used for basically the same thing in the andr
| |
| 275 http2_enabled_, // Enable SPDY. | 277 http2_enabled_, // Enable SPDY. |
| 276 false, // Enable SDCH | 278 false, // Enable SDCH |
| 277 URLRequestContextConfig::DISK, // Type of http cache. | 279 URLRequestContextConfig::DISK, // Type of http cache. |
| 278 0, // Max size of http cache in bytes. | 280 0, // Max size of http cache in bytes. |
| 279 false, // Disable caching for HTTP responses. | 281 false, // Disable caching for HTTP responses. |
| 280 cache_path.value(), // Storage path for http cache and cookie storage. | 282 cache_path.value(), // Storage path for http cache and cookie storage. |
| 281 user_agent_, // User-Agent request header field. | 283 user_agent_, // User-Agent request header field. |
| 282 "{}", // JSON encoded experimental options. | 284 "{}", // JSON encoded experimental options. |
| 283 "", // Data reduction proxy key. | 285 "", // Data reduction proxy key. |
| 284 "", // Data reduction proxy. | 286 "", // Data reduction proxy. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 } | 353 } |
| 352 | 354 |
| 353 void CronetEnvironment::SetHostResolverRulesOnNetworkThread( | 355 void CronetEnvironment::SetHostResolverRulesOnNetworkThread( |
| 354 const std::string& rules, | 356 const std::string& rules, |
| 355 base::WaitableEvent* event) { | 357 base::WaitableEvent* event) { |
| 356 static_cast<net::MappedHostResolver*>(main_context_->host_resolver()) | 358 static_cast<net::MappedHostResolver*>(main_context_->host_resolver()) |
| 357 ->SetRulesFromString(rules); | 359 ->SetRulesFromString(rules); |
| 358 event->Signal(); | 360 event->Signal(); |
| 359 } | 361 } |
| 360 | 362 |
| 363 std::string CronetEnvironment::getDefaultQuicUserAgentId() { | |
| 364 return base::SysNSStringToUTF8([[NSBundle mainBundle] | |
| 365 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + | |
| 366 " Cronet/" + CRONET_VERSION; | |
| 367 } | |
| 368 | |
| 361 } // namespace cronet | 369 } // namespace cronet |
| OLD | NEW |