| 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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 // static | 605 // static |
| 606 ProfileIOData* ProfileIOData::FromResourceContext( | 606 ProfileIOData* ProfileIOData::FromResourceContext( |
| 607 content::ResourceContext* rc) { | 607 content::ResourceContext* rc) { |
| 608 return (static_cast<ResourceContext*>(rc))->io_data_; | 608 return (static_cast<ResourceContext*>(rc))->io_data_; |
| 609 } | 609 } |
| 610 | 610 |
| 611 // static | 611 // static |
| 612 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { | 612 bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { |
| 613 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); | 613 DCHECK_EQ(scheme, StringToLowerASCII(scheme)); |
| 614 static const char* const kProtocolList[] = { | 614 static const char* const kProtocolList[] = { |
| 615 content::kFileScheme, | 615 url::kFileScheme, |
| 616 content::kChromeDevToolsScheme, | 616 content::kChromeDevToolsScheme, |
| 617 chrome::kDomDistillerScheme, | 617 chrome::kDomDistillerScheme, |
| 618 extensions::kExtensionScheme, | 618 extensions::kExtensionScheme, |
| 619 extensions::kExtensionResourceScheme, | 619 extensions::kExtensionResourceScheme, |
| 620 content::kChromeUIScheme, | 620 content::kChromeUIScheme, |
| 621 content::kDataScheme, | 621 url::kDataScheme, |
| 622 #if defined(OS_CHROMEOS) | 622 #if defined(OS_CHROMEOS) |
| 623 chrome::kDriveScheme, | 623 chrome::kDriveScheme, |
| 624 #endif // defined(OS_CHROMEOS) | 624 #endif // defined(OS_CHROMEOS) |
| 625 content::kAboutScheme, | 625 content::kAboutScheme, |
| 626 #if !defined(DISABLE_FTP_SUPPORT) | 626 #if !defined(DISABLE_FTP_SUPPORT) |
| 627 content::kFtpScheme, | 627 url::kFtpScheme, |
| 628 #endif // !defined(DISABLE_FTP_SUPPORT) | 628 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 629 content::kBlobScheme, | 629 url::kBlobScheme, |
| 630 content::kFileSystemScheme, | 630 url::kFileSystemScheme, |
| 631 chrome::kChromeSearchScheme, | 631 chrome::kChromeSearchScheme, |
| 632 }; | 632 }; |
| 633 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { | 633 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { |
| 634 if (scheme == kProtocolList[i]) | 634 if (scheme == kProtocolList[i]) |
| 635 return true; | 635 return true; |
| 636 } | 636 } |
| 637 return net::URLRequest::IsHandledProtocol(scheme); | 637 return net::URLRequest::IsHandledProtocol(scheme); |
| 638 } | 638 } |
| 639 | 639 |
| 640 // static | 640 // static |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( | 1026 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( |
| 1027 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, | 1027 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, |
| 1028 content::ProtocolHandlerScopedVector protocol_interceptors, | 1028 content::ProtocolHandlerScopedVector protocol_interceptors, |
| 1029 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 1029 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 1030 protocol_handler_interceptor, | 1030 protocol_handler_interceptor, |
| 1031 net::NetworkDelegate* network_delegate, | 1031 net::NetworkDelegate* network_delegate, |
| 1032 net::FtpTransactionFactory* ftp_transaction_factory) const { | 1032 net::FtpTransactionFactory* ftp_transaction_factory) const { |
| 1033 // NOTE(willchan): Keep these protocol handlers in sync with | 1033 // NOTE(willchan): Keep these protocol handlers in sync with |
| 1034 // ProfileIOData::IsHandledProtocol(). | 1034 // ProfileIOData::IsHandledProtocol(). |
| 1035 bool set_protocol = job_factory->SetProtocolHandler( | 1035 bool set_protocol = job_factory->SetProtocolHandler( |
| 1036 content::kFileScheme, | 1036 url::kFileScheme, |
| 1037 new net::FileProtocolHandler( | 1037 new net::FileProtocolHandler( |
| 1038 content::BrowserThread::GetBlockingPool()-> | 1038 content::BrowserThread::GetBlockingPool()-> |
| 1039 GetTaskRunnerWithShutdownBehavior( | 1039 GetTaskRunnerWithShutdownBehavior( |
| 1040 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); | 1040 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); |
| 1041 DCHECK(set_protocol); | 1041 DCHECK(set_protocol); |
| 1042 | 1042 |
| 1043 DCHECK(extension_info_map_.get()); | 1043 DCHECK(extension_info_map_.get()); |
| 1044 // Check only for incognito (and not Chrome OS guest mode GUEST_PROFILE). | 1044 // Check only for incognito (and not Chrome OS guest mode GUEST_PROFILE). |
| 1045 bool is_incognito = profile_type() == Profile::INCOGNITO_PROFILE; | 1045 bool is_incognito = profile_type() == Profile::INCOGNITO_PROFILE; |
| 1046 set_protocol = job_factory->SetProtocolHandler( | 1046 set_protocol = job_factory->SetProtocolHandler( |
| 1047 extensions::kExtensionScheme, | 1047 extensions::kExtensionScheme, |
| 1048 extensions::CreateExtensionProtocolHandler(is_incognito, | 1048 extensions::CreateExtensionProtocolHandler(is_incognito, |
| 1049 extension_info_map_.get())); | 1049 extension_info_map_.get())); |
| 1050 DCHECK(set_protocol); | 1050 DCHECK(set_protocol); |
| 1051 set_protocol = job_factory->SetProtocolHandler( | 1051 set_protocol = job_factory->SetProtocolHandler( |
| 1052 extensions::kExtensionResourceScheme, | 1052 extensions::kExtensionResourceScheme, |
| 1053 CreateExtensionResourceProtocolHandler()); | 1053 CreateExtensionResourceProtocolHandler()); |
| 1054 DCHECK(set_protocol); | 1054 DCHECK(set_protocol); |
| 1055 set_protocol = job_factory->SetProtocolHandler( | 1055 set_protocol = job_factory->SetProtocolHandler( |
| 1056 content::kDataScheme, new net::DataProtocolHandler()); | 1056 url::kDataScheme, new net::DataProtocolHandler()); |
| 1057 DCHECK(set_protocol); | 1057 DCHECK(set_protocol); |
| 1058 #if defined(OS_CHROMEOS) | 1058 #if defined(OS_CHROMEOS) |
| 1059 if (!IsOffTheRecord() && profile_params_) { | 1059 if (!IsOffTheRecord() && profile_params_) { |
| 1060 set_protocol = job_factory->SetProtocolHandler( | 1060 set_protocol = job_factory->SetProtocolHandler( |
| 1061 chrome::kDriveScheme, | 1061 chrome::kDriveScheme, |
| 1062 new drive::DriveProtocolHandler(profile_params_->profile)); | 1062 new drive::DriveProtocolHandler(profile_params_->profile)); |
| 1063 DCHECK(set_protocol); | 1063 DCHECK(set_protocol); |
| 1064 } | 1064 } |
| 1065 #endif // defined(OS_CHROMEOS) | 1065 #endif // defined(OS_CHROMEOS) |
| 1066 | 1066 |
| 1067 job_factory->SetProtocolHandler( | 1067 job_factory->SetProtocolHandler( |
| 1068 content::kAboutScheme, new chrome_browser_net::AboutProtocolHandler()); | 1068 content::kAboutScheme, new chrome_browser_net::AboutProtocolHandler()); |
| 1069 #if !defined(DISABLE_FTP_SUPPORT) | 1069 #if !defined(DISABLE_FTP_SUPPORT) |
| 1070 DCHECK(ftp_transaction_factory); | 1070 DCHECK(ftp_transaction_factory); |
| 1071 job_factory->SetProtocolHandler( | 1071 job_factory->SetProtocolHandler( |
| 1072 content::kFtpScheme, | 1072 url::kFtpScheme, |
| 1073 new net::FtpProtocolHandler(ftp_transaction_factory)); | 1073 new net::FtpProtocolHandler(ftp_transaction_factory)); |
| 1074 #endif // !defined(DISABLE_FTP_SUPPORT) | 1074 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 1075 | 1075 |
| 1076 #if defined(DEBUG_DEVTOOLS) | 1076 #if defined(DEBUG_DEVTOOLS) |
| 1077 protocol_interceptors.push_back(new DebugDevToolsInterceptor); | 1077 protocol_interceptors.push_back(new DebugDevToolsInterceptor); |
| 1078 #endif | 1078 #endif |
| 1079 | 1079 |
| 1080 // Set up interceptors in the reverse order. | 1080 // Set up interceptors in the reverse order. |
| 1081 scoped_ptr<net::URLRequestJobFactory> top_job_factory = | 1081 scoped_ptr<net::URLRequestJobFactory> top_job_factory = |
| 1082 job_factory.PassAs<net::URLRequestJobFactory>(); | 1082 job_factory.PassAs<net::URLRequestJobFactory>(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 void ProfileIOData::SetCookieSettingsForTesting( | 1171 void ProfileIOData::SetCookieSettingsForTesting( |
| 1172 CookieSettings* cookie_settings) { | 1172 CookieSettings* cookie_settings) { |
| 1173 DCHECK(!cookie_settings_.get()); | 1173 DCHECK(!cookie_settings_.get()); |
| 1174 cookie_settings_ = cookie_settings; | 1174 cookie_settings_ = cookie_settings; |
| 1175 } | 1175 } |
| 1176 | 1176 |
| 1177 void ProfileIOData::set_signin_names_for_testing( | 1177 void ProfileIOData::set_signin_names_for_testing( |
| 1178 SigninNamesOnIOThread* signin_names) { | 1178 SigninNamesOnIOThread* signin_names) { |
| 1179 signin_names_.reset(signin_names); | 1179 signin_names_.reset(signin_names); |
| 1180 } | 1180 } |
| OLD | NEW |