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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // static | 407 // static |
408 ProfileIOData* ProfileIOData::FromResourceContext( | 408 ProfileIOData* ProfileIOData::FromResourceContext( |
409 content::ResourceContext* rc) { | 409 content::ResourceContext* rc) { |
410 return (static_cast<ResourceContext*>(rc))->io_data_; | 410 return (static_cast<ResourceContext*>(rc))->io_data_; |
411 } | 411 } |
412 | 412 |
413 // static | 413 // static |
414 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { | 414 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { |
415 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); | 415 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); |
416 static const char* const kProtocolList[] = { | 416 static const char* const kProtocolList[] = { |
| 417 chrome::kFileScheme, |
| 418 chrome::kChromeDevToolsScheme, |
417 extensions::kExtensionScheme, | 419 extensions::kExtensionScheme, |
| 420 chrome::kExtensionResourceScheme, |
418 chrome::kChromeUIScheme, | 421 chrome::kChromeUIScheme, |
419 chrome::kChromeDevToolsScheme, | 422 chrome::kDataScheme, |
420 #if defined(OS_CHROMEOS) | 423 #if defined(OS_CHROMEOS) |
421 chrome::kMetadataScheme, | |
422 chrome::kDriveScheme, | 424 chrome::kDriveScheme, |
423 #endif // defined(OS_CHROMEOS) | 425 #endif // defined(OS_CHROMEOS) |
| 426 chrome::kAboutScheme, |
| 427 #if !defined(DISABLE_FTP_SUPPORT) |
| 428 chrome::kFtpScheme, |
| 429 #endif // !defined(DISABLE_FTP_SUPPORT) |
424 chrome::kBlobScheme, | 430 chrome::kBlobScheme, |
425 chrome::kFileSystemScheme, | 431 chrome::kFileSystemScheme |
426 chrome::kExtensionResourceScheme, | |
427 }; | 432 }; |
428 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { | 433 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { |
429 if (scheme == kProtocolList[i]) | 434 if (scheme == kProtocolList[i]) |
430 return true; | 435 return true; |
431 } | 436 } |
432 return net::URLRequest::IsHandledProtocol(scheme); | 437 return net::URLRequest::IsHandledProtocol(scheme); |
433 } | 438 } |
434 | 439 |
435 bool ProfileIOData::IsHandledURL(const GURL& url) { | 440 bool ProfileIOData::IsHandledURL(const GURL& url) { |
436 if (!url.is_valid()) { | 441 if (!url.is_valid()) { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 context->set_http_user_agent_settings( | 709 context->set_http_user_agent_settings( |
705 chrome_http_user_agent_settings_.get()); | 710 chrome_http_user_agent_settings_.get()); |
706 context->set_ssl_config_service(profile_params_->ssl_config_service); | 711 context->set_ssl_config_service(profile_params_->ssl_config_service); |
707 } | 712 } |
708 | 713 |
709 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( | 714 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( |
710 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, | 715 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, |
711 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 716 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
712 protocol_handler_interceptor, | 717 protocol_handler_interceptor, |
713 net::NetworkDelegate* network_delegate, | 718 net::NetworkDelegate* network_delegate, |
714 net::FtpTransactionFactory* ftp_transaction_factory, | 719 net::FtpTransactionFactory* ftp_transaction_factory) const { |
715 net::FtpAuthCache* ftp_auth_cache) const { | |
716 // NOTE(willchan): Keep these protocol handlers in sync with | 720 // NOTE(willchan): Keep these protocol handlers in sync with |
717 // ProfileIOData::IsHandledProtocol(). | 721 // ProfileIOData::IsHandledProtocol(). |
718 bool set_protocol = job_factory->SetProtocolHandler( | 722 bool set_protocol = job_factory->SetProtocolHandler( |
719 chrome::kFileScheme, new net::FileProtocolHandler()); | 723 chrome::kFileScheme, new net::FileProtocolHandler()); |
720 DCHECK(set_protocol); | 724 DCHECK(set_protocol); |
721 | 725 |
722 DCHECK(extension_info_map_); | 726 DCHECK(extension_info_map_); |
723 set_protocol = job_factory->SetProtocolHandler( | 727 set_protocol = job_factory->SetProtocolHandler( |
724 extensions::kExtensionScheme, | 728 extensions::kExtensionScheme, |
725 CreateExtensionProtocolHandler(is_incognito(), extension_info_map_)); | 729 CreateExtensionProtocolHandler(is_incognito(), extension_info_map_)); |
(...skipping 14 matching lines...) Expand all Loading... |
740 } | 744 } |
741 #endif // defined(OS_CHROMEOS) | 745 #endif // defined(OS_CHROMEOS) |
742 | 746 |
743 job_factory->SetProtocolHandler( | 747 job_factory->SetProtocolHandler( |
744 chrome::kAboutScheme, | 748 chrome::kAboutScheme, |
745 new chrome_browser_net::AboutProtocolHandler()); | 749 new chrome_browser_net::AboutProtocolHandler()); |
746 #if !defined(DISABLE_FTP_SUPPORT) | 750 #if !defined(DISABLE_FTP_SUPPORT) |
747 DCHECK(ftp_transaction_factory); | 751 DCHECK(ftp_transaction_factory); |
748 job_factory->SetProtocolHandler( | 752 job_factory->SetProtocolHandler( |
749 chrome::kFtpScheme, | 753 chrome::kFtpScheme, |
750 new net::FtpProtocolHandler(ftp_transaction_factory, | 754 new net::FtpProtocolHandler(ftp_transaction_factory)); |
751 ftp_auth_cache)); | |
752 #endif // !defined(DISABLE_FTP_SUPPORT) | 755 #endif // !defined(DISABLE_FTP_SUPPORT) |
753 | 756 |
754 scoped_ptr<net::URLRequestJobFactory> top_job_factory = | 757 scoped_ptr<net::URLRequestJobFactory> top_job_factory = |
755 job_factory.PassAs<net::URLRequestJobFactory>(); | 758 job_factory.PassAs<net::URLRequestJobFactory>(); |
756 #if defined(DEBUG_DEVTOOLS) | 759 #if defined(DEBUG_DEVTOOLS) |
757 top_job_factory.reset(new net::ProtocolInterceptJobFactory( | 760 top_job_factory.reset(new net::ProtocolInterceptJobFactory( |
758 top_job_factory.Pass(), | 761 top_job_factory.Pass(), |
759 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>( | 762 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>( |
760 new DebugDevToolsInterceptor))); | 763 new DebugDevToolsInterceptor))); |
761 #endif | 764 #endif |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 void ProfileIOData::SetCookieSettingsForTesting( | 837 void ProfileIOData::SetCookieSettingsForTesting( |
835 CookieSettings* cookie_settings) { | 838 CookieSettings* cookie_settings) { |
836 DCHECK(!cookie_settings_.get()); | 839 DCHECK(!cookie_settings_.get()); |
837 cookie_settings_ = cookie_settings; | 840 cookie_settings_ = cookie_settings; |
838 } | 841 } |
839 | 842 |
840 void ProfileIOData::set_signin_names_for_testing( | 843 void ProfileIOData::set_signin_names_for_testing( |
841 SigninNamesOnIOThread* signin_names) { | 844 SigninNamesOnIOThread* signin_names) { |
842 signin_names_.reset(signin_names); | 845 signin_names_.reset(signin_names); |
843 } | 846 } |
OLD | NEW |