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 "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // See https://crbug.com/523858. | 455 // See https://crbug.com/523858. |
456 net::HttpNetworkSession* http_network_session = | 456 net::HttpNetworkSession* http_network_session = |
457 new net::HttpNetworkSession(params); | 457 new net::HttpNetworkSession(params); |
458 net::HttpCache* main_cache = new net::HttpCache( | 458 net::HttpCache* main_cache = new net::HttpCache( |
459 http_network_session, main_backend.Pass(), | 459 http_network_session, main_backend.Pass(), |
460 true /* set_up_quic_server_info */); | 460 true /* set_up_quic_server_info */); |
461 main_context_->set_http_transaction_factory(main_cache); | 461 main_context_->set_http_transaction_factory(main_cache); |
462 | 462 |
463 // Cookies | 463 // Cookies |
464 scoped_refptr<net::CookieStore> cookie_store = | 464 scoped_refptr<net::CookieStore> cookie_store = |
465 net::CookieStoreIOS::CreateCookieStoreFromNSHTTPCookieStorage(); | 465 net::CookieStoreIOS::CreateCookieStore( |
| 466 [NSHTTPCookieStorage sharedHTTPCookieStorage]); |
466 main_context_->set_cookie_store(cookie_store.get()); | 467 main_context_->set_cookie_store(cookie_store.get()); |
467 | 468 |
468 net::URLRequestJobFactoryImpl* job_factory = | 469 net::URLRequestJobFactoryImpl* job_factory = |
469 new net::URLRequestJobFactoryImpl; | 470 new net::URLRequestJobFactoryImpl; |
470 job_factory->SetProtocolHandler( | 471 job_factory->SetProtocolHandler( |
471 "data", make_scoped_ptr(new net::DataProtocolHandler)); | 472 "data", make_scoped_ptr(new net::DataProtocolHandler)); |
472 job_factory->SetProtocolHandler( | 473 job_factory->SetProtocolHandler( |
473 "file", make_scoped_ptr( | 474 "file", make_scoped_ptr( |
474 new net::FileProtocolHandler(file_thread_->task_runner()))); | 475 new net::FileProtocolHandler(file_thread_->task_runner()))); |
475 main_context_->set_job_factory(job_factory); | 476 main_context_->set_job_factory(job_factory); |
(...skipping 10 matching lines...) Expand all Loading... |
486 | 487 |
487 return user_agent_settings->GetUserAgent(); | 488 return user_agent_settings->GetUserAgent(); |
488 } | 489 } |
489 | 490 |
490 void CrNetEnvironment::ClearCache(ClearCacheCallback callback) { | 491 void CrNetEnvironment::ClearCache(ClearCacheCallback callback) { |
491 PostToNetworkThread( | 492 PostToNetworkThread( |
492 FROM_HERE, | 493 FROM_HERE, |
493 base::Bind(&net::ClearHttpCache, main_context_getter_, | 494 base::Bind(&net::ClearHttpCache, main_context_getter_, |
494 network_io_thread_->task_runner(), base::BindBlock(callback))); | 495 network_io_thread_->task_runner(), base::BindBlock(callback))); |
495 } | 496 } |
OLD | NEW |