| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 net::HttpCache* main_cache = new net::HttpCache(params, main_backend); | 449 net::HttpCache* main_cache = new net::HttpCache(params, main_backend); |
| 450 main_context_->set_http_transaction_factory(main_cache); | 450 main_context_->set_http_transaction_factory(main_cache); |
| 451 | 451 |
| 452 // Cookies | 452 // Cookies |
| 453 scoped_refptr<net::CookieStore> cookie_store = | 453 scoped_refptr<net::CookieStore> cookie_store = |
| 454 net::CookieStoreIOS::CreateCookieStoreFromNSHTTPCookieStorage(); | 454 net::CookieStoreIOS::CreateCookieStoreFromNSHTTPCookieStorage(); |
| 455 main_context_->set_cookie_store(cookie_store.get()); | 455 main_context_->set_cookie_store(cookie_store.get()); |
| 456 | 456 |
| 457 net::URLRequestJobFactoryImpl* job_factory = | 457 net::URLRequestJobFactoryImpl* job_factory = |
| 458 new net::URLRequestJobFactoryImpl; | 458 new net::URLRequestJobFactoryImpl; |
| 459 job_factory->SetProtocolHandler("data", new net::DataProtocolHandler); | |
| 460 job_factory->SetProtocolHandler( | 459 job_factory->SetProtocolHandler( |
| 461 "file", new net::FileProtocolHandler(file_thread_->task_runner())); | 460 "data", make_scoped_ptr(new net::DataProtocolHandler)); |
| 461 job_factory->SetProtocolHandler( |
| 462 "file", make_scoped_ptr( |
| 463 new net::FileProtocolHandler(file_thread_->task_runner()))); |
| 462 main_context_->set_job_factory(job_factory); | 464 main_context_->set_job_factory(job_factory); |
| 463 | 465 |
| 464 main_context_->set_net_log(net_log_.get()); | 466 main_context_->set_net_log(net_log_.get()); |
| 465 } | 467 } |
| 466 | 468 |
| 467 std::string CrNetEnvironment::user_agent() { | 469 std::string CrNetEnvironment::user_agent() { |
| 468 const net::HttpUserAgentSettings* user_agent_settings = | 470 const net::HttpUserAgentSettings* user_agent_settings = |
| 469 main_context_->http_user_agent_settings(); | 471 main_context_->http_user_agent_settings(); |
| 470 if (!user_agent_settings) { | 472 if (!user_agent_settings) { |
| 471 return nullptr; | 473 return nullptr; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 494 if (backend) | 496 if (backend) |
| 495 backend->DoomAllEntries(client_callback); | 497 backend->DoomAllEntries(client_callback); |
| 496 }); | 498 }); |
| 497 int rc = cache->GetBackend(&backend, doom_callback); | 499 int rc = cache->GetBackend(&backend, doom_callback); |
| 498 if (rc != net::ERR_IO_PENDING) { | 500 if (rc != net::ERR_IO_PENDING) { |
| 499 // GetBackend doesn't call the callback if it completes synchronously, so | 501 // GetBackend doesn't call the callback if it completes synchronously, so |
| 500 // call it directly here. | 502 // call it directly here. |
| 501 doom_callback.Run(rc); | 503 doom_callback.Run(rc); |
| 502 } | 504 } |
| 503 } | 505 } |
| OLD | NEW |