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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // static | 325 // static |
326 ProfileIOData* ProfileIOData::FromResourceContext( | 326 ProfileIOData* ProfileIOData::FromResourceContext( |
327 content::ResourceContext* rc) { | 327 content::ResourceContext* rc) { |
328 return (static_cast<ResourceContext*>(rc))->io_data_; | 328 return (static_cast<ResourceContext*>(rc))->io_data_; |
329 } | 329 } |
330 | 330 |
331 // static | 331 // static |
332 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { | 332 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { |
333 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); | 333 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); |
334 static const char* const kProtocolList[] = { | 334 static const char* const kProtocolList[] = { |
| 335 chrome::kFileScheme, |
| 336 chrome::kChromeDevToolsScheme, |
335 extensions::kExtensionScheme, | 337 extensions::kExtensionScheme, |
| 338 chrome::kExtensionResourceScheme, |
336 chrome::kChromeUIScheme, | 339 chrome::kChromeUIScheme, |
337 chrome::kChromeDevToolsScheme, | 340 chrome::kDataScheme, |
338 #if defined(OS_CHROMEOS) | 341 #if defined(OS_CHROMEOS) |
339 chrome::kMetadataScheme, | |
340 chrome::kDriveScheme, | 342 chrome::kDriveScheme, |
341 #endif // defined(OS_CHROMEOS) | 343 #endif // defined(OS_CHROMEOS) |
| 344 chrome::kAboutScheme, |
| 345 #if !defined(DISABLE_FTP_SUPPORT) |
| 346 chrome::kFtpScheme, |
| 347 #endif // !defined(DISABLE_FTP_SUPPORT) |
342 chrome::kBlobScheme, | 348 chrome::kBlobScheme, |
343 chrome::kFileSystemScheme, | 349 chrome::kFileSystemScheme |
344 chrome::kExtensionResourceScheme, | |
345 }; | 350 }; |
346 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { | 351 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { |
347 if (scheme == kProtocolList[i]) | 352 if (scheme == kProtocolList[i]) |
348 return true; | 353 return true; |
349 } | 354 } |
350 return net::URLRequest::IsHandledProtocol(scheme); | 355 return net::URLRequest::IsHandledProtocol(scheme); |
351 } | 356 } |
352 | 357 |
353 bool ProfileIOData::IsHandledURL(const GURL& url) { | 358 bool ProfileIOData::IsHandledURL(const GURL& url) { |
354 if (!url.is_valid()) { | 359 if (!url.is_valid()) { |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 context->set_http_user_agent_settings( | 607 context->set_http_user_agent_settings( |
603 chrome_http_user_agent_settings_.get()); | 608 chrome_http_user_agent_settings_.get()); |
604 context->set_ssl_config_service(profile_params_->ssl_config_service); | 609 context->set_ssl_config_service(profile_params_->ssl_config_service); |
605 } | 610 } |
606 | 611 |
607 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( | 612 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( |
608 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, | 613 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, |
609 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 614 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
610 protocol_handler_interceptor, | 615 protocol_handler_interceptor, |
611 net::NetworkDelegate* network_delegate, | 616 net::NetworkDelegate* network_delegate, |
612 net::FtpTransactionFactory* ftp_transaction_factory, | 617 net::FtpTransactionFactory* ftp_transaction_factory) const { |
613 net::FtpAuthCache* ftp_auth_cache) const { | |
614 // NOTE(willchan): Keep these protocol handlers in sync with | 618 // NOTE(willchan): Keep these protocol handlers in sync with |
615 // ProfileIOData::IsHandledProtocol(). | 619 // ProfileIOData::IsHandledProtocol(). |
616 bool set_protocol = job_factory->SetProtocolHandler( | 620 bool set_protocol = job_factory->SetProtocolHandler( |
617 chrome::kFileScheme, new net::FileProtocolHandler()); | 621 chrome::kFileScheme, new net::FileProtocolHandler()); |
618 DCHECK(set_protocol); | 622 DCHECK(set_protocol); |
619 | 623 |
620 set_protocol = job_factory->SetProtocolHandler( | 624 set_protocol = job_factory->SetProtocolHandler( |
621 chrome::kChromeDevToolsScheme, | 625 chrome::kChromeDevToolsScheme, |
622 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(), | 626 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(), |
623 network_delegate)); | 627 network_delegate)); |
(...skipping 23 matching lines...) Expand all Loading... |
647 } | 651 } |
648 #endif // defined(OS_CHROMEOS) | 652 #endif // defined(OS_CHROMEOS) |
649 | 653 |
650 job_factory->SetProtocolHandler( | 654 job_factory->SetProtocolHandler( |
651 chrome::kAboutScheme, | 655 chrome::kAboutScheme, |
652 new chrome_browser_net::AboutProtocolHandler()); | 656 new chrome_browser_net::AboutProtocolHandler()); |
653 #if !defined(DISABLE_FTP_SUPPORT) | 657 #if !defined(DISABLE_FTP_SUPPORT) |
654 DCHECK(ftp_transaction_factory); | 658 DCHECK(ftp_transaction_factory); |
655 job_factory->SetProtocolHandler( | 659 job_factory->SetProtocolHandler( |
656 chrome::kFtpScheme, | 660 chrome::kFtpScheme, |
657 new net::FtpProtocolHandler(ftp_transaction_factory, | 661 new net::FtpProtocolHandler(ftp_transaction_factory)); |
658 ftp_auth_cache)); | |
659 #endif // !defined(DISABLE_FTP_SUPPORT) | 662 #endif // !defined(DISABLE_FTP_SUPPORT) |
660 | 663 |
661 if (protocol_handler_interceptor) { | 664 if (protocol_handler_interceptor) { |
662 protocol_handler_interceptor->Chain( | 665 protocol_handler_interceptor->Chain( |
663 job_factory.PassAs<net::URLRequestJobFactory>()); | 666 job_factory.PassAs<net::URLRequestJobFactory>()); |
664 return protocol_handler_interceptor.PassAs<net::URLRequestJobFactory>(); | 667 return protocol_handler_interceptor.PassAs<net::URLRequestJobFactory>(); |
665 } else { | 668 } else { |
666 return job_factory.PassAs<net::URLRequestJobFactory>(); | 669 return job_factory.PassAs<net::URLRequestJobFactory>(); |
667 } | 670 } |
668 } | 671 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 void ProfileIOData::SetCookieSettingsForTesting( | 735 void ProfileIOData::SetCookieSettingsForTesting( |
733 CookieSettings* cookie_settings) { | 736 CookieSettings* cookie_settings) { |
734 DCHECK(!cookie_settings_.get()); | 737 DCHECK(!cookie_settings_.get()); |
735 cookie_settings_ = cookie_settings; | 738 cookie_settings_ = cookie_settings; |
736 } | 739 } |
737 | 740 |
738 void ProfileIOData::set_signin_names_for_testing( | 741 void ProfileIOData::set_signin_names_for_testing( |
739 SigninNamesOnIOThread* signin_names) { | 742 SigninNamesOnIOThread* signin_names) { |
740 signin_names_.reset(signin_names); | 743 signin_names_.reset(signin_names); |
741 } | 744 } |
OLD | NEW |