OLD | NEW |
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 <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ios/chrome/browser/ios_chrome_io_thread.h" | 25 #include "ios/chrome/browser/ios_chrome_io_thread.h" |
26 #include "ios/chrome/browser/net/cookie_util.h" | 26 #include "ios/chrome/browser/net/cookie_util.h" |
27 #include "ios/chrome/browser/net/http_server_properties_manager_factory.h" | 27 #include "ios/chrome/browser/net/http_server_properties_manager_factory.h" |
28 #include "ios/chrome/browser/net/ios_chrome_network_delegate.h" | 28 #include "ios/chrome/browser/net/ios_chrome_network_delegate.h" |
29 #include "ios/chrome/browser/net/ios_chrome_url_request_context_getter.h" | 29 #include "ios/chrome/browser/net/ios_chrome_url_request_context_getter.h" |
30 #include "ios/chrome/browser/pref_names.h" | 30 #include "ios/chrome/browser/pref_names.h" |
31 #include "ios/net/cookies/cookie_store_ios.h" | 31 #include "ios/net/cookies/cookie_store_ios.h" |
32 #include "ios/web/public/web_thread.h" | 32 #include "ios/web/public/web_thread.h" |
33 #include "net/base/cache_type.h" | 33 #include "net/base/cache_type.h" |
34 #include "net/base/sdch_manager.h" | 34 #include "net/base/sdch_manager.h" |
| 35 #include "net/cookies/cookie_store.h" |
35 #include "net/extras/sqlite/sqlite_channel_id_store.h" | 36 #include "net/extras/sqlite/sqlite_channel_id_store.h" |
36 #include "net/http/http_cache.h" | 37 #include "net/http/http_cache.h" |
37 #include "net/http/http_network_session.h" | 38 #include "net/http/http_network_session.h" |
38 #include "net/http/http_server_properties_manager.h" | 39 #include "net/http/http_server_properties_manager.h" |
39 #include "net/sdch/sdch_owner.h" | 40 #include "net/sdch/sdch_owner.h" |
40 #include "net/ssl/channel_id_service.h" | 41 #include "net/ssl/channel_id_service.h" |
41 #include "net/ssl/default_channel_id_store.h" | 42 #include "net/ssl/default_channel_id_store.h" |
42 #include "net/url_request/url_request_intercepting_job_factory.h" | 43 #include "net/url_request/url_request_intercepting_job_factory.h" |
43 #include "net/url_request/url_request_job_factory_impl.h" | 44 #include "net/url_request/url_request_job_factory_impl.h" |
44 | 45 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 333 |
333 main_context->set_host_resolver(io_thread_globals->host_resolver.get()); | 334 main_context->set_host_resolver(io_thread_globals->host_resolver.get()); |
334 | 335 |
335 main_context->set_http_auth_handler_factory( | 336 main_context->set_http_auth_handler_factory( |
336 io_thread_globals->http_auth_handler_factory.get()); | 337 io_thread_globals->http_auth_handler_factory.get()); |
337 | 338 |
338 main_context->set_proxy_service(proxy_service()); | 339 main_context->set_proxy_service(proxy_service()); |
339 main_context->set_backoff_manager( | 340 main_context->set_backoff_manager( |
340 io_thread_globals->url_request_backoff_manager.get()); | 341 io_thread_globals->url_request_backoff_manager.get()); |
341 | 342 |
342 scoped_refptr<net::CookieStore> cookie_store = NULL; | |
343 net::ChannelIDService* channel_id_service = NULL; | 343 net::ChannelIDService* channel_id_service = NULL; |
344 | 344 |
345 // Set up cookie store. | 345 DCHECK(!lazy_params_->cookie_path.empty()); |
346 if (!cookie_store.get()) { | 346 cookie_util::CookieStoreConfig ios_cookie_config( |
347 DCHECK(!lazy_params_->cookie_path.empty()); | 347 lazy_params_->cookie_path, |
348 cookie_util::CookieStoreConfig ios_cookie_config( | 348 cookie_util::CookieStoreConfig::RESTORED_SESSION_COOKIES, |
349 lazy_params_->cookie_path, | 349 cookie_util::CookieStoreConfig::COOKIE_STORE_IOS, |
350 cookie_util::CookieStoreConfig::RESTORED_SESSION_COOKIES, | 350 cookie_config::GetCookieCryptoDelegate()); |
351 cookie_util::CookieStoreConfig::COOKIE_STORE_IOS, | 351 main_cookie_store_ = cookie_util::CreateCookieStore(ios_cookie_config); |
352 cookie_config::GetCookieCryptoDelegate()); | |
353 cookie_store = cookie_util::CreateCookieStore(ios_cookie_config); | |
354 | 352 |
355 if (profile_params->path.BaseName().value() == | 353 if (profile_params->path.BaseName().value() == |
356 kIOSChromeInitialBrowserState) { | 354 kIOSChromeInitialBrowserState) { |
357 // Enable metrics on the default profile, not secondary profiles. | 355 // Enable metrics on the default profile, not secondary profiles. |
358 static_cast<net::CookieStoreIOS*>(cookie_store.get()) | 356 static_cast<net::CookieStoreIOS*>(main_cookie_store_.get()) |
359 ->SetMetricsEnabled(); | 357 ->SetMetricsEnabled(); |
360 } | |
361 } | 358 } |
362 | 359 |
363 main_context->set_cookie_store(cookie_store.get()); | 360 main_context->set_cookie_store(main_cookie_store_.get()); |
364 | 361 |
365 // Set up server bound cert service. | 362 // Set up server bound cert service. |
366 if (!channel_id_service) { | 363 if (!channel_id_service) { |
367 DCHECK(!lazy_params_->channel_id_path.empty()); | 364 DCHECK(!lazy_params_->channel_id_path.empty()); |
368 | 365 |
369 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db = | 366 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db = |
370 new net::SQLiteChannelIDStore( | 367 new net::SQLiteChannelIDStore( |
371 lazy_params_->channel_id_path, | 368 lazy_params_->channel_id_path, |
372 web::WebThread::GetBlockingPool()->GetSequencedTaskRunner( | 369 web::WebThread::GetBlockingPool()->GetSequencedTaskRunner( |
373 web::WebThread::GetBlockingPool()->GetSequenceToken())); | 370 web::WebThread::GetBlockingPool()->GetSequenceToken())); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 // Use a separate HTTP disk cache for isolated apps. | 420 // Use a separate HTTP disk cache for isolated apps. |
424 scoped_ptr<net::HttpCache::BackendFactory> app_backend = | 421 scoped_ptr<net::HttpCache::BackendFactory> app_backend = |
425 net::HttpCache::DefaultBackend::InMemory(0); | 422 net::HttpCache::DefaultBackend::InMemory(0); |
426 scoped_ptr<net::HttpCache> app_http_cache = | 423 scoped_ptr<net::HttpCache> app_http_cache = |
427 CreateHttpFactory(http_network_session_.get(), std::move(app_backend)); | 424 CreateHttpFactory(http_network_session_.get(), std::move(app_backend)); |
428 | 425 |
429 cookie_util::CookieStoreConfig ios_cookie_config( | 426 cookie_util::CookieStoreConfig ios_cookie_config( |
430 base::FilePath(), | 427 base::FilePath(), |
431 cookie_util::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, | 428 cookie_util::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, |
432 cookie_util::CookieStoreConfig::COOKIE_STORE_IOS, nullptr); | 429 cookie_util::CookieStoreConfig::COOKIE_STORE_IOS, nullptr); |
433 scoped_refptr<net::CookieStore> cookie_store = | 430 scoped_ptr<net::CookieStore> cookie_store = |
434 cookie_util::CreateCookieStore(ios_cookie_config); | 431 cookie_util::CreateCookieStore(ios_cookie_config); |
435 | 432 |
436 // Transfer ownership of the cookies and cache to AppRequestContext. | 433 // Transfer ownership of the cookies and cache to AppRequestContext. |
437 context->SetCookieStore(cookie_store.get()); | 434 context->SetCookieStore(std::move(cookie_store)); |
438 context->SetHttpTransactionFactory(std::move(app_http_cache)); | 435 context->SetHttpTransactionFactory(std::move(app_http_cache)); |
439 | 436 |
440 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( | 437 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( |
441 new net::URLRequestJobFactoryImpl()); | 438 new net::URLRequestJobFactoryImpl()); |
442 // TODO(crbug.com/592012): Delete request_interceptor and its handling if | 439 // TODO(crbug.com/592012): Delete request_interceptor and its handling if |
443 // it's not needed in the future. | 440 // it's not needed in the future. |
444 URLRequestInterceptorScopedVector request_interceptors; | 441 URLRequestInterceptorScopedVector request_interceptors; |
445 scoped_ptr<net::URLRequestJobFactory> top_job_factory(SetUpJobFactoryDefaults( | 442 scoped_ptr<net::URLRequestJobFactory> top_job_factory(SetUpJobFactoryDefaults( |
446 std::move(job_factory), std::move(request_interceptors), | 443 std::move(job_factory), std::move(request_interceptors), |
447 main_context->network_delegate())); | 444 main_context->network_delegate())); |
(...skipping 17 matching lines...) Expand all Loading... |
465 const base::Closure& completion) { | 462 const base::Closure& completion) { |
466 DCHECK_CURRENTLY_ON(web::WebThread::IO); | 463 DCHECK_CURRENTLY_ON(web::WebThread::IO); |
467 DCHECK(initialized()); | 464 DCHECK(initialized()); |
468 | 465 |
469 DCHECK(transport_security_state()); | 466 DCHECK(transport_security_state()); |
470 // Completes synchronously. | 467 // Completes synchronously. |
471 transport_security_state()->DeleteAllDynamicDataSince(time); | 468 transport_security_state()->DeleteAllDynamicDataSince(time); |
472 DCHECK(http_server_properties_manager_); | 469 DCHECK(http_server_properties_manager_); |
473 http_server_properties_manager_->Clear(completion); | 470 http_server_properties_manager_->Clear(completion); |
474 } | 471 } |
OLD | NEW |