| 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 "content/browser/storage_partition_impl_map.h" | 5 #include "content/browser/storage_partition_impl_map.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/files/file_enumerator.h" | 12 #include "base/files/file_enumerator.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" |
| 17 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 21 #include "base/threading/sequenced_worker_pool.h" | 22 #include "base/threading/sequenced_worker_pool.h" |
| 22 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
| 23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 24 #include "content/browser/appcache/appcache_interceptor.h" | 25 #include "content/browser/appcache/appcache_interceptor.h" |
| 25 #include "content/browser/appcache/chrome_appcache_service.h" | 26 #include "content/browser/appcache/chrome_appcache_service.h" |
| 26 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 27 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 browser_context_->GetResourceContext(), | 436 browser_context_->GetResourceContext(), |
| 436 browser_context_->IsOffTheRecord(), | 437 browser_context_->IsOffTheRecord(), |
| 437 blob_storage_context).release()); | 438 blob_storage_context).release()); |
| 438 } | 439 } |
| 439 protocol_handlers[kChromeDevToolsScheme] = | 440 protocol_handlers[kChromeDevToolsScheme] = |
| 440 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( | 441 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( |
| 441 CreateDevToolsProtocolHandler(browser_context_->GetResourceContext(), | 442 CreateDevToolsProtocolHandler(browser_context_->GetResourceContext(), |
| 442 browser_context_->IsOffTheRecord())); | 443 browser_context_->IsOffTheRecord())); |
| 443 | 444 |
| 444 URLRequestInterceptorScopedVector request_interceptors; | 445 URLRequestInterceptorScopedVector request_interceptors; |
| 445 request_interceptors.push_back( | 446 request_interceptors.push_back(ServiceWorkerRequestHandler::CreateInterceptor( |
| 446 ServiceWorkerRequestHandler::CreateInterceptor( | 447 browser_context_->GetResourceContext())); |
| 447 browser_context_->GetResourceContext()).release()); | |
| 448 if (ForeignFetchRequestHandler::IsForeignFetchEnabled()) { | 448 if (ForeignFetchRequestHandler::IsForeignFetchEnabled()) { |
| 449 request_interceptors.push_back( | 449 request_interceptors.push_back( |
| 450 ForeignFetchRequestHandler::CreateInterceptor( | 450 ForeignFetchRequestHandler::CreateInterceptor( |
| 451 browser_context_->GetResourceContext()) | 451 browser_context_->GetResourceContext())); |
| 452 .release()); | |
| 453 } | 452 } |
| 454 request_interceptors.push_back(new AppCacheInterceptor()); | 453 request_interceptors.push_back(base::MakeUnique<AppCacheInterceptor>()); |
| 455 | 454 |
| 456 // These calls must happen after StoragePartitionImpl::Create(). | 455 // These calls must happen after StoragePartitionImpl::Create(). |
| 457 if (partition_domain.empty()) { | 456 if (partition_domain.empty()) { |
| 458 partition->SetURLRequestContext( | 457 partition->SetURLRequestContext( |
| 459 browser_context_->CreateRequestContext( | 458 browser_context_->CreateRequestContext( |
| 460 &protocol_handlers, std::move(request_interceptors))); | 459 &protocol_handlers, std::move(request_interceptors))); |
| 461 } else { | 460 } else { |
| 462 partition->SetURLRequestContext( | 461 partition->SetURLRequestContext( |
| 463 browser_context_->CreateRequestContextForStoragePartition( | 462 browser_context_->CreateRequestContextForStoragePartition( |
| 464 partition->GetPath(), in_memory, &protocol_handlers, | 463 partition->GetPath(), in_memory, &protocol_handlers, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 604 |
| 606 // We do not call InitializeURLRequestContext() for media contexts because, | 605 // We do not call InitializeURLRequestContext() for media contexts because, |
| 607 // other than the HTTP cache, the media contexts share the same backing | 606 // other than the HTTP cache, the media contexts share the same backing |
| 608 // objects as their associated "normal" request context. Thus, the previous | 607 // objects as their associated "normal" request context. Thus, the previous |
| 609 // call serves to initialize the media request context for this storage | 608 // call serves to initialize the media request context for this storage |
| 610 // partition as well. | 609 // partition as well. |
| 611 } | 610 } |
| 612 } | 611 } |
| 613 | 612 |
| 614 } // namespace content | 613 } // namespace content |
| OLD | NEW |