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