Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.mm

Issue 1930233002: Fix URLRequestContext::CopyFrom in ios code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix iOS compile; add NOTREACHED() Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chrome/browser/browser_state/chrome_browser_state_impl_io_data.h" 5 #include "ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 lazy_params_.reset(); 409 lazy_params_.reset();
410 } 410 }
411 411
412 ChromeBrowserStateIOData::AppRequestContext* 412 ChromeBrowserStateIOData::AppRequestContext*
413 ChromeBrowserStateImplIOData::InitializeAppRequestContext( 413 ChromeBrowserStateImplIOData::InitializeAppRequestContext(
414 net::URLRequestContext* main_context) const { 414 net::URLRequestContext* main_context) const {
415 // Copy most state from the main context. 415 // Copy most state from the main context.
416 AppRequestContext* context = new AppRequestContext(); 416 AppRequestContext* context = new AppRequestContext();
417 context->CopyFrom(main_context); 417 context->CopyFrom(main_context);
418 418
419 // Use a separate ChannelIDService.
420 std::unique_ptr<net::ChannelIDService> channel_id_service(
421 new net::ChannelIDService(new net::DefaultChannelIDStore(nullptr),
422 base::WorkerPool::GetTaskRunner(true)));
423
424 // Build a new HttpNetworkSession that uses the new ChannelIDService.
425 net::HttpNetworkSession::Params network_params =
426 http_network_session_->params();
427 network_params.channel_id_service = channel_id_service.get();
428 std::unique_ptr<net::HttpNetworkSession> http_network_session(
429 new net::HttpNetworkSession(network_params));
430
419 // Use a separate HTTP disk cache for isolated apps. 431 // Use a separate HTTP disk cache for isolated apps.
420 std::unique_ptr<net::HttpCache::BackendFactory> app_backend = 432 std::unique_ptr<net::HttpCache::BackendFactory> app_backend =
421 net::HttpCache::DefaultBackend::InMemory(0); 433 net::HttpCache::DefaultBackend::InMemory(0);
422 std::unique_ptr<net::HttpCache> app_http_cache = 434 std::unique_ptr<net::HttpCache> app_http_cache =
423 CreateHttpFactory(http_network_session_.get(), std::move(app_backend)); 435 CreateHttpFactory(http_network_session.get(), std::move(app_backend));
424 436
425 cookie_util::CookieStoreConfig ios_cookie_config( 437 cookie_util::CookieStoreConfig ios_cookie_config(
426 base::FilePath(), 438 base::FilePath(),
427 cookie_util::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, 439 cookie_util::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
428 cookie_util::CookieStoreConfig::COOKIE_STORE_IOS, nullptr); 440 cookie_util::CookieStoreConfig::COOKIE_STORE_IOS, nullptr);
429 std::unique_ptr<net::CookieStore> cookie_store = 441 std::unique_ptr<net::CookieStore> cookie_store =
430 cookie_util::CreateCookieStore(ios_cookie_config); 442 cookie_util::CreateCookieStore(ios_cookie_config);
431 443
432 // Transfer ownership of the cookies and cache to AppRequestContext. 444 // Transfer ownership of the ChannelIDStore, HttpNetworkSession, cookies, and
445 // cache to AppRequestContext.
446 context->SetChannelIDService(std::move(channel_id_service));
447 context->SetHttpNetworkSession(std::move(http_network_session));
433 context->SetCookieStore(std::move(cookie_store)); 448 context->SetCookieStore(std::move(cookie_store));
434 context->SetHttpTransactionFactory(std::move(app_http_cache)); 449 context->SetHttpTransactionFactory(std::move(app_http_cache));
435 450
436 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( 451 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
437 new net::URLRequestJobFactoryImpl()); 452 new net::URLRequestJobFactoryImpl());
438 // TODO(crbug.com/592012): Delete request_interceptor and its handling if 453 // TODO(crbug.com/592012): Delete request_interceptor and its handling if
439 // it's not needed in the future. 454 // it's not needed in the future.
440 URLRequestInterceptorScopedVector request_interceptors; 455 URLRequestInterceptorScopedVector request_interceptors;
441 std::unique_ptr<net::URLRequestJobFactory> top_job_factory( 456 std::unique_ptr<net::URLRequestJobFactory> top_job_factory(
442 SetUpJobFactoryDefaults(std::move(job_factory), 457 SetUpJobFactoryDefaults(std::move(job_factory),
(...skipping 19 matching lines...) Expand all
462 const base::Closure& completion) { 477 const base::Closure& completion) {
463 DCHECK_CURRENTLY_ON(web::WebThread::IO); 478 DCHECK_CURRENTLY_ON(web::WebThread::IO);
464 DCHECK(initialized()); 479 DCHECK(initialized());
465 480
466 DCHECK(transport_security_state()); 481 DCHECK(transport_security_state());
467 // Completes synchronously. 482 // Completes synchronously.
468 transport_security_state()->DeleteAllDynamicDataSince(time); 483 transport_security_state()->DeleteAllDynamicDataSince(time);
469 DCHECK(http_server_properties_manager_); 484 DCHECK(http_server_properties_manager_);
470 http_server_properties_manager_->Clear(completion); 485 http_server_properties_manager_->Clear(completion);
471 } 486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698