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

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

Issue 11154006: Change initialization interface of URLRequestJobFactory objects. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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 (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/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 #if !defined(DISABLE_FTP_SUPPORT) 436 #if !defined(DISABLE_FTP_SUPPORT)
437 ftp_factory_.reset( 437 ftp_factory_.reset(
438 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); 438 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get()));
439 main_context->set_ftp_transaction_factory(ftp_factory_.get()); 439 main_context->set_ftp_transaction_factory(ftp_factory_.get());
440 extensions_context->set_ftp_transaction_factory(ftp_factory_.get()); 440 extensions_context->set_ftp_transaction_factory(ftp_factory_.get());
441 #endif // !defined(DISABLE_FTP_SUPPORT) 441 #endif // !defined(DISABLE_FTP_SUPPORT)
442 442
443 main_context->set_chrome_url_data_manager_backend( 443 main_context->set_chrome_url_data_manager_backend(
444 chrome_url_data_manager_backend()); 444 chrome_url_data_manager_backend());
445 445
446 main_job_factory_.reset(new net::URLRequestJobFactoryImpl); 446 net::URLRequestJobFactoryImpl* main_job_factory =
erikwright (departed) 2012/10/15 15:35:34 same comments as previous file.
447 extensions_job_factory_.reset(new net::URLRequestJobFactoryImpl); 447 new net::URLRequestJobFactoryImpl();
448 main_job_factory_.reset(main_job_factory);
449 net::URLRequestJobFactoryImpl* extensions_job_factory =
450 new net::URLRequestJobFactoryImpl();
451 extensions_job_factory_.reset(extensions_job_factory);
448 452
449 SetUpJobFactory(main_job_factory_.get(), 453 SetUpJobFactory(main_job_factory,
450 profile_params->protocol_handler_interceptor.Pass(), 454 profile_params->protocol_handler_interceptor.Pass(),
451 network_delegate(), 455 network_delegate(),
452 main_context->ftp_transaction_factory(), 456 main_context->ftp_transaction_factory(),
453 main_context->ftp_auth_cache()); 457 main_context->ftp_auth_cache());
454 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. 458 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate.
455 // Without a network_delegate, this protocol handler will never 459 // Without a network_delegate, this protocol handler will never
456 // handle file: requests, but as a side effect it makes 460 // handle file: requests, but as a side effect it makes
457 // job_factory::IsHandledProtocol return true, which prevents attempts to 461 // job_factory::IsHandledProtocol return true, which prevents attempts to
458 // handle the protocol externally. We pass NULL in to 462 // handle the protocol externally. We pass NULL in to
459 // SetUpJobFactory() to get this effect. 463 // SetUpJobFactory() to get this effect.
460 SetUpJobFactory(extensions_job_factory_.get(), 464 SetUpJobFactory(extensions_job_factory,
461 scoped_ptr<net::URLRequestJobFactoryImpl::Interceptor>(NULL), 465 scoped_ptr<net::URLRequestJobFactoryImpl::Interceptor>(NULL),
462 NULL, 466 NULL,
463 extensions_context->ftp_transaction_factory(), 467 extensions_context->ftp_transaction_factory(),
464 extensions_context->ftp_auth_cache()); 468 extensions_context->ftp_auth_cache());
465 469
466 main_context->set_job_factory(main_job_factory_.get()); 470 main_context->set_job_factory(main_job_factory_.get());
467 extensions_context->set_job_factory(extensions_job_factory_.get()); 471 extensions_context->set_job_factory(extensions_job_factory_.get());
468 472
469 // Create a media request context based on the main context, but using a 473 // Create a media request context based on the main context, but using a
470 // media cache. It shares the same job factory as the main context. 474 // media cache. It shares the same job factory as the main context.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 cookie_store = new net::CookieMonster(cookie_db.get(), NULL); 547 cookie_store = new net::CookieMonster(cookie_db.get(), NULL);
544 } 548 }
545 549
546 // Transfer ownership of the cookies and cache to AppRequestContext. 550 // Transfer ownership of the cookies and cache to AppRequestContext.
547 context->SetCookieStore(cookie_store); 551 context->SetCookieStore(cookie_store);
548 context->SetHttpTransactionFactory( 552 context->SetHttpTransactionFactory(
549 scoped_ptr<net::HttpTransactionFactory>(app_http_cache)); 553 scoped_ptr<net::HttpTransactionFactory>(app_http_cache));
550 554
551 // Overwrite the job factory that we inherit from the main context so 555 // Overwrite the job factory that we inherit from the main context so
552 // that we can later provide our own handles for storage related protocols. 556 // that we can later provide our own handles for storage related protocols.
553 scoped_ptr<net::URLRequestJobFactory> job_factory( 557 net::URLRequestJobFactoryImpl* factory_impl =
erikwright (departed) 2012/10/15 15:35:34 same comments as previous file.
554 new net::URLRequestJobFactoryImpl()); 558 new net::URLRequestJobFactoryImpl();
555 SetUpJobFactory(job_factory.get(), protocol_handler_interceptor.Pass(), 559 scoped_ptr<net::URLRequestJobFactory> job_factory(factory_impl);
560 SetUpJobFactory(factory_impl, protocol_handler_interceptor.Pass(),
556 network_delegate(), 561 network_delegate(),
557 context->ftp_transaction_factory(), 562 context->ftp_transaction_factory(),
558 context->ftp_auth_cache()); 563 context->ftp_auth_cache());
559 context->SetJobFactory(job_factory.Pass()); 564 context->SetJobFactory(job_factory.Pass());
560 565
561 return context; 566 return context;
562 } 567 }
563 568
564 ChromeURLRequestContext* 569 ChromeURLRequestContext*
565 ProfileImplIOData::InitializeMediaRequestContext( 570 ProfileImplIOData::InitializeMediaRequestContext(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 DCHECK(media_request_context); 646 DCHECK(media_request_context);
642 return media_request_context; 647 return media_request_context;
643 } 648 }
644 649
645 chrome_browser_net::LoadTimeStats* ProfileImplIOData::GetLoadTimeStats( 650 chrome_browser_net::LoadTimeStats* ProfileImplIOData::GetLoadTimeStats(
646 IOThread::Globals* io_thread_globals) const { 651 IOThread::Globals* io_thread_globals) const {
647 return io_thread_globals->load_time_stats.get(); 652 return io_thread_globals->load_time_stats.get();
648 } 653 }
649 654
650 void ProfileImplIOData::SetUpJobFactory( 655 void ProfileImplIOData::SetUpJobFactory(
651 net::URLRequestJobFactory* job_factory, 656 net::URLRequestJobFactoryImpl* job_factory,
652 scoped_ptr<net::URLRequestJobFactory::Interceptor> 657 scoped_ptr<net::URLRequestJobFactory::Interceptor>
653 protocol_handler_interceptor, 658 protocol_handler_interceptor,
654 net::NetworkDelegate* network_delegate, 659 net::NetworkDelegate* network_delegate,
655 net::FtpTransactionFactory* ftp_transaction_factory, 660 net::FtpTransactionFactory* ftp_transaction_factory,
656 net::FtpAuthCache* ftp_auth_cache) const { 661 net::FtpAuthCache* ftp_auth_cache) const {
657 SetUpJobFactoryDefaults(job_factory, protocol_handler_interceptor.Pass(), 662 SetUpJobFactoryDefaults(job_factory, protocol_handler_interceptor.Pass(),
658 network_delegate, ftp_transaction_factory, 663 network_delegate, ftp_transaction_factory,
659 ftp_auth_cache); 664 ftp_auth_cache);
660 665
661 job_factory->AddInterceptor( 666 job_factory->AddInterceptor(
662 new chrome_browser_net::ConnectInterceptor(predictor_.get())); 667 new chrome_browser_net::ConnectInterceptor(predictor_.get()));
663 } 668 }
664 669
665 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 670 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
666 base::Time time) { 671 base::Time time) {
667 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 672 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
668 LazyInitialize(); 673 LazyInitialize();
669 674
670 DCHECK(transport_security_state()); 675 DCHECK(transport_security_state());
671 transport_security_state()->DeleteSince(time); 676 transport_security_state()->DeleteSince(time);
672 DCHECK(http_server_properties_manager()); 677 DCHECK(http_server_properties_manager());
673 http_server_properties_manager()->Clear(); 678 http_server_properties_manager()->Clear();
674 } 679 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698