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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 182993003: Add the ability for DevTools to wrap network transactions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename parameter Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 main_context->set_server_bound_cert_service(server_bound_cert_service); 448 main_context->set_server_bound_cert_service(server_bound_cert_service);
449 449
450 net::HttpCache::DefaultBackend* main_backend = 450 net::HttpCache::DefaultBackend* main_backend =
451 new net::HttpCache::DefaultBackend( 451 new net::HttpCache::DefaultBackend(
452 net::DISK_CACHE, 452 net::DISK_CACHE,
453 ChooseCacheBackendType(), 453 ChooseCacheBackendType(),
454 lazy_params_->cache_path, 454 lazy_params_->cache_path,
455 lazy_params_->cache_max_size, 455 lazy_params_->cache_max_size,
456 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) 456 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)
457 .get()); 457 .get());
458 net::HttpNetworkSession::Params network_session_params; 458 scoped_ptr<net::HttpCache> main_cache = CreateMainHttpFactory(
459 PopulateNetworkSessionParams(profile_params, &network_session_params); 459 profile_params, main_backend);
460 net::HttpCache* main_cache = new net::HttpCache(
461 network_session_params, main_backend);
462 main_cache->InitializeInfiniteCache(lazy_params_->infinite_cache_path); 460 main_cache->InitializeInfiniteCache(lazy_params_->infinite_cache_path);
463 461
464 #if defined(OS_ANDROID) || defined(OS_IOS) 462 #if defined(OS_ANDROID) || defined(OS_IOS)
465 data_reduction_proxy::DataReductionProxySettings:: 463 data_reduction_proxy::DataReductionProxySettings::
466 InitDataReductionProxySession(main_cache->GetSession()); 464 InitDataReductionProxySession(main_cache->GetSession());
467 #endif 465 #endif
468 466
469 if (chrome_browser_net::ShouldUseInMemoryCookiesAndCache()) { 467 if (chrome_browser_net::ShouldUseInMemoryCookiesAndCache()) {
470 main_cache->set_mode( 468 main_cache->set_mode(
471 chrome_browser_net::IsCookieRecordMode() ? 469 chrome_browser_net::IsCookieRecordMode() ?
472 net::HttpCache::RECORD : net::HttpCache::PLAYBACK); 470 net::HttpCache::RECORD : net::HttpCache::PLAYBACK);
473 } 471 }
474 472
475 main_http_factory_.reset(main_cache); 473 main_http_factory_.reset(main_cache.release());
476 main_context->set_http_transaction_factory(main_cache); 474 main_context->set_http_transaction_factory(main_http_factory_.get());
477 475
478 #if !defined(DISABLE_FTP_SUPPORT) 476 #if !defined(DISABLE_FTP_SUPPORT)
479 ftp_factory_.reset( 477 ftp_factory_.reset(
480 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); 478 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get()));
481 #endif // !defined(DISABLE_FTP_SUPPORT) 479 #endif // !defined(DISABLE_FTP_SUPPORT)
482 480
483 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory( 481 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
484 new net::URLRequestJobFactoryImpl()); 482 new net::URLRequestJobFactoryImpl());
485 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); 483 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
486 main_job_factory_ = SetUpJobFactoryDefaults( 484 main_job_factory_ = SetUpJobFactoryDefaults(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 app_backend = new net::HttpCache::DefaultBackend( 579 app_backend = new net::HttpCache::DefaultBackend(
582 net::DISK_CACHE, 580 net::DISK_CACHE,
583 ChooseCacheBackendType(), 581 ChooseCacheBackendType(),
584 cache_path, 582 cache_path,
585 app_cache_max_size_, 583 app_cache_max_size_,
586 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) 584 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)
587 .get()); 585 .get());
588 } 586 }
589 net::HttpNetworkSession* main_network_session = 587 net::HttpNetworkSession* main_network_session =
590 main_http_factory_->GetSession(); 588 main_http_factory_->GetSession();
591 net::HttpCache* app_http_cache = 589 scoped_ptr<net::HttpCache> app_http_cache =
592 new net::HttpCache(main_network_session, app_backend); 590 CreateHttpFactory(main_network_session, app_backend);
593 591
594 scoped_refptr<net::CookieStore> cookie_store = NULL; 592 scoped_refptr<net::CookieStore> cookie_store = NULL;
595 if (partition_descriptor.in_memory) { 593 if (partition_descriptor.in_memory) {
596 cookie_store = content::CreateCookieStore(content::CookieStoreConfig()); 594 cookie_store = content::CreateCookieStore(content::CookieStoreConfig());
597 } else if (chrome_browser_net::ShouldUseInMemoryCookiesAndCache()) { 595 } else if (chrome_browser_net::ShouldUseInMemoryCookiesAndCache()) {
598 // Don't use existing cookies and use an in-memory store. 596 // Don't use existing cookies and use an in-memory store.
599 // TODO(creis): We should have a cookie delegate for notifying the cookie 597 // TODO(creis): We should have a cookie delegate for notifying the cookie
600 // extensions API, but we need to update it to understand isolated apps 598 // extensions API, but we need to update it to understand isolated apps
601 // first. 599 // first.
602 cookie_store = content::CreateCookieStore(content::CookieStoreConfig()); 600 cookie_store = content::CreateCookieStore(content::CookieStoreConfig());
(...skipping 14 matching lines...) Expand all
617 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, 615 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
618 NULL, NULL); 616 NULL, NULL);
619 cookie_config.crypto_delegate = 617 cookie_config.crypto_delegate =
620 chrome_browser_net::GetCookieCryptoDelegate(); 618 chrome_browser_net::GetCookieCryptoDelegate();
621 cookie_store = content::CreateCookieStore(cookie_config); 619 cookie_store = content::CreateCookieStore(cookie_config);
622 } 620 }
623 621
624 // Transfer ownership of the cookies and cache to AppRequestContext. 622 // Transfer ownership of the cookies and cache to AppRequestContext.
625 context->SetCookieStore(cookie_store.get()); 623 context->SetCookieStore(cookie_store.get());
626 context->SetHttpTransactionFactory( 624 context->SetHttpTransactionFactory(
627 scoped_ptr<net::HttpTransactionFactory>(app_http_cache)); 625 scoped_ptr<net::HttpTransactionFactory>(
626 app_http_cache.PassAs<net::HttpTransactionFactory>()));
628 627
629 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( 628 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
630 new net::URLRequestJobFactoryImpl()); 629 new net::URLRequestJobFactoryImpl());
631 InstallProtocolHandlers(job_factory.get(), protocol_handlers); 630 InstallProtocolHandlers(job_factory.get(), protocol_handlers);
632 scoped_ptr<net::URLRequestJobFactory> top_job_factory( 631 scoped_ptr<net::URLRequestJobFactory> top_job_factory(
633 SetUpJobFactoryDefaults(job_factory.Pass(), 632 SetUpJobFactoryDefaults(job_factory.Pass(),
634 protocol_interceptors.Pass(), 633 protocol_interceptors.Pass(),
635 protocol_handler_interceptor.Pass(), 634 protocol_handler_interceptor.Pass(),
636 network_delegate(), 635 network_delegate(),
637 ftp_factory_.get())); 636 ftp_factory_.get()));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 net::HttpCache::BackendFactory* media_backend = 669 net::HttpCache::BackendFactory* media_backend =
671 new net::HttpCache::DefaultBackend( 670 new net::HttpCache::DefaultBackend(
672 net::MEDIA_CACHE, 671 net::MEDIA_CACHE,
673 ChooseCacheBackendType(), 672 ChooseCacheBackendType(),
674 cache_path, 673 cache_path,
675 cache_max_size, 674 cache_max_size,
676 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) 675 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)
677 .get()); 676 .get());
678 net::HttpNetworkSession* main_network_session = 677 net::HttpNetworkSession* main_network_session =
679 main_http_factory_->GetSession(); 678 main_http_factory_->GetSession();
680 scoped_ptr<net::HttpTransactionFactory> media_http_cache( 679 scoped_ptr<net::HttpCache> media_http_cache =
681 new net::HttpCache(main_network_session, media_backend)); 680 CreateHttpFactory(main_network_session, media_backend);
682 681
683 // Transfer ownership of the cache to MediaRequestContext. 682 // Transfer ownership of the cache to MediaRequestContext.
684 context->SetHttpTransactionFactory(media_http_cache.Pass()); 683 context->SetHttpTransactionFactory(
684 media_http_cache.PassAs<net::HttpTransactionFactory>());
685 685
686 // Note that we do not create a new URLRequestJobFactory because 686 // Note that we do not create a new URLRequestJobFactory because
687 // the media context should behave exactly like its parent context 687 // the media context should behave exactly like its parent context
688 // in all respects except for cache behavior on media subresources. 688 // in all respects except for cache behavior on media subresources.
689 // The CopyFrom() step above means that our media context will use 689 // The CopyFrom() step above means that our media context will use
690 // the same URLRequestJobFactory instance that our parent context does. 690 // the same URLRequestJobFactory instance that our parent context does.
691 691
692 return context; 692 return context;
693 } 693 }
694 694
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 const base::Closure& completion) { 732 const base::Closure& completion) {
733 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 733 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
734 DCHECK(initialized()); 734 DCHECK(initialized());
735 735
736 DCHECK(transport_security_state()); 736 DCHECK(transport_security_state());
737 // Completes synchronously. 737 // Completes synchronously.
738 transport_security_state()->DeleteAllDynamicDataSince(time); 738 transport_security_state()->DeleteAllDynamicDataSince(time);
739 DCHECK(http_server_properties_manager_); 739 DCHECK(http_server_properties_manager_);
740 http_server_properties_manager_->Clear(completion); 740 http_server_properties_manager_->Clear(completion);
741 } 741 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698