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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 cookie_store_ = net::CookieStoreIOS::CreateCookieStore( | 466 cookie_store_ = net::CookieStoreIOS::CreateCookieStore( |
467 [NSHTTPCookieStorage sharedHTTPCookieStorage]); | 467 [NSHTTPCookieStorage sharedHTTPCookieStorage]); |
468 main_context_->set_cookie_store(cookie_store_.get()); | 468 main_context_->set_cookie_store(cookie_store_.get()); |
469 | 469 |
470 net::URLRequestJobFactoryImpl* job_factory = | 470 net::URLRequestJobFactoryImpl* job_factory = |
471 new net::URLRequestJobFactoryImpl; | 471 new net::URLRequestJobFactoryImpl; |
472 job_factory->SetProtocolHandler( | 472 job_factory->SetProtocolHandler( |
473 "data", base::WrapUnique(new net::DataProtocolHandler)); | 473 "data", base::WrapUnique(new net::DataProtocolHandler)); |
474 #if !defined(DISABLE_FILE_SUPPORT) | 474 #if !defined(DISABLE_FILE_SUPPORT) |
475 job_factory->SetProtocolHandler( | 475 job_factory->SetProtocolHandler( |
476 "file", base::WrapUnique( | 476 "file", |
477 new net::FileProtocolHandler(file_thread_->task_runner()))); | 477 base::MakeUnique<net::FileProtocolHandler>(file_thread_->task_runner())); |
478 #endif // !defined(DISABLE_FILE_SUPPORT) | 478 #endif // !defined(DISABLE_FILE_SUPPORT) |
479 main_context_->set_job_factory(job_factory); | 479 main_context_->set_job_factory(job_factory); |
480 | 480 |
481 main_context_->set_net_log(net_log_.get()); | 481 main_context_->set_net_log(net_log_.get()); |
482 } | 482 } |
483 | 483 |
484 std::string CrNetEnvironment::user_agent() { | 484 std::string CrNetEnvironment::user_agent() { |
485 const net::HttpUserAgentSettings* user_agent_settings = | 485 const net::HttpUserAgentSettings* user_agent_settings = |
486 main_context_->http_user_agent_settings(); | 486 main_context_->http_user_agent_settings(); |
487 if (!user_agent_settings) { | 487 if (!user_agent_settings) { |
488 return nullptr; | 488 return nullptr; |
489 } | 489 } |
490 | 490 |
491 return user_agent_settings->GetUserAgent(); | 491 return user_agent_settings->GetUserAgent(); |
492 } | 492 } |
493 | 493 |
494 void CrNetEnvironment::ClearCache(ClearCacheCallback callback) { | 494 void CrNetEnvironment::ClearCache(ClearCacheCallback callback) { |
495 PostToNetworkThread( | 495 PostToNetworkThread( |
496 FROM_HERE, | 496 FROM_HERE, base::Bind(&net::ClearHttpCache, main_context_getter_, |
497 base::Bind(&net::ClearHttpCache, main_context_getter_, | 497 network_io_thread_->task_runner(), base::Time(), |
498 network_io_thread_->task_runner(), base::BindBlock(callback))); | 498 base::Time::Max(), base::BindBlock(callback))); |
499 } | 499 } |
OLD | NEW |