OLD | NEW |
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_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // static | 426 // static |
427 ProfileIOData* ProfileIOData::FromResourceContext( | 427 ProfileIOData* ProfileIOData::FromResourceContext( |
428 content::ResourceContext* rc) { | 428 content::ResourceContext* rc) { |
429 return (static_cast<ResourceContext*>(rc))->io_data_; | 429 return (static_cast<ResourceContext*>(rc))->io_data_; |
430 } | 430 } |
431 | 431 |
432 // static | 432 // static |
433 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { | 433 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { |
434 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); | 434 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); |
435 static const char* const kProtocolList[] = { | 435 static const char* const kProtocolList[] = { |
| 436 chrome::kFileScheme, |
| 437 chrome::kChromeDevToolsScheme, |
436 extensions::kExtensionScheme, | 438 extensions::kExtensionScheme, |
| 439 chrome::kExtensionResourceScheme, |
437 chrome::kChromeUIScheme, | 440 chrome::kChromeUIScheme, |
438 chrome::kChromeDevToolsScheme, | 441 chrome::kDataScheme, |
439 #if defined(OS_CHROMEOS) | 442 #if defined(OS_CHROMEOS) |
440 chrome::kMetadataScheme, | |
441 chrome::kDriveScheme, | 443 chrome::kDriveScheme, |
442 #endif // defined(OS_CHROMEOS) | 444 #endif // defined(OS_CHROMEOS) |
| 445 chrome::kAboutScheme, |
| 446 #if !defined(DISABLE_FTP_SUPPORT) |
| 447 chrome::kFtpScheme, |
| 448 #endif // !defined(DISABLE_FTP_SUPPORT) |
443 chrome::kBlobScheme, | 449 chrome::kBlobScheme, |
444 chrome::kFileSystemScheme, | 450 chrome::kFileSystemScheme, |
445 chrome::kExtensionResourceScheme, | |
446 chrome::kChromeSearchScheme, | 451 chrome::kChromeSearchScheme, |
447 }; | 452 }; |
448 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { | 453 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { |
449 if (scheme == kProtocolList[i]) | 454 if (scheme == kProtocolList[i]) |
450 return true; | 455 return true; |
451 } | 456 } |
452 return net::URLRequest::IsHandledProtocol(scheme); | 457 return net::URLRequest::IsHandledProtocol(scheme); |
453 } | 458 } |
454 | 459 |
455 // static | 460 // static |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 context->set_http_user_agent_settings( | 731 context->set_http_user_agent_settings( |
727 chrome_http_user_agent_settings_.get()); | 732 chrome_http_user_agent_settings_.get()); |
728 context->set_ssl_config_service(profile_params_->ssl_config_service); | 733 context->set_ssl_config_service(profile_params_->ssl_config_service); |
729 } | 734 } |
730 | 735 |
731 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( | 736 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( |
732 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, | 737 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, |
733 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 738 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
734 protocol_handler_interceptor, | 739 protocol_handler_interceptor, |
735 net::NetworkDelegate* network_delegate, | 740 net::NetworkDelegate* network_delegate, |
736 net::FtpTransactionFactory* ftp_transaction_factory, | 741 net::FtpTransactionFactory* ftp_transaction_factory) const { |
737 net::FtpAuthCache* ftp_auth_cache) const { | |
738 // NOTE(willchan): Keep these protocol handlers in sync with | 742 // NOTE(willchan): Keep these protocol handlers in sync with |
739 // ProfileIOData::IsHandledProtocol(). | 743 // ProfileIOData::IsHandledProtocol(). |
740 bool set_protocol = job_factory->SetProtocolHandler( | 744 bool set_protocol = job_factory->SetProtocolHandler( |
741 chrome::kFileScheme, new net::FileProtocolHandler()); | 745 chrome::kFileScheme, new net::FileProtocolHandler()); |
742 DCHECK(set_protocol); | 746 DCHECK(set_protocol); |
743 | 747 |
744 DCHECK(extension_info_map_); | 748 DCHECK(extension_info_map_); |
745 set_protocol = job_factory->SetProtocolHandler( | 749 set_protocol = job_factory->SetProtocolHandler( |
746 extensions::kExtensionScheme, | 750 extensions::kExtensionScheme, |
747 CreateExtensionProtocolHandler(is_incognito(), extension_info_map_)); | 751 CreateExtensionProtocolHandler(is_incognito(), extension_info_map_)); |
(...skipping 14 matching lines...) Expand all Loading... |
762 } | 766 } |
763 #endif // defined(OS_CHROMEOS) | 767 #endif // defined(OS_CHROMEOS) |
764 | 768 |
765 job_factory->SetProtocolHandler( | 769 job_factory->SetProtocolHandler( |
766 chrome::kAboutScheme, | 770 chrome::kAboutScheme, |
767 new chrome_browser_net::AboutProtocolHandler()); | 771 new chrome_browser_net::AboutProtocolHandler()); |
768 #if !defined(DISABLE_FTP_SUPPORT) | 772 #if !defined(DISABLE_FTP_SUPPORT) |
769 DCHECK(ftp_transaction_factory); | 773 DCHECK(ftp_transaction_factory); |
770 job_factory->SetProtocolHandler( | 774 job_factory->SetProtocolHandler( |
771 chrome::kFtpScheme, | 775 chrome::kFtpScheme, |
772 new net::FtpProtocolHandler(ftp_transaction_factory, | 776 new net::FtpProtocolHandler(ftp_transaction_factory)); |
773 ftp_auth_cache)); | |
774 #endif // !defined(DISABLE_FTP_SUPPORT) | 777 #endif // !defined(DISABLE_FTP_SUPPORT) |
775 | 778 |
776 scoped_ptr<net::URLRequestJobFactory> top_job_factory = | 779 scoped_ptr<net::URLRequestJobFactory> top_job_factory = |
777 job_factory.PassAs<net::URLRequestJobFactory>(); | 780 job_factory.PassAs<net::URLRequestJobFactory>(); |
778 #if defined(DEBUG_DEVTOOLS) | 781 #if defined(DEBUG_DEVTOOLS) |
779 top_job_factory.reset(new net::ProtocolInterceptJobFactory( | 782 top_job_factory.reset(new net::ProtocolInterceptJobFactory( |
780 top_job_factory.Pass(), | 783 top_job_factory.Pass(), |
781 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>( | 784 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>( |
782 new DebugDevToolsInterceptor))); | 785 new DebugDevToolsInterceptor))); |
783 #endif | 786 #endif |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 void ProfileIOData::SetCookieSettingsForTesting( | 860 void ProfileIOData::SetCookieSettingsForTesting( |
858 CookieSettings* cookie_settings) { | 861 CookieSettings* cookie_settings) { |
859 DCHECK(!cookie_settings_); | 862 DCHECK(!cookie_settings_); |
860 cookie_settings_ = cookie_settings; | 863 cookie_settings_ = cookie_settings; |
861 } | 864 } |
862 | 865 |
863 void ProfileIOData::set_signin_names_for_testing( | 866 void ProfileIOData::set_signin_names_for_testing( |
864 SigninNamesOnIOThread* signin_names) { | 867 SigninNamesOnIOThread* signin_names) { |
865 signin_names_.reset(signin_names); | 868 signin_names_.reset(signin_names); |
866 } | 869 } |
OLD | NEW |