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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 // static | 326 // static |
327 ProfileIOData* ProfileIOData::FromResourceContext( | 327 ProfileIOData* ProfileIOData::FromResourceContext( |
328 content::ResourceContext* rc) { | 328 content::ResourceContext* rc) { |
329 return (static_cast<ResourceContext*>(rc))->io_data_; | 329 return (static_cast<ResourceContext*>(rc))->io_data_; |
330 } | 330 } |
331 | 331 |
332 // static | 332 // static |
333 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { | 333 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { |
334 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); | 334 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); |
335 static const char* const kProtocolList[] = { | 335 static const char* const kProtocolList[] = { |
336 chrome::kFileScheme, | |
337 chrome::kChromeDevToolsScheme, | |
mmenke
2013/01/22 16:50:37
Why change the order of this and kExtensionResourc
pauljensen
2013/01/23 21:43:33
To better match ProfileIOData::SetUpJobFactoryDefa
| |
336 extensions::kExtensionScheme, | 338 extensions::kExtensionScheme, |
339 chrome::kExtensionResourceScheme, | |
337 chrome::kChromeUIScheme, | 340 chrome::kChromeUIScheme, |
338 chrome::kChromeDevToolsScheme, | 341 chrome::kDataScheme, |
339 #if defined(OS_CHROMEOS) | 342 #if defined(OS_CHROMEOS) |
340 chrome::kMetadataScheme, | |
mmenke
2013/01/22 16:50:37
Why are you removing this?
pauljensen
2013/01/23 21:43:33
It was added in r85556 along with the ProtocolHand
| |
341 chrome::kDriveScheme, | 343 chrome::kDriveScheme, |
342 #endif // defined(OS_CHROMEOS) | 344 #endif // defined(OS_CHROMEOS) |
345 chrome::kAboutScheme, | |
346 #if !defined(DISABLE_FTP_SUPPORT) | |
347 chrome::kFtpScheme, | |
348 #endif // !defined(DISABLE_FTP_SUPPORT) | |
343 chrome::kBlobScheme, | 349 chrome::kBlobScheme, |
344 chrome::kFileSystemScheme, | 350 chrome::kFileSystemScheme |
345 chrome::kExtensionResourceScheme, | |
346 }; | 351 }; |
347 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { | 352 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { |
348 if (scheme == kProtocolList[i]) | 353 if (scheme == kProtocolList[i]) |
349 return true; | 354 return true; |
350 } | 355 } |
351 return net::URLRequest::IsHandledProtocol(scheme); | 356 return net::URLRequest::IsHandledProtocol(scheme); |
352 } | 357 } |
353 | 358 |
354 bool ProfileIOData::IsHandledURL(const GURL& url) { | 359 bool ProfileIOData::IsHandledURL(const GURL& url) { |
355 if (!url.is_valid()) { | 360 if (!url.is_valid()) { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 context->set_http_user_agent_settings( | 610 context->set_http_user_agent_settings( |
606 chrome_http_user_agent_settings_.get()); | 611 chrome_http_user_agent_settings_.get()); |
607 context->set_ssl_config_service(profile_params_->ssl_config_service); | 612 context->set_ssl_config_service(profile_params_->ssl_config_service); |
608 } | 613 } |
609 | 614 |
610 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( | 615 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( |
611 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, | 616 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, |
612 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 617 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
613 protocol_handler_interceptor, | 618 protocol_handler_interceptor, |
614 net::NetworkDelegate* network_delegate, | 619 net::NetworkDelegate* network_delegate, |
615 net::FtpTransactionFactory* ftp_transaction_factory, | 620 net::FtpTransactionFactory* ftp_transaction_factory) const { |
616 net::FtpAuthCache* ftp_auth_cache) const { | |
617 // NOTE(willchan): Keep these protocol handlers in sync with | 621 // NOTE(willchan): Keep these protocol handlers in sync with |
618 // ProfileIOData::IsHandledProtocol(). | 622 // ProfileIOData::IsHandledProtocol(). |
619 bool set_protocol = job_factory->SetProtocolHandler( | 623 bool set_protocol = job_factory->SetProtocolHandler( |
620 chrome::kFileScheme, new net::FileProtocolHandler()); | 624 chrome::kFileScheme, new net::FileProtocolHandler()); |
621 DCHECK(set_protocol); | 625 DCHECK(set_protocol); |
622 | 626 |
623 set_protocol = job_factory->SetProtocolHandler( | 627 set_protocol = job_factory->SetProtocolHandler( |
624 chrome::kChromeDevToolsScheme, | 628 chrome::kChromeDevToolsScheme, |
625 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(), | 629 CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(), |
626 network_delegate, is_incognito())); | 630 network_delegate, is_incognito())); |
(...skipping 24 matching lines...) Expand all Loading... | |
651 } | 655 } |
652 #endif // defined(OS_CHROMEOS) | 656 #endif // defined(OS_CHROMEOS) |
653 | 657 |
654 job_factory->SetProtocolHandler( | 658 job_factory->SetProtocolHandler( |
655 chrome::kAboutScheme, | 659 chrome::kAboutScheme, |
656 new chrome_browser_net::AboutProtocolHandler()); | 660 new chrome_browser_net::AboutProtocolHandler()); |
657 #if !defined(DISABLE_FTP_SUPPORT) | 661 #if !defined(DISABLE_FTP_SUPPORT) |
658 DCHECK(ftp_transaction_factory); | 662 DCHECK(ftp_transaction_factory); |
659 job_factory->SetProtocolHandler( | 663 job_factory->SetProtocolHandler( |
660 chrome::kFtpScheme, | 664 chrome::kFtpScheme, |
661 new net::FtpProtocolHandler(ftp_transaction_factory, | 665 new net::FtpProtocolHandler(ftp_transaction_factory)); |
662 ftp_auth_cache)); | |
663 #endif // !defined(DISABLE_FTP_SUPPORT) | 666 #endif // !defined(DISABLE_FTP_SUPPORT) |
664 | 667 |
665 if (protocol_handler_interceptor) { | 668 if (protocol_handler_interceptor) { |
666 protocol_handler_interceptor->Chain( | 669 protocol_handler_interceptor->Chain( |
667 job_factory.PassAs<net::URLRequestJobFactory>()); | 670 job_factory.PassAs<net::URLRequestJobFactory>()); |
668 return protocol_handler_interceptor.PassAs<net::URLRequestJobFactory>(); | 671 return protocol_handler_interceptor.PassAs<net::URLRequestJobFactory>(); |
669 } else { | 672 } else { |
670 return job_factory.PassAs<net::URLRequestJobFactory>(); | 673 return job_factory.PassAs<net::URLRequestJobFactory>(); |
671 } | 674 } |
672 } | 675 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
737 void ProfileIOData::SetCookieSettingsForTesting( | 740 void ProfileIOData::SetCookieSettingsForTesting( |
738 CookieSettings* cookie_settings) { | 741 CookieSettings* cookie_settings) { |
739 DCHECK(!cookie_settings_.get()); | 742 DCHECK(!cookie_settings_.get()); |
740 cookie_settings_ = cookie_settings; | 743 cookie_settings_ = cookie_settings; |
741 } | 744 } |
742 | 745 |
743 void ProfileIOData::set_signin_names_for_testing( | 746 void ProfileIOData::set_signin_names_for_testing( |
744 SigninNamesOnIOThread* signin_names) { | 747 SigninNamesOnIOThread* signin_names) { |
745 signin_names_.reset(signin_names); | 748 signin_names_.reset(signin_names); |
746 } | 749 } |
OLD | NEW |