| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 public: | 224 public: |
| 225 // net::URLRequestInterceptor implementation. | 225 // net::URLRequestInterceptor implementation. |
| 226 net::URLRequestJob* MaybeInterceptRequest( | 226 net::URLRequestJob* MaybeInterceptRequest( |
| 227 net::URLRequest* request, | 227 net::URLRequest* request, |
| 228 net::NetworkDelegate* network_delegate) const override { | 228 net::NetworkDelegate* network_delegate) const override { |
| 229 base::FilePath path; | 229 base::FilePath path; |
| 230 if (IsSupportedDevToolsURL(request->url(), &path)) | 230 if (IsSupportedDevToolsURL(request->url(), &path)) |
| 231 return new net::URLRequestFileJob( | 231 return new net::URLRequestFileJob( |
| 232 request, network_delegate, path, | 232 request, network_delegate, path, |
| 233 base::CreateTaskRunnerWithTraits( | 233 base::CreateTaskRunnerWithTraits( |
| 234 base::TaskTraits() | 234 {base::MayBlock(), base::TaskPriority::USER_VISIBLE, |
| 235 .MayBlock() | 235 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})); |
| 236 .WithPriority(base::TaskPriority::USER_VISIBLE) | |
| 237 .WithShutdownBehavior( | |
| 238 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN))); | |
| 239 | 236 |
| 240 return NULL; | 237 return NULL; |
| 241 } | 238 } |
| 242 }; | 239 }; |
| 243 #endif // BUILDFLAG(DEBUG_DEVTOOLS) | 240 #endif // BUILDFLAG(DEBUG_DEVTOOLS) |
| 244 | 241 |
| 245 #if defined(OS_CHROMEOS) | 242 #if defined(OS_CHROMEOS) |
| 246 // The following four functions are responsible for initializing NSS for each | 243 // The following four functions are responsible for initializing NSS for each |
| 247 // profile on ChromeOS, which has a separate NSS database and TPM slot | 244 // profile on ChromeOS, which has a separate NSS database and TPM slot |
| 248 // per-profile. | 245 // per-profile. |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 1137 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 1141 protocol_handler_interceptor, | 1138 protocol_handler_interceptor, |
| 1142 net::NetworkDelegate* network_delegate, | 1139 net::NetworkDelegate* network_delegate, |
| 1143 net::HostResolver* host_resolver) const { | 1140 net::HostResolver* host_resolver) const { |
| 1144 // NOTE(willchan): Keep these protocol handlers in sync with | 1141 // NOTE(willchan): Keep these protocol handlers in sync with |
| 1145 // ProfileIOData::IsHandledProtocol(). | 1142 // ProfileIOData::IsHandledProtocol(). |
| 1146 bool set_protocol = job_factory->SetProtocolHandler( | 1143 bool set_protocol = job_factory->SetProtocolHandler( |
| 1147 url::kFileScheme, | 1144 url::kFileScheme, |
| 1148 base::MakeUnique<net::FileProtocolHandler>( | 1145 base::MakeUnique<net::FileProtocolHandler>( |
| 1149 base::CreateTaskRunnerWithTraits( | 1146 base::CreateTaskRunnerWithTraits( |
| 1150 base::TaskTraits() | 1147 {base::MayBlock(), base::TaskPriority::USER_VISIBLE, |
| 1151 .MayBlock() | 1148 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))); |
| 1152 .WithPriority(base::TaskPriority::USER_VISIBLE) | |
| 1153 .WithShutdownBehavior( | |
| 1154 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)))); | |
| 1155 DCHECK(set_protocol); | 1149 DCHECK(set_protocol); |
| 1156 | 1150 |
| 1157 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1151 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1158 DCHECK(extension_info_map_.get()); | 1152 DCHECK(extension_info_map_.get()); |
| 1159 // Check only for incognito (and not Chrome OS guest mode GUEST_PROFILE). | 1153 // Check only for incognito (and not Chrome OS guest mode GUEST_PROFILE). |
| 1160 bool is_incognito = profile_type() == Profile::INCOGNITO_PROFILE; | 1154 bool is_incognito = profile_type() == Profile::INCOGNITO_PROFILE; |
| 1161 set_protocol = job_factory->SetProtocolHandler( | 1155 set_protocol = job_factory->SetProtocolHandler( |
| 1162 extensions::kExtensionScheme, | 1156 extensions::kExtensionScheme, |
| 1163 extensions::CreateExtensionProtocolHandler(is_incognito, | 1157 extensions::CreateExtensionProtocolHandler(is_incognito, |
| 1164 extension_info_map_.get())); | 1158 extension_info_map_.get())); |
| 1165 DCHECK(set_protocol); | 1159 DCHECK(set_protocol); |
| 1166 #endif | 1160 #endif |
| 1167 set_protocol = job_factory->SetProtocolHandler( | 1161 set_protocol = job_factory->SetProtocolHandler( |
| 1168 url::kDataScheme, base::MakeUnique<net::DataProtocolHandler>()); | 1162 url::kDataScheme, base::MakeUnique<net::DataProtocolHandler>()); |
| 1169 DCHECK(set_protocol); | 1163 DCHECK(set_protocol); |
| 1170 #if defined(OS_CHROMEOS) | 1164 #if defined(OS_CHROMEOS) |
| 1171 if (profile_params_) { | 1165 if (profile_params_) { |
| 1172 set_protocol = job_factory->SetProtocolHandler( | 1166 set_protocol = job_factory->SetProtocolHandler( |
| 1173 content::kExternalFileScheme, | 1167 content::kExternalFileScheme, |
| 1174 base::MakeUnique<chromeos::ExternalFileProtocolHandler>( | 1168 base::MakeUnique<chromeos::ExternalFileProtocolHandler>( |
| 1175 profile_params_->profile)); | 1169 profile_params_->profile)); |
| 1176 DCHECK(set_protocol); | 1170 DCHECK(set_protocol); |
| 1177 } | 1171 } |
| 1178 #endif // defined(OS_CHROMEOS) | 1172 #endif // defined(OS_CHROMEOS) |
| 1179 #if defined(OS_ANDROID) | 1173 #if defined(OS_ANDROID) |
| 1180 set_protocol = job_factory->SetProtocolHandler( | 1174 set_protocol = job_factory->SetProtocolHandler( |
| 1181 url::kContentScheme, | 1175 url::kContentScheme, |
| 1182 content::ContentProtocolHandler::Create(base::CreateTaskRunnerWithTraits( | 1176 content::ContentProtocolHandler::Create(base::CreateTaskRunnerWithTraits( |
| 1183 base::TaskTraits() | 1177 {base::MayBlock(), base::TaskPriority::USER_VISIBLE, |
| 1184 .MayBlock() | 1178 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))); |
| 1185 .WithPriority(base::TaskPriority::USER_VISIBLE) | |
| 1186 .WithShutdownBehavior( | |
| 1187 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)))); | |
| 1188 #endif | 1179 #endif |
| 1189 | 1180 |
| 1190 job_factory->SetProtocolHandler( | 1181 job_factory->SetProtocolHandler( |
| 1191 url::kAboutScheme, | 1182 url::kAboutScheme, |
| 1192 base::MakeUnique<about_handler::AboutProtocolHandler>()); | 1183 base::MakeUnique<about_handler::AboutProtocolHandler>()); |
| 1193 | 1184 |
| 1194 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) | 1185 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) |
| 1195 job_factory->SetProtocolHandler( | 1186 job_factory->SetProtocolHandler( |
| 1196 url::kFtpScheme, net::FtpProtocolHandler::Create(host_resolver)); | 1187 url::kFtpScheme, net::FtpProtocolHandler::Create(host_resolver)); |
| 1197 #endif // !BUILDFLAG(DISABLE_FTP_SUPPORT) | 1188 #endif // !BUILDFLAG(DISABLE_FTP_SUPPORT) |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 void ProfileIOData::SetCookieSettingsForTesting( | 1304 void ProfileIOData::SetCookieSettingsForTesting( |
| 1314 content_settings::CookieSettings* cookie_settings) { | 1305 content_settings::CookieSettings* cookie_settings) { |
| 1315 DCHECK(!cookie_settings_.get()); | 1306 DCHECK(!cookie_settings_.get()); |
| 1316 cookie_settings_ = cookie_settings; | 1307 cookie_settings_ = cookie_settings; |
| 1317 } | 1308 } |
| 1318 | 1309 |
| 1319 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( | 1310 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( |
| 1320 const GURL& url) const { | 1311 const GURL& url) const { |
| 1321 return url_blacklist_manager_->GetURLBlacklistState(url); | 1312 return url_blacklist_manager_->GetURLBlacklistState(url); |
| 1322 } | 1313 } |
| OLD | NEW |