| 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_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 io_data_->lazy_params_.reset(lazy_params); | 100 io_data_->lazy_params_.reset(lazy_params); |
| 101 | 101 |
| 102 // Keep track of profile path and cache sizes separately so we can use them | 102 // Keep track of profile path and cache sizes separately so we can use them |
| 103 // on demand when creating storage isolated URLRequestContextGetters. | 103 // on demand when creating storage isolated URLRequestContextGetters. |
| 104 io_data_->profile_path_ = profile_path; | 104 io_data_->profile_path_ = profile_path; |
| 105 io_data_->app_cache_max_size_ = cache_max_size; | 105 io_data_->app_cache_max_size_ = cache_max_size; |
| 106 io_data_->app_media_cache_max_size_ = media_cache_max_size; | 106 io_data_->app_media_cache_max_size_ = media_cache_max_size; |
| 107 | 107 |
| 108 io_data_->predictor_.reset(predictor); | 108 io_data_->predictor_.reset(predictor); |
| 109 | 109 |
| 110 if (!main_request_context_getter_) { | 110 local_state_ = local_state; |
| 111 main_request_context_getter_ = | 111 io_thread_ = io_thread; |
| 112 ChromeURLRequestContextGetter::CreateOriginal( | |
| 113 profile_, io_data_); | |
| 114 } | |
| 115 io_data_->predictor_->InitNetworkPredictor(profile_->GetPrefs(), | |
| 116 local_state, | |
| 117 io_thread, | |
| 118 main_request_context_getter_); | |
| 119 | 112 |
| 120 io_data_->InitializeMetricsEnabledStateOnUIThread(); | 113 io_data_->InitializeMetricsEnabledStateOnUIThread(); |
| 121 } | 114 } |
| 122 | 115 |
| 123 base::Callback<ChromeURLDataManagerBackend*(void)> | 116 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 124 ProfileImplIOData::Handle::GetChromeURLDataManagerBackendGetter() const { | 117 ProfileImplIOData::Handle::GetChromeURLDataManagerBackendGetter() const { |
| 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 126 LazyInitialize(); | 119 LazyInitialize(); |
| 127 return base::Bind(&ProfileIOData::GetChromeURLDataManagerBackend, | 120 return base::Bind(&ProfileIOData::GetChromeURLDataManagerBackend, |
| 128 base::Unretained(io_data_)); | 121 base::Unretained(io_data_)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 141 // Don't call LazyInitialize here, since the resource context is created at | 134 // Don't call LazyInitialize here, since the resource context is created at |
| 142 // the beginning of initalization and is used by some members while they're | 135 // the beginning of initalization and is used by some members while they're |
| 143 // being initialized (i.e. AppCacheService). | 136 // being initialized (i.e. AppCacheService). |
| 144 return io_data_->GetResourceContext(); | 137 return io_data_->GetResourceContext(); |
| 145 } | 138 } |
| 146 | 139 |
| 147 scoped_refptr<ChromeURLRequestContextGetter> | 140 scoped_refptr<ChromeURLRequestContextGetter> |
| 148 ProfileImplIOData::Handle::GetMainRequestContextGetter() const { | 141 ProfileImplIOData::Handle::GetMainRequestContextGetter() const { |
| 149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 150 LazyInitialize(); | 143 LazyInitialize(); |
| 151 if (!main_request_context_getter_) { | 144 DCHECK(main_request_context_getter_); |
| 152 main_request_context_getter_ = | |
| 153 ChromeURLRequestContextGetter::CreateOriginal( | |
| 154 profile_, io_data_); | |
| 155 | |
| 156 content::NotificationService::current()->Notify( | |
| 157 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, | |
| 158 content::Source<Profile>(profile_), | |
| 159 content::NotificationService::NoDetails()); | |
| 160 } | |
| 161 return main_request_context_getter_; | 145 return main_request_context_getter_; |
| 162 } | 146 } |
| 163 | 147 |
| 148 scoped_refptr<ChromeURLRequestContextGetter> |
| 149 ProfileImplIOData::Handle::CreateMainRequestContextGetter( |
| 150 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 151 blob_protocol_handler, |
| 152 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 153 file_system_protocol_handler, |
| 154 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 155 developer_protocol_handler) const { |
| 156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 157 LazyInitialize(); |
| 158 DCHECK(!main_request_context_getter_); |
| 159 main_request_context_getter_ = ChromeURLRequestContextGetter::CreateOriginal( |
| 160 profile_, io_data_, blob_protocol_handler.Pass(), |
| 161 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass()); |
| 162 |
| 163 io_data_->predictor_->InitNetworkPredictor(profile_->GetPrefs(), |
| 164 local_state_, |
| 165 io_thread_, |
| 166 main_request_context_getter_); |
| 167 |
| 168 content::NotificationService::current()->Notify( |
| 169 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, |
| 170 content::Source<Profile>(profile_), |
| 171 content::NotificationService::NoDetails()); |
| 172 return main_request_context_getter_; |
| 173 } |
| 174 |
| 164 scoped_refptr<ChromeURLRequestContextGetter> | 175 scoped_refptr<ChromeURLRequestContextGetter> |
| 165 ProfileImplIOData::Handle::GetMediaRequestContextGetter() const { | 176 ProfileImplIOData::Handle::GetMediaRequestContextGetter() const { |
| 166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 177 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 167 LazyInitialize(); | 178 LazyInitialize(); |
| 168 if (!media_request_context_getter_) { | 179 if (!media_request_context_getter_) { |
| 169 media_request_context_getter_ = | 180 media_request_context_getter_ = |
| 170 ChromeURLRequestContextGetter::CreateOriginalForMedia( | 181 ChromeURLRequestContextGetter::CreateOriginalForMedia( |
| 171 profile_, io_data_); | 182 profile_, io_data_); |
| 172 } | 183 } |
| 173 return media_request_context_getter_; | 184 return media_request_context_getter_; |
| 174 } | 185 } |
| 175 | 186 |
| 176 scoped_refptr<ChromeURLRequestContextGetter> | 187 scoped_refptr<ChromeURLRequestContextGetter> |
| 177 ProfileImplIOData::Handle::GetExtensionsRequestContextGetter() const { | 188 ProfileImplIOData::Handle::GetExtensionsRequestContextGetter() const { |
| 178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 179 LazyInitialize(); | 190 LazyInitialize(); |
| 180 if (!extensions_request_context_getter_) { | 191 if (!extensions_request_context_getter_) { |
| 181 extensions_request_context_getter_ = | 192 extensions_request_context_getter_ = |
| 182 ChromeURLRequestContextGetter::CreateOriginalForExtensions( | 193 ChromeURLRequestContextGetter::CreateOriginalForExtensions( |
| 183 profile_, io_data_); | 194 profile_, io_data_); |
| 184 } | 195 } |
| 185 return extensions_request_context_getter_; | 196 return extensions_request_context_getter_; |
| 186 } | 197 } |
| 187 | 198 |
| 188 scoped_refptr<ChromeURLRequestContextGetter> | 199 scoped_refptr<ChromeURLRequestContextGetter> |
| 189 ProfileImplIOData::Handle::GetIsolatedAppRequestContextGetter( | 200 ProfileImplIOData::Handle::CreateIsolatedAppRequestContextGetter( |
| 190 const FilePath& partition_path, | 201 const FilePath& partition_path, |
| 191 bool in_memory) const { | 202 bool in_memory, |
| 203 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 204 blob_protocol_handler, |
| 205 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 206 file_system_protocol_handler, |
| 207 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 208 developer_protocol_handler) const { |
| 192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 209 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 193 // Check that the partition_path is not the same as the base profile path. We | 210 // Check that the partition_path is not the same as the base profile path. We |
| 194 // expect isolated partition, which will never go to the default profile path. | 211 // expect isolated partition, which will never go to the default profile path. |
| 195 CHECK(partition_path != profile_->GetPath()); | 212 CHECK(partition_path != profile_->GetPath()); |
| 196 LazyInitialize(); | 213 LazyInitialize(); |
| 197 | 214 |
| 198 // Keep a map of request context getters, one per requested storage partition. | 215 // Keep a map of request context getters, one per requested storage partition. |
| 199 StoragePartitionDescriptor descriptor(partition_path, in_memory); | 216 StoragePartitionDescriptor descriptor(partition_path, in_memory); |
| 200 ChromeURLRequestContextGetterMap::iterator iter = | 217 ChromeURLRequestContextGetterMap::iterator iter = |
| 201 app_request_context_getter_map_.find(descriptor); | 218 app_request_context_getter_map_.find(descriptor); |
| 202 if (iter != app_request_context_getter_map_.end()) | 219 if (iter != app_request_context_getter_map_.end()) |
| 203 return iter->second; | 220 return iter->second; |
| 204 | 221 |
| 205 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 222 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 206 protocol_handler_interceptor( | 223 protocol_handler_interceptor( |
| 207 ProtocolHandlerRegistryFactory::GetForProfile(profile_)-> | 224 ProtocolHandlerRegistryFactory::GetForProfile(profile_)-> |
| 208 CreateURLInterceptor()); | 225 CreateURLInterceptor()); |
| 209 ChromeURLRequestContextGetter* context = | 226 ChromeURLRequestContextGetter* context = |
| 210 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( | 227 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( |
| 211 profile_, io_data_, descriptor, | 228 profile_, io_data_, descriptor, |
| 212 protocol_handler_interceptor.Pass()); | 229 protocol_handler_interceptor.Pass(), blob_protocol_handler.Pass(), |
| 230 file_system_protocol_handler.Pass(), |
| 231 developer_protocol_handler.Pass()); |
| 213 app_request_context_getter_map_[descriptor] = context; | 232 app_request_context_getter_map_[descriptor] = context; |
| 214 | 233 |
| 215 return context; | 234 return context; |
| 216 } | 235 } |
| 217 | 236 |
| 218 scoped_refptr<ChromeURLRequestContextGetter> | 237 scoped_refptr<ChromeURLRequestContextGetter> |
| 219 ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter( | 238 ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter( |
| 220 const FilePath& partition_path, | 239 const FilePath& partition_path, |
| 221 bool in_memory) const { | 240 bool in_memory) const { |
| 222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 241 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 223 // We must have a non-default path, or this will act like the default media | 242 // We must have a non-default path, or this will act like the default media |
| 224 // context. | 243 // context. |
| 225 CHECK(partition_path != profile_->GetPath()); | 244 CHECK(partition_path != profile_->GetPath()); |
| 226 LazyInitialize(); | 245 LazyInitialize(); |
| 227 | 246 |
| 228 // Keep a map of request context getters, one per requested storage partition. | 247 // Keep a map of request context getters, one per requested storage partition. |
| 229 StoragePartitionDescriptor descriptor(partition_path, in_memory); | 248 StoragePartitionDescriptor descriptor(partition_path, in_memory); |
| 230 ChromeURLRequestContextGetterMap::iterator iter = | 249 ChromeURLRequestContextGetterMap::iterator iter = |
| 231 isolated_media_request_context_getter_map_.find(descriptor); | 250 isolated_media_request_context_getter_map_.find(descriptor); |
| 232 if (iter != isolated_media_request_context_getter_map_.end()) | 251 if (iter != isolated_media_request_context_getter_map_.end()) |
| 233 return iter->second; | 252 return iter->second; |
| 234 | 253 |
| 235 // Get the app context as the starting point for the media context, so that | 254 // Get the app context as the starting point for the media context, so that |
| 236 // it uses the app's cookie store. | 255 // it uses the app's cookie store. |
| 237 ChromeURLRequestContextGetter* app_context = | 256 ChromeURLRequestContextGetterMap::iterator app_iter = |
| 238 GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 257 app_request_context_getter_map_.find(descriptor); |
| 258 DCHECK(app_iter != app_request_context_getter_map_.end()); |
| 259 ChromeURLRequestContextGetter* app_context = app_iter->second; |
| 239 ChromeURLRequestContextGetter* context = | 260 ChromeURLRequestContextGetter* context = |
| 240 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( | 261 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( |
| 241 profile_, app_context, io_data_, descriptor); | 262 profile_, app_context, io_data_, descriptor); |
| 242 isolated_media_request_context_getter_map_[descriptor] = context; | 263 isolated_media_request_context_getter_map_[descriptor] = context; |
| 243 | 264 |
| 244 return context; | 265 return context; |
| 245 } | 266 } |
| 246 | 267 |
| 247 void ProfileImplIOData::Handle::ClearNetworkingHistorySince( | 268 void ProfileImplIOData::Handle::ClearNetworkingHistorySince( |
| 248 base::Time time, | 269 base::Time time, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 ProfileImplIOData::ProfileImplIOData() | 315 ProfileImplIOData::ProfileImplIOData() |
| 295 : ProfileIOData(false) {} | 316 : ProfileIOData(false) {} |
| 296 ProfileImplIOData::~ProfileImplIOData() { | 317 ProfileImplIOData::~ProfileImplIOData() { |
| 297 DestroyResourceContext(); | 318 DestroyResourceContext(); |
| 298 | 319 |
| 299 if (media_request_context_.get()) | 320 if (media_request_context_.get()) |
| 300 media_request_context_->AssertNoURLRequests(); | 321 media_request_context_->AssertNoURLRequests(); |
| 301 } | 322 } |
| 302 | 323 |
| 303 void ProfileImplIOData::LazyInitializeInternal( | 324 void ProfileImplIOData::LazyInitializeInternal( |
| 304 ProfileParams* profile_params) const { | 325 ProfileParams* profile_params, |
| 326 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 327 blob_protocol_handler, |
| 328 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 329 file_system_protocol_handler, |
| 330 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 331 developer_protocol_handler) const { |
| 305 ChromeURLRequestContext* main_context = main_request_context(); | 332 ChromeURLRequestContext* main_context = main_request_context(); |
| 306 | 333 |
| 307 IOThread* const io_thread = profile_params->io_thread; | 334 IOThread* const io_thread = profile_params->io_thread; |
| 308 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 335 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
| 309 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 336 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 310 // Only allow Record Mode if we are in a Debug build or where we are running | 337 // Only allow Record Mode if we are in a Debug build or where we are running |
| 311 // a cycle, and the user has limited control. | 338 // a cycle, and the user has limited control. |
| 312 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && | 339 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && |
| 313 (chrome::kRecordModeEnabled || | 340 (chrome::kRecordModeEnabled || |
| 314 command_line.HasSwitch(switches::kVisitURLs)); | 341 command_line.HasSwitch(switches::kVisitURLs)); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 ftp_factory_.reset( | 440 ftp_factory_.reset( |
| 414 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); | 441 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); |
| 415 main_context->set_ftp_transaction_factory(ftp_factory_.get()); | 442 main_context->set_ftp_transaction_factory(ftp_factory_.get()); |
| 416 #endif // !defined(DISABLE_FTP_SUPPORT) | 443 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 417 | 444 |
| 418 main_context->set_chrome_url_data_manager_backend( | 445 main_context->set_chrome_url_data_manager_backend( |
| 419 chrome_url_data_manager_backend()); | 446 chrome_url_data_manager_backend()); |
| 420 | 447 |
| 421 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory( | 448 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory( |
| 422 new net::URLRequestJobFactoryImpl()); | 449 new net::URLRequestJobFactoryImpl()); |
| 450 main_job_factory->SetProtocolHandler( |
| 451 chrome::kBlobScheme, blob_protocol_handler.release()); |
| 452 main_job_factory->SetProtocolHandler( |
| 453 chrome::kFileSystemScheme, file_system_protocol_handler.release()); |
| 454 main_job_factory->AddInterceptor(developer_protocol_handler.release()); |
| 423 SetUpJobFactory(main_job_factory.get(), | 455 SetUpJobFactory(main_job_factory.get(), |
| 424 profile_params->protocol_handler_interceptor.Pass(), | 456 profile_params->protocol_handler_interceptor.Pass(), |
| 425 network_delegate(), | 457 network_delegate(), |
| 426 main_context->ftp_transaction_factory(), | 458 main_context->ftp_transaction_factory(), |
| 427 main_context->ftp_auth_cache()); | 459 main_context->ftp_auth_cache()); |
| 428 main_job_factory_ = main_job_factory.Pass(); | 460 main_job_factory_ = main_job_factory.Pass(); |
| 429 main_context->set_job_factory(main_job_factory_.get()); | 461 main_context->set_job_factory(main_job_factory_.get()); |
| 430 | 462 |
| 431 #if defined(ENABLE_EXTENSIONS) | 463 #if defined(ENABLE_EXTENSIONS) |
| 432 InitializeExtensionsRequestContext(profile_params); | 464 InitializeExtensionsRequestContext(profile_params); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 extensions_context->ftp_auth_cache()); | 518 extensions_context->ftp_auth_cache()); |
| 487 extensions_job_factory_ = extensions_job_factory.Pass(); | 519 extensions_job_factory_ = extensions_job_factory.Pass(); |
| 488 extensions_context->set_job_factory(extensions_job_factory_.get()); | 520 extensions_context->set_job_factory(extensions_job_factory_.get()); |
| 489 } | 521 } |
| 490 | 522 |
| 491 ChromeURLRequestContext* | 523 ChromeURLRequestContext* |
| 492 ProfileImplIOData::InitializeAppRequestContext( | 524 ProfileImplIOData::InitializeAppRequestContext( |
| 493 ChromeURLRequestContext* main_context, | 525 ChromeURLRequestContext* main_context, |
| 494 const StoragePartitionDescriptor& partition_descriptor, | 526 const StoragePartitionDescriptor& partition_descriptor, |
| 495 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 527 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 496 protocol_handler_interceptor) const { | 528 protocol_handler_interceptor, |
| 529 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 530 blob_protocol_handler, |
| 531 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 532 file_system_protocol_handler, |
| 533 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 534 developer_protocol_handler) const { |
| 497 // Copy most state from the main context. | 535 // Copy most state from the main context. |
| 498 AppRequestContext* context = new AppRequestContext(load_time_stats()); | 536 AppRequestContext* context = new AppRequestContext(load_time_stats()); |
| 499 context->CopyFrom(main_context); | 537 context->CopyFrom(main_context); |
| 500 | 538 |
| 501 FilePath cookie_path = partition_descriptor.path.Append( | 539 FilePath cookie_path = partition_descriptor.path.Append( |
| 502 chrome::kCookieFilename); | 540 chrome::kCookieFilename); |
| 503 FilePath cache_path = partition_descriptor.path.Append(chrome::kCacheDirname); | 541 FilePath cache_path = partition_descriptor.path.Append(chrome::kCacheDirname); |
| 504 | 542 |
| 505 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 543 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 506 // Only allow Record Mode if we are in a Debug build or where we are running | 544 // Only allow Record Mode if we are in a Debug build or where we are running |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 context->SetCookieStore(cookie_store); | 593 context->SetCookieStore(cookie_store); |
| 556 context->SetHttpTransactionFactory( | 594 context->SetHttpTransactionFactory( |
| 557 scoped_ptr<net::HttpTransactionFactory>(app_http_cache)); | 595 scoped_ptr<net::HttpTransactionFactory>(app_http_cache)); |
| 558 | 596 |
| 559 // Overwrite the job factory that we inherit from the main context so | 597 // Overwrite the job factory that we inherit from the main context so |
| 560 // that we can later provide our own handles for storage related protocols. | 598 // that we can later provide our own handles for storage related protocols. |
| 561 // Install all the usual protocol handlers unless we are in a browser plugin | 599 // Install all the usual protocol handlers unless we are in a browser plugin |
| 562 // guest process, in which case only web-safe schemes are allowed. | 600 // guest process, in which case only web-safe schemes are allowed. |
| 563 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( | 601 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( |
| 564 new net::URLRequestJobFactoryImpl()); | 602 new net::URLRequestJobFactoryImpl()); |
| 603 job_factory->SetProtocolHandler(chrome::kBlobScheme, |
| 604 blob_protocol_handler.release()); |
| 605 job_factory->SetProtocolHandler(chrome::kFileSystemScheme, |
| 606 file_system_protocol_handler.release()); |
| 607 job_factory->AddInterceptor(developer_protocol_handler.release()); |
| 565 if (!partition_descriptor.in_memory) { | 608 if (!partition_descriptor.in_memory) { |
| 566 SetUpJobFactory(job_factory.get(), protocol_handler_interceptor.Pass(), | 609 SetUpJobFactory(job_factory.get(), protocol_handler_interceptor.Pass(), |
| 567 network_delegate(), | 610 network_delegate(), |
| 568 context->ftp_transaction_factory(), | 611 context->ftp_transaction_factory(), |
| 569 context->ftp_auth_cache()); | 612 context->ftp_auth_cache()); |
| 570 } | 613 } |
| 571 context->SetJobFactory(job_factory.PassAs<net::URLRequestJobFactory>()); | 614 context->SetJobFactory(job_factory.PassAs<net::URLRequestJobFactory>()); |
| 572 | 615 |
| 573 return context; | 616 return context; |
| 574 } | 617 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 ProfileImplIOData::AcquireMediaRequestContext() const { | 668 ProfileImplIOData::AcquireMediaRequestContext() const { |
| 626 DCHECK(media_request_context_.get()); | 669 DCHECK(media_request_context_.get()); |
| 627 return media_request_context_.get(); | 670 return media_request_context_.get(); |
| 628 } | 671 } |
| 629 | 672 |
| 630 ChromeURLRequestContext* | 673 ChromeURLRequestContext* |
| 631 ProfileImplIOData::AcquireIsolatedAppRequestContext( | 674 ProfileImplIOData::AcquireIsolatedAppRequestContext( |
| 632 ChromeURLRequestContext* main_context, | 675 ChromeURLRequestContext* main_context, |
| 633 const StoragePartitionDescriptor& partition_descriptor, | 676 const StoragePartitionDescriptor& partition_descriptor, |
| 634 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 677 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 635 protocol_handler_interceptor) const { | 678 protocol_handler_interceptor, |
| 679 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 680 blob_protocol_handler, |
| 681 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 682 file_system_protocol_handler, |
| 683 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 684 developer_protocol_handler) const { |
| 636 // We create per-app contexts on demand, unlike the others above. | 685 // We create per-app contexts on demand, unlike the others above. |
| 637 ChromeURLRequestContext* app_request_context = | 686 ChromeURLRequestContext* app_request_context = |
| 638 InitializeAppRequestContext(main_context, partition_descriptor, | 687 InitializeAppRequestContext(main_context, partition_descriptor, |
| 639 protocol_handler_interceptor.Pass()); | 688 protocol_handler_interceptor.Pass(), |
| 689 blob_protocol_handler.Pass(), |
| 690 file_system_protocol_handler.Pass(), |
| 691 developer_protocol_handler.Pass()); |
| 640 DCHECK(app_request_context); | 692 DCHECK(app_request_context); |
| 641 return app_request_context; | 693 return app_request_context; |
| 642 } | 694 } |
| 643 | 695 |
| 644 ChromeURLRequestContext* | 696 ChromeURLRequestContext* |
| 645 ProfileImplIOData::AcquireIsolatedMediaRequestContext( | 697 ProfileImplIOData::AcquireIsolatedMediaRequestContext( |
| 646 ChromeURLRequestContext* app_context, | 698 ChromeURLRequestContext* app_context, |
| 647 const StoragePartitionDescriptor& partition_descriptor) const { | 699 const StoragePartitionDescriptor& partition_descriptor) const { |
| 648 // We create per-app media contexts on demand, unlike the others above. | 700 // We create per-app media contexts on demand, unlike the others above. |
| 649 ChromeURLRequestContext* media_request_context = | 701 ChromeURLRequestContext* media_request_context = |
| (...skipping 21 matching lines...) Expand all Loading... |
| 671 job_factory->AddInterceptor( | 723 job_factory->AddInterceptor( |
| 672 new chrome_browser_net::ConnectInterceptor(predictor_.get())); | 724 new chrome_browser_net::ConnectInterceptor(predictor_.get())); |
| 673 job_factory->AddInterceptor( | 725 job_factory->AddInterceptor( |
| 674 new DoubleGetExperimentInterceptor(NULL)); | 726 new DoubleGetExperimentInterceptor(NULL)); |
| 675 } | 727 } |
| 676 | 728 |
| 677 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 729 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
| 678 base::Time time, | 730 base::Time time, |
| 679 const base::Closure& completion) { | 731 const base::Closure& completion) { |
| 680 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 732 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 681 LazyInitialize(); | 733 DCHECK(initialized()); |
| 682 | 734 |
| 683 DCHECK(transport_security_state()); | 735 DCHECK(transport_security_state()); |
| 684 transport_security_state()->DeleteSince(time); // Completes synchronously. | 736 transport_security_state()->DeleteSince(time); // Completes synchronously. |
| 685 DCHECK(http_server_properties_manager_); | 737 DCHECK(http_server_properties_manager_); |
| 686 http_server_properties_manager_->Clear(completion); | 738 http_server_properties_manager_->Clear(completion); |
| 687 } | 739 } |
| OLD | NEW |