| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/crnet/crnet_environment.h" | 5 #include "ios/crnet/crnet_environment.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 // TODO(mmenke): These really shouldn't be leaked. | 468 // TODO(mmenke): These really shouldn't be leaked. |
| 469 // See https://crbug.com/523858. | 469 // See https://crbug.com/523858. |
| 470 net::HttpNetworkSession* http_network_session = | 470 net::HttpNetworkSession* http_network_session = |
| 471 new net::HttpNetworkSession(params); | 471 new net::HttpNetworkSession(params); |
| 472 net::HttpCache* main_cache = | 472 net::HttpCache* main_cache = |
| 473 new net::HttpCache(http_network_session, std::move(main_backend), | 473 new net::HttpCache(http_network_session, std::move(main_backend), |
| 474 true /* set_up_quic_server_info */); | 474 true /* set_up_quic_server_info */); |
| 475 main_context_->set_http_transaction_factory(main_cache); | 475 main_context_->set_http_transaction_factory(main_cache); |
| 476 | 476 |
| 477 // Cookies | 477 // Cookies |
| 478 cookie_store_ = base::MakeUnique<CookieStoreIOS>( | 478 [[NSHTTPCookieStorage sharedHTTPCookieStorage] |
| 479 setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; |
| 480 cookie_store_ = base::MakeUnique<net::CookieStoreIOS>( |
| 479 [NSHTTPCookieStorage sharedHTTPCookieStorage]); | 481 [NSHTTPCookieStorage sharedHTTPCookieStorage]); |
| 480 main_context_->set_cookie_store(cookie_store_.get()); | 482 main_context_->set_cookie_store(cookie_store_.get()); |
| 481 | 483 |
| 482 net::URLRequestJobFactoryImpl* job_factory = | 484 net::URLRequestJobFactoryImpl* job_factory = |
| 483 new net::URLRequestJobFactoryImpl; | 485 new net::URLRequestJobFactoryImpl; |
| 484 job_factory->SetProtocolHandler( | 486 job_factory->SetProtocolHandler( |
| 485 "data", base::WrapUnique(new net::DataProtocolHandler)); | 487 "data", base::WrapUnique(new net::DataProtocolHandler)); |
| 486 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) | 488 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) |
| 487 job_factory->SetProtocolHandler( | 489 job_factory->SetProtocolHandler( |
| 488 "file", | 490 "file", |
| (...skipping 13 matching lines...) Expand all Loading... |
| 502 | 504 |
| 503 return user_agent_settings->GetUserAgent(); | 505 return user_agent_settings->GetUserAgent(); |
| 504 } | 506 } |
| 505 | 507 |
| 506 void CrNetEnvironment::ClearCache(ClearCacheCallback callback) { | 508 void CrNetEnvironment::ClearCache(ClearCacheCallback callback) { |
| 507 PostToNetworkThread( | 509 PostToNetworkThread( |
| 508 FROM_HERE, base::Bind(&net::ClearHttpCache, main_context_getter_, | 510 FROM_HERE, base::Bind(&net::ClearHttpCache, main_context_getter_, |
| 509 network_io_thread_->task_runner(), base::Time(), | 511 network_io_thread_->task_runner(), base::Time(), |
| 510 base::Time::Max(), base::BindBlock(callback))); | 512 base::Time::Max(), base::BindBlock(callback))); |
| 511 } | 513 } |
| OLD | NEW |