mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	Known issues: - Download fails with empty cache path due to https://crrev.com/950748a25f. Fixed in https://crrev.com/087ef223ac.
		
			
				
	
	
		
			870 lines
		
	
	
		
			40 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			870 lines
		
	
	
		
			40 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| diff --git content/browser/appcache/appcache_internals_ui.cc content/browser/appcache/appcache_internals_ui.cc
 | |
| index 3a34269fbc04..b3637d969367 100644
 | |
| --- content/browser/appcache/appcache_internals_ui.cc
 | |
| +++ content/browser/appcache/appcache_internals_ui.cc
 | |
| @@ -373,8 +373,8 @@ void AppCacheInternalsUI::CreateProxyForPartition(
 | |
|      StoragePartition* storage_partition) {
 | |
|    scoped_refptr<Proxy> proxy =
 | |
|        new Proxy(weak_ptr_factory_.GetWeakPtr(), storage_partition->GetPath());
 | |
| -  proxy->Initialize(static_cast<StoragePartitionImpl*>(storage_partition)
 | |
| -                        ->GetAppCacheService());
 | |
| +  proxy->Initialize(static_cast<ChromeAppCacheService*>(
 | |
| +      storage_partition->GetAppCacheService()));
 | |
|    appcache_proxies_.push_back(proxy);
 | |
|  }
 | |
|  
 | |
| diff --git content/browser/background_fetch/background_fetch_service_impl.cc content/browser/background_fetch/background_fetch_service_impl.cc
 | |
| index 596cfaa01092..f341bca174d5 100644
 | |
| --- content/browser/background_fetch/background_fetch_service_impl.cc
 | |
| +++ content/browser/background_fetch/background_fetch_service_impl.cc
 | |
| @@ -39,8 +39,7 @@ void BackgroundFetchServiceImpl::Create(
 | |
|        BrowserThread::IO, FROM_HERE,
 | |
|        base::BindOnce(
 | |
|            BackgroundFetchServiceImpl::CreateOnIoThread,
 | |
| -          WrapRefCounted(static_cast<StoragePartitionImpl*>(
 | |
| -                             render_process_host->GetStoragePartition())
 | |
| +          WrapRefCounted(render_process_host->GetStoragePartition()
 | |
|                               ->GetBackgroundFetchContext()),
 | |
|            origin, std::move(request)));
 | |
|  }
 | |
| diff --git content/browser/blob_storage/chrome_blob_storage_context.cc content/browser/blob_storage/chrome_blob_storage_context.cc
 | |
| index 0b5780dfe117..a499aaacb879 100644
 | |
| --- content/browser/blob_storage/chrome_blob_storage_context.cc
 | |
| +++ content/browser/blob_storage/chrome_blob_storage_context.cc
 | |
| @@ -87,6 +87,11 @@ class BlobHandleImpl : public BlobHandle {
 | |
|  
 | |
|  ChromeBlobStorageContext::ChromeBlobStorageContext() {}
 | |
|  
 | |
| +// static
 | |
| +const void* ChromeBlobStorageContext::GetUserDataKey() {
 | |
| +  return kBlobStorageContextKeyName;
 | |
| +}
 | |
| +
 | |
|  ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor(
 | |
|      BrowserContext* context) {
 | |
|    DCHECK_CURRENTLY_ON(BrowserThread::UI);
 | |
| diff --git content/browser/blob_storage/chrome_blob_storage_context.h content/browser/blob_storage/chrome_blob_storage_context.h
 | |
| index 043d968ca6ab..edb3c0d80c12 100644
 | |
| --- content/browser/blob_storage/chrome_blob_storage_context.h
 | |
| +++ content/browser/blob_storage/chrome_blob_storage_context.h
 | |
| @@ -52,6 +52,8 @@ class CONTENT_EXPORT ChromeBlobStorageContext
 | |
|   public:
 | |
|    ChromeBlobStorageContext();
 | |
|  
 | |
| +  static const void* GetUserDataKey();
 | |
| +
 | |
|    // Must be called on the UI thread.
 | |
|    static ChromeBlobStorageContext* GetFor(
 | |
|        BrowserContext* browser_context);
 | |
| diff --git content/browser/bluetooth/web_bluetooth_service_impl.cc content/browser/bluetooth/web_bluetooth_service_impl.cc
 | |
| index cda94e43e866..84fde20fdce2 100644
 | |
| --- content/browser/bluetooth/web_bluetooth_service_impl.cc
 | |
| +++ content/browser/bluetooth/web_bluetooth_service_impl.cc
 | |
| @@ -1233,9 +1233,9 @@ url::Origin WebBluetoothServiceImpl::GetOrigin() {
 | |
|  }
 | |
|  
 | |
|  BluetoothAllowedDevices& WebBluetoothServiceImpl::allowed_devices() {
 | |
| -  StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
 | |
| +  StoragePartition* partition =
 | |
|        BrowserContext::GetDefaultStoragePartition(
 | |
| -          web_contents()->GetBrowserContext()));
 | |
| +          web_contents()->GetBrowserContext());
 | |
|    scoped_refptr<BluetoothAllowedDevicesMap> allowed_devices_map =
 | |
|        partition->GetBluetoothAllowedDevicesMap();
 | |
|    return allowed_devices_map->GetOrCreateAllowedDevices(GetOrigin());
 | |
| diff --git content/browser/browser_context.cc content/browser/browser_context.cc
 | |
| index bb3d7a1f7b65..a44b32c618c0 100644
 | |
| --- content/browser/browser_context.cc
 | |
| +++ content/browser/browser_context.cc
 | |
| @@ -131,11 +131,18 @@ StoragePartition* GetStoragePartitionFromConfig(
 | |
|    StoragePartitionImplMap* partition_map =
 | |
|        GetStoragePartitionMap(browser_context);
 | |
|  
 | |
| -  if (browser_context->IsOffTheRecord())
 | |
| +  if (browser_context->IsOffTheRecord() || browser_context->GetPath().empty())
 | |
|      in_memory = true;
 | |
|  
 | |
| -  return partition_map->Get(partition_domain, partition_name, in_memory,
 | |
| -                            can_create);
 | |
| +  StoragePartitionImpl* partition_impl =
 | |
| +      partition_map->Get(partition_domain, partition_name, in_memory,
 | |
| +                         can_create);
 | |
| +  if (partition_impl->browser_context() == browser_context)
 | |
| +    return partition_impl;
 | |
| +
 | |
| +  // |browser_context| is a CefBrowserContextProxy object.
 | |
| +  return partition_impl->browser_context()->
 | |
| +      GetStoragePartitionProxy(browser_context, partition_impl);
 | |
|  }
 | |
|  
 | |
|  void SaveSessionStateOnIOThread(
 | |
| @@ -586,6 +593,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor(
 | |
|  BrowserContext::BrowserContext()
 | |
|      : unique_id_(base::UnguessableToken::Create().ToString()) {}
 | |
|  
 | |
| +// static
 | |
| +const void* BrowserContext::GetStoragePartitionMapUserDataKey() {
 | |
| +  return kStoragePartitionMapKeyName;
 | |
| +}
 | |
| +
 | |
|  BrowserContext::~BrowserContext() {
 | |
|    CHECK(GetUserData(kMojoWasInitialized))
 | |
|        << "Attempting to destroy a BrowserContext that never called "
 | |
| diff --git content/browser/devtools/protocol/network_handler.cc content/browser/devtools/protocol/network_handler.cc
 | |
| index a438c95df957..b80ea1582ec3 100644
 | |
| --- content/browser/devtools/protocol/network_handler.cc
 | |
| +++ content/browser/devtools/protocol/network_handler.cc
 | |
| @@ -889,8 +889,7 @@ class BackgroundSyncRestorer {
 | |
|      scoped_refptr<ServiceWorkerDevToolsAgentHost> service_worker_host =
 | |
|          static_cast<ServiceWorkerDevToolsAgentHost*>(host.get());
 | |
|      scoped_refptr<BackgroundSyncContext> sync_context =
 | |
| -        static_cast<StoragePartitionImpl*>(storage_partition_)
 | |
| -            ->GetBackgroundSyncContext();
 | |
| +        storage_partition_->GetBackgroundSyncContext();
 | |
|      BrowserThread::PostTask(
 | |
|          BrowserThread::IO, FROM_HERE,
 | |
|          base::BindOnce(
 | |
| diff --git content/browser/devtools/protocol/service_worker_handler.cc content/browser/devtools/protocol/service_worker_handler.cc
 | |
| index 5449b409717a..b138a8ca7fa3 100644
 | |
| --- content/browser/devtools/protocol/service_worker_handler.cc
 | |
| +++ content/browser/devtools/protocol/service_worker_handler.cc
 | |
| @@ -170,8 +170,7 @@ void ServiceWorkerHandler::SetRenderer(int process_host_id,
 | |
|      return;
 | |
|    }
 | |
|  
 | |
| -  storage_partition_ =
 | |
| -      static_cast<StoragePartitionImpl*>(process_host->GetStoragePartition());
 | |
| +  storage_partition_ = process_host->GetStoragePartition();
 | |
|    DCHECK(storage_partition_);
 | |
|    context_ = static_cast<ServiceWorkerContextWrapper*>(
 | |
|        storage_partition_->GetServiceWorkerContext());
 | |
| diff --git content/browser/devtools/protocol/service_worker_handler.h content/browser/devtools/protocol/service_worker_handler.h
 | |
| index ec9ab86d0ca6..0fe5219f1e84 100644
 | |
| --- content/browser/devtools/protocol/service_worker_handler.h
 | |
| +++ content/browser/devtools/protocol/service_worker_handler.h
 | |
| @@ -24,7 +24,7 @@ class BrowserContext;
 | |
|  class RenderFrameHostImpl;
 | |
|  class ServiceWorkerContextWatcher;
 | |
|  class ServiceWorkerContextWrapper;
 | |
| -class StoragePartitionImpl;
 | |
| +class StoragePartition;
 | |
|  
 | |
|  namespace protocol {
 | |
|  
 | |
| @@ -74,7 +74,7 @@ class ServiceWorkerHandler : public DevToolsDomainHandler,
 | |
|    bool enabled_;
 | |
|    scoped_refptr<ServiceWorkerContextWatcher> context_watcher_;
 | |
|    BrowserContext* browser_context_;
 | |
| -  StoragePartitionImpl* storage_partition_;
 | |
| +  StoragePartition* storage_partition_;
 | |
|  
 | |
|    base::WeakPtrFactory<ServiceWorkerHandler> weak_factory_;
 | |
|  
 | |
| diff --git content/browser/download/download_manager_impl.cc content/browser/download/download_manager_impl.cc
 | |
| index 73135a675b85..4e1b9854ad9d 100644
 | |
| --- content/browser/download/download_manager_impl.cc
 | |
| +++ content/browser/download/download_manager_impl.cc
 | |
| @@ -84,9 +84,9 @@
 | |
|  namespace content {
 | |
|  namespace {
 | |
|  
 | |
| -StoragePartitionImpl* GetStoragePartition(BrowserContext* context,
 | |
| -                                          int render_process_id,
 | |
| -                                          int render_frame_id) {
 | |
| +StoragePartition* GetStoragePartition(BrowserContext* context,
 | |
| +                                      int render_process_id,
 | |
| +                                      int render_frame_id) {
 | |
|    DCHECK_CURRENTLY_ON(BrowserThread::UI);
 | |
|  
 | |
|    SiteInstance* site_instance = nullptr;
 | |
| @@ -96,8 +96,7 @@ StoragePartitionImpl* GetStoragePartition(BrowserContext* context,
 | |
|      if (render_frame_host_)
 | |
|        site_instance = render_frame_host_->GetSiteInstance();
 | |
|    }
 | |
| -  return static_cast<StoragePartitionImpl*>(
 | |
| -      BrowserContext::GetStoragePartition(context, site_instance));
 | |
| +  return BrowserContext::GetStoragePartition(context, site_instance);
 | |
|  }
 | |
|  
 | |
|  bool CanRequestURLFromRenderer(int render_process_id, GURL url) {
 | |
| @@ -250,7 +249,7 @@ base::FilePath GetTemporaryDownloadDirectory() {
 | |
|  #endif
 | |
|  
 | |
|  scoped_refptr<download::DownloadURLLoaderFactoryGetter>
 | |
| -CreateDownloadURLLoaderFactoryGetter(StoragePartitionImpl* storage_partition,
 | |
| +CreateDownloadURLLoaderFactoryGetter(StoragePartition* storage_partition,
 | |
|                                       RenderFrameHost* rfh,
 | |
|                                       bool has_suggested_filename) {
 | |
|    network::mojom::URLLoaderFactoryPtrInfo proxy_factory_ptr_info;
 | |
| @@ -267,7 +266,7 @@ CreateDownloadURLLoaderFactoryGetter(StoragePartitionImpl* storage_partition,
 | |
|      }
 | |
|    }
 | |
|    return base::MakeRefCounted<NetworkDownloadURLLoaderFactoryGetter>(
 | |
| -      storage_partition->url_loader_factory_getter(),
 | |
| +      base::WrapRefCounted(storage_partition->url_loader_factory_getter()),
 | |
|        std::move(proxy_factory_ptr_info), std::move(proxy_factory_request));
 | |
|  }
 | |
|  
 | |
| @@ -597,8 +596,8 @@ void DownloadManagerImpl::ResumeInterruptedDownload(
 | |
|      std::unique_ptr<download::DownloadUrlParameters> params,
 | |
|      uint32_t id,
 | |
|      const GURL& site_url) {
 | |
| -  StoragePartitionImpl* storage_partition = static_cast<StoragePartitionImpl*>(
 | |
| -      BrowserContext::GetStoragePartitionForSite(browser_context_, site_url));
 | |
| +  StoragePartition* storage_partition =
 | |
| +      BrowserContext::GetStoragePartitionForSite(browser_context_, site_url);
 | |
|    params->set_url_request_context_getter(
 | |
|        storage_partition->GetURLRequestContext());
 | |
|    BeginDownloadInternal(std::move(params), nullptr, id, storage_partition);
 | |
| @@ -784,7 +783,7 @@ void DownloadManagerImpl::DownloadUrl(
 | |
|    download::RecordDownloadCountWithSource(
 | |
|        download::DownloadCountTypes::DOWNLOAD_TRIGGERED_COUNT,
 | |
|        params->download_source());
 | |
| -  StoragePartitionImpl* storage_partition =
 | |
| +  StoragePartition* storage_partition =
 | |
|        GetStoragePartition(browser_context_, params->render_process_host_id(),
 | |
|                            params->render_frame_host_routing_id());
 | |
|    BeginDownloadInternal(std::move(params), std::move(blob_data_handle),
 | |
| @@ -1002,7 +1001,7 @@ void DownloadManagerImpl::InterceptNavigationOnChecksComplete(
 | |
|        tab_referrer_url = entry->GetReferrer().url;
 | |
|      }
 | |
|    }
 | |
| -  StoragePartitionImpl* storage_partition =
 | |
| +  StoragePartition* storage_partition =
 | |
|        GetStoragePartition(browser_context_, render_process_id, render_frame_id);
 | |
|    in_progress_manager_->InterceptDownloadFromNavigation(
 | |
|        std::move(resource_request), render_process_id, render_frame_id, site_url,
 | |
| @@ -1017,7 +1016,7 @@ void DownloadManagerImpl::BeginDownloadInternal(
 | |
|      std::unique_ptr<download::DownloadUrlParameters> params,
 | |
|      std::unique_ptr<storage::BlobDataHandle> blob_data_handle,
 | |
|      uint32_t id,
 | |
| -    StoragePartitionImpl* storage_partition) {
 | |
| +    StoragePartition* storage_partition) {
 | |
|    // Check if the renderer is permitted to request the requested URL.
 | |
|    if (params->render_process_host_id() >= 0 &&
 | |
|        !CanRequestURLFromRenderer(params->render_process_host_id(),
 | |
| diff --git content/browser/download/download_manager_impl.h content/browser/download/download_manager_impl.h
 | |
| index e7aa6cefb35c..42c2090ca161 100644
 | |
| --- content/browser/download/download_manager_impl.h
 | |
| +++ content/browser/download/download_manager_impl.h
 | |
| @@ -42,7 +42,7 @@ class DownloadRequestHandleInterface;
 | |
|  
 | |
|  namespace content {
 | |
|  class ResourceContext;
 | |
| -class StoragePartitionImpl;
 | |
| +class StoragePartition;
 | |
|  
 | |
|  class CONTENT_EXPORT DownloadManagerImpl
 | |
|      : public DownloadManager,
 | |
| @@ -246,7 +246,7 @@ class CONTENT_EXPORT DownloadManagerImpl
 | |
|        std::unique_ptr<download::DownloadUrlParameters> params,
 | |
|        std::unique_ptr<storage::BlobDataHandle> blob_data_handle,
 | |
|        uint32_t id,
 | |
| -      StoragePartitionImpl* storage_partition);
 | |
| +      StoragePartition* storage_partition);
 | |
|  
 | |
|    void InterceptNavigationOnChecksComplete(
 | |
|        ResourceRequestInfo::WebContentsGetter web_contents_getter,
 | |
| diff --git content/browser/loader/navigation_url_loader_network_service.cc content/browser/loader/navigation_url_loader_network_service.cc
 | |
| index b4c1232ea111..f44572270b83 100644
 | |
| --- content/browser/loader/navigation_url_loader_network_service.cc
 | |
| +++ content/browser/loader/navigation_url_loader_network_service.cc
 | |
| @@ -893,7 +893,7 @@ class NavigationURLLoaderNetworkService::URLLoaderRequestController
 | |
|      // path does as well for navigations.
 | |
|      bool has_plugin = PluginService::GetInstance()->GetPluginInfo(
 | |
|          -1 /* render_process_id */, -1 /* render_frame_id */, resource_context_,
 | |
| -        resource_request_->url, url::Origin(), head.mime_type,
 | |
| +        resource_request_->url, true, url::Origin(), head.mime_type,
 | |
|          false /* allow_wildcard */, &stale, &plugin, nullptr);
 | |
|  
 | |
|      if (stale) {
 | |
| @@ -1260,7 +1260,7 @@ NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService(
 | |
|      }
 | |
|    }
 | |
|  
 | |
| -  auto* partition = static_cast<StoragePartitionImpl*>(storage_partition);
 | |
| +  auto* partition = storage_partition;
 | |
|    non_network_url_loader_factories_[url::kFileScheme] =
 | |
|        std::make_unique<FileURLLoaderFactory>(
 | |
|            partition->browser_context()->GetPath(),
 | |
| @@ -1274,7 +1274,8 @@ NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService(
 | |
|    DCHECK(!request_controller_);
 | |
|    request_controller_ = std::make_unique<URLLoaderRequestController>(
 | |
|        std::move(initial_interceptors), std::move(new_request), resource_context,
 | |
| -      partition->url_loader_factory_getter(), request_info->common_params.url,
 | |
| +      base::WrapRefCounted(partition->url_loader_factory_getter()),
 | |
| +      request_info->common_params.url,
 | |
|        request_info->begin_params->initiator_origin,
 | |
|        request_info->common_params.suggested_filename,
 | |
|        std::move(proxied_factory_request), std::move(proxied_factory_info),
 | |
| diff --git content/browser/payments/payment_app_installer.cc content/browser/payments/payment_app_installer.cc
 | |
| index 6a6e31bdb070..dce0433e1775 100644
 | |
| --- content/browser/payments/payment_app_installer.cc
 | |
| +++ content/browser/payments/payment_app_installer.cc
 | |
| @@ -125,9 +125,9 @@ class SelfDeleteInstaller
 | |
|    void SetPaymentAppIntoDatabase() {
 | |
|      DCHECK_CURRENTLY_ON(BrowserThread::UI);
 | |
|  
 | |
| -    StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
 | |
| +    StoragePartition* partition =
 | |
|          BrowserContext::GetDefaultStoragePartition(
 | |
| -            web_contents()->GetBrowserContext()));
 | |
| +            web_contents()->GetBrowserContext());
 | |
|      scoped_refptr<PaymentAppContextImpl> payment_app_context =
 | |
|          partition->GetPaymentAppContext();
 | |
|  
 | |
| diff --git content/browser/payments/payment_app_provider_impl.cc content/browser/payments/payment_app_provider_impl.cc
 | |
| index 5d4aefd16449..b5f99bc43389 100644
 | |
| --- content/browser/payments/payment_app_provider_impl.cc
 | |
| +++ content/browser/payments/payment_app_provider_impl.cc
 | |
| @@ -307,10 +307,11 @@ void StartServiceWorkerForDispatch(BrowserContext* browser_context,
 | |
|                                     ServiceWorkerStartCallback callback) {
 | |
|    DCHECK_CURRENTLY_ON(BrowserThread::UI);
 | |
|  
 | |
| -  StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
 | |
| -      BrowserContext::GetDefaultStoragePartition(browser_context));
 | |
| +  StoragePartition* partition =
 | |
| +      BrowserContext::GetDefaultStoragePartition(browser_context);
 | |
|    scoped_refptr<ServiceWorkerContextWrapper> service_worker_context =
 | |
| -      partition->GetServiceWorkerContext();
 | |
| +      static_cast<ServiceWorkerContextWrapper*>(
 | |
| +          partition->GetServiceWorkerContext());
 | |
|  
 | |
|    BrowserThread::PostTask(
 | |
|        BrowserThread::IO, FROM_HERE,
 | |
| @@ -377,8 +378,8 @@ void PaymentAppProviderImpl::GetAllPaymentApps(
 | |
|      GetAllPaymentAppsCallback callback) {
 | |
|    DCHECK_CURRENTLY_ON(BrowserThread::UI);
 | |
|  
 | |
| -  StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
 | |
| -      BrowserContext::GetDefaultStoragePartition(browser_context));
 | |
| +  StoragePartition* partition =
 | |
| +      BrowserContext::GetDefaultStoragePartition(browser_context);
 | |
|    scoped_refptr<PaymentAppContextImpl> payment_app_context =
 | |
|        partition->GetPaymentAppContext();
 | |
|  
 | |
| diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc
 | |
| index a0162dcd2946..eef13b5035e9 100644
 | |
| --- content/browser/renderer_host/render_process_host_impl.cc
 | |
| +++ content/browser/renderer_host/render_process_host_impl.cc
 | |
| @@ -734,11 +734,10 @@ class DefaultSubframeProcessHostHolder : public base::SupportsUserData::Data,
 | |
|    // Gets the correct render process to use for this SiteInstance.
 | |
|    RenderProcessHost* GetProcessHost(SiteInstance* site_instance,
 | |
|                                      bool is_for_guests_only) {
 | |
| -    StoragePartitionImpl* default_partition =
 | |
| -        static_cast<StoragePartitionImpl*>(
 | |
| -            BrowserContext::GetDefaultStoragePartition(browser_context_));
 | |
| -    StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
 | |
| -        BrowserContext::GetStoragePartition(browser_context_, site_instance));
 | |
| +    StoragePartition* default_partition =
 | |
| +        BrowserContext::GetDefaultStoragePartition(browser_context_);
 | |
| +    StoragePartition* partition =
 | |
| +        BrowserContext::GetStoragePartition(browser_context_, site_instance);
 | |
|  
 | |
|      // Is this the default storage partition? If it isn't, then just give it its
 | |
|      // own non-shared process.
 | |
| @@ -1351,7 +1350,7 @@ int RenderProcessHost::GetCurrentRenderProcessCountForTesting() {
 | |
|  // static
 | |
|  RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost(
 | |
|      BrowserContext* browser_context,
 | |
| -    StoragePartitionImpl* storage_partition_impl,
 | |
| +    StoragePartition* storage_partition_impl,
 | |
|      SiteInstance* site_instance,
 | |
|      bool is_for_guests_only) {
 | |
|    if (g_render_process_host_factory_) {
 | |
| @@ -1360,8 +1359,8 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost(
 | |
|    }
 | |
|  
 | |
|    if (!storage_partition_impl) {
 | |
| -    storage_partition_impl = static_cast<StoragePartitionImpl*>(
 | |
| -        BrowserContext::GetStoragePartition(browser_context, site_instance));
 | |
| +    storage_partition_impl =
 | |
| +        BrowserContext::GetStoragePartition(browser_context, site_instance);
 | |
|    }
 | |
|    // If we've made a StoragePartition for guests (e.g., for the <webview> tag),
 | |
|    // stash the Site URL on it. This way, when we start a service worker inside
 | |
| @@ -1386,7 +1385,7 @@ const unsigned int RenderProcessHostImpl::kMaxFrameDepthForPriority =
 | |
|  
 | |
|  RenderProcessHostImpl::RenderProcessHostImpl(
 | |
|      BrowserContext* browser_context,
 | |
| -    StoragePartitionImpl* storage_partition_impl,
 | |
| +    StoragePartition* storage_partition_impl,
 | |
|      bool is_for_guests_only)
 | |
|      : fast_shutdown_started_(false),
 | |
|        deleting_soon_(false),
 | |
| @@ -1419,7 +1418,8 @@ RenderProcessHostImpl::RenderProcessHostImpl(
 | |
|        indexed_db_factory_(new IndexedDBDispatcherHost(
 | |
|            id_,
 | |
|            storage_partition_impl_->GetURLRequestContext(),
 | |
| -          storage_partition_impl_->GetIndexedDBContext(),
 | |
| +          static_cast<IndexedDBContextImpl*>(
 | |
| +              storage_partition_impl_->GetIndexedDBContext()),
 | |
|            ChromeBlobStorageContext::GetFor(browser_context_))),
 | |
|        channel_connected_(false),
 | |
|        sent_render_process_ready_(false),
 | |
| @@ -1454,7 +1454,8 @@ RenderProcessHostImpl::RenderProcessHostImpl(
 | |
|    }
 | |
|  
 | |
|    push_messaging_manager_.reset(new PushMessagingManager(
 | |
| -      GetID(), storage_partition_impl_->GetServiceWorkerContext()));
 | |
| +      GetID(), static_cast<ServiceWorkerContextWrapper*>(
 | |
| +          storage_partition_impl_->GetServiceWorkerContext())));
 | |
|  
 | |
|    AddObserver(indexed_db_factory_.get());
 | |
|  #if defined(OS_MACOSX)
 | |
| @@ -1782,6 +1783,20 @@ void RenderProcessHostImpl::ResetChannelProxy() {
 | |
|  
 | |
|  void RenderProcessHostImpl::CreateMessageFilters() {
 | |
|    DCHECK_CURRENTLY_ON(BrowserThread::UI);
 | |
| +
 | |
| +  // Cast to the derived type from StoragePartitionImpl.
 | |
| +  auto app_cache_service = static_cast<ChromeAppCacheService*>(
 | |
| +      storage_partition_impl_->GetAppCacheService());
 | |
| +  auto dom_storage_context = static_cast<DOMStorageContextWrapper*>(
 | |
| +      storage_partition_impl_->GetDOMStorageContext());
 | |
| +  auto cache_storage_context = static_cast<CacheStorageContextImpl*>(
 | |
| +      storage_partition_impl_->GetCacheStorageContext());
 | |
| +  auto service_worker_context = static_cast<ServiceWorkerContextWrapper*>(
 | |
| +      storage_partition_impl_->GetServiceWorkerContext());
 | |
| +  auto platform_notification_context =
 | |
| +      static_cast<PlatformNotificationContextImpl*>(
 | |
| +          storage_partition_impl_->GetPlatformNotificationContext());
 | |
| +
 | |
|    AddFilter(new ResourceSchedulerFilter(GetID()));
 | |
|    MediaInternals* media_internals = MediaInternals::GetInstance();
 | |
|    // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages
 | |
| @@ -1795,8 +1810,8 @@ void RenderProcessHostImpl::CreateMessageFilters() {
 | |
|        new RenderMessageFilter(
 | |
|            GetID(), GetBrowserContext(), request_context.get(),
 | |
|            widget_helper_.get(), media_internals,
 | |
| -          storage_partition_impl_->GetDOMStorageContext(),
 | |
| -          storage_partition_impl_->GetCacheStorageContext()));
 | |
| +          dom_storage_context,
 | |
| +          cache_storage_context));
 | |
|    AddFilter(render_message_filter.get());
 | |
|  
 | |
|    render_frame_message_filter_ = new RenderFrameMessageFilter(
 | |
| @@ -1823,10 +1838,10 @@ void RenderProcessHostImpl::CreateMessageFilters() {
 | |
|        ChromeBlobStorageContext::GetFor(browser_context);
 | |
|  
 | |
|    resource_message_filter_ = new ResourceMessageFilter(
 | |
| -      GetID(), storage_partition_impl_->GetAppCacheService(),
 | |
| +      GetID(), app_cache_service,
 | |
|        blob_storage_context.get(),
 | |
|        storage_partition_impl_->GetFileSystemContext(),
 | |
| -      storage_partition_impl_->GetServiceWorkerContext(),
 | |
| +      service_worker_context,
 | |
|        storage_partition_impl_->GetPrefetchURLLoaderService(),
 | |
|        std::move(get_contexts_callback),
 | |
|        BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
 | |
| @@ -1835,8 +1850,7 @@ void RenderProcessHostImpl::CreateMessageFilters() {
 | |
|  
 | |
|    AddFilter(
 | |
|        new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_service()));
 | |
| -  AddFilter(new DOMStorageMessageFilter(
 | |
| -      storage_partition_impl_->GetDOMStorageContext()));
 | |
| +  AddFilter(new DOMStorageMessageFilter(dom_storage_context));
 | |
|  
 | |
|  #if BUILDFLAG(ENABLE_WEBRTC)
 | |
|    peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID());
 | |
| @@ -1858,8 +1872,7 @@ void RenderProcessHostImpl::CreateMessageFilters() {
 | |
|  
 | |
|    scoped_refptr<ServiceWorkerDispatcherHost> service_worker_filter =
 | |
|        new ServiceWorkerDispatcherHost(GetID(), resource_context);
 | |
| -  service_worker_filter->Init(
 | |
| -      storage_partition_impl_->GetServiceWorkerContext());
 | |
| +  service_worker_filter->Init(service_worker_context);
 | |
|    AddFilter(service_worker_filter.get());
 | |
|  
 | |
|  #if BUILDFLAG(ENABLE_WEBRTC)
 | |
| @@ -1871,11 +1884,8 @@ void RenderProcessHostImpl::CreateMessageFilters() {
 | |
|    AddFilter(new TraceMessageFilter(GetID()));
 | |
|    AddFilter(new ResolveProxyMsgHelper(request_context.get()));
 | |
|  
 | |
| -  scoped_refptr<ServiceWorkerContextWrapper> service_worker_context(
 | |
| -      static_cast<ServiceWorkerContextWrapper*>(
 | |
| -          storage_partition_impl_->GetServiceWorkerContext()));
 | |
|    notification_message_filter_ = new NotificationMessageFilter(
 | |
| -      GetID(), storage_partition_impl_->GetPlatformNotificationContext(),
 | |
| +      GetID(), platform_notification_context,
 | |
|        resource_context, service_worker_context, browser_context);
 | |
|    AddFilter(notification_message_filter_.get());
 | |
|  }
 | |
| @@ -1889,7 +1899,8 @@ void RenderProcessHostImpl::BindCacheStorage(
 | |
|      cache_storage_dispatcher_host_ =
 | |
|          base::MakeRefCounted<CacheStorageDispatcherHost>();
 | |
|      cache_storage_dispatcher_host_->Init(
 | |
| -        storage_partition_impl_->GetCacheStorageContext());
 | |
| +        static_cast<CacheStorageContextImpl*>(
 | |
| +            storage_partition_impl_->GetCacheStorageContext()));
 | |
|    }
 | |
|    // Send the binding to IO thread, because Cache Storage handles Mojo IPC on IO
 | |
|    // thread entirely.
 | |
| @@ -2022,7 +2033,8 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() {
 | |
|  
 | |
|    registry->AddInterface(base::BindRepeating(
 | |
|        &AppCacheDispatcherHost::Create,
 | |
| -      base::Unretained(storage_partition_impl_->GetAppCacheService()),
 | |
| +      base::Unretained(static_cast<ChromeAppCacheService*>(
 | |
| +          storage_partition_impl_->GetAppCacheService())),
 | |
|        GetID()));
 | |
|  
 | |
|    AddUIThreadInterface(registry.get(), base::Bind(&FieldTrialRecorder::Create));
 | |
| diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h
 | |
| index 4a9513bfa37c..23639d2bbf2b 100644
 | |
| --- content/browser/renderer_host/render_process_host_impl.h
 | |
| +++ content/browser/renderer_host/render_process_host_impl.h
 | |
| @@ -88,7 +88,6 @@ class ResourceMessageFilter;
 | |
|  class SiteInstance;
 | |
|  class SiteInstanceImpl;
 | |
|  class StoragePartition;
 | |
| -class StoragePartitionImpl;
 | |
|  struct ChildProcessTerminationInfo;
 | |
|  
 | |
|  #if BUILDFLAG(ENABLE_WEBRTC)
 | |
| @@ -136,7 +135,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
 | |
|    // null.
 | |
|    static RenderProcessHost* CreateRenderProcessHost(
 | |
|        BrowserContext* browser_context,
 | |
| -      StoragePartitionImpl* storage_partition_impl,
 | |
| +      StoragePartition* storage_partition_impl,
 | |
|        SiteInstance* site_instance,
 | |
|        bool is_for_guests_only);
 | |
|  
 | |
| @@ -446,7 +445,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
 | |
|    // Use CreateRenderProcessHost() instead of calling this constructor
 | |
|    // directly.
 | |
|    RenderProcessHostImpl(BrowserContext* browser_context,
 | |
| -                        StoragePartitionImpl* storage_partition_impl,
 | |
| +                        StoragePartition* storage_partition_impl,
 | |
|                          bool is_for_guests_only);
 | |
|  
 | |
|    // Initializes a new IPC::ChannelProxy in |channel_|, which will be connected
 | |
| @@ -717,10 +716,10 @@ class CONTENT_EXPORT RenderProcessHostImpl
 | |
|    // called.
 | |
|    int instance_id_ = 1;
 | |
|  
 | |
| -  BrowserContext* const browser_context_;
 | |
| +  BrowserContext* browser_context_;
 | |
|  
 | |
|    // Owned by |browser_context_|.
 | |
| -  StoragePartitionImpl* storage_partition_impl_;
 | |
| +  StoragePartition* storage_partition_impl_;
 | |
|  
 | |
|    // The observers watching our lifetime.
 | |
|    base::ObserverList<RenderProcessHostObserver> observers_;
 | |
| diff --git content/browser/renderer_interface_binders.cc content/browser/renderer_interface_binders.cc
 | |
| index 81e1e824d0f2..4a1c11c597d9 100644
 | |
| --- content/browser/renderer_interface_binders.cc
 | |
| +++ content/browser/renderer_interface_binders.cc
 | |
| @@ -135,7 +135,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() {
 | |
|    parameterized_binder_registry_.AddInterface(
 | |
|        base::Bind([](payments::mojom::PaymentManagerRequest request,
 | |
|                      RenderProcessHost* host, const url::Origin& origin) {
 | |
| -        static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
 | |
| +        host->GetStoragePartition()
 | |
|              ->GetPaymentAppContext()
 | |
|              ->CreatePaymentManager(std::move(request));
 | |
|        }));
 | |
| @@ -155,7 +155,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() {
 | |
|    parameterized_binder_registry_.AddInterface(base::BindRepeating(
 | |
|        [](blink::mojom::LockManagerRequest request, RenderProcessHost* host,
 | |
|           const url::Origin& origin) {
 | |
| -        static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
 | |
| +        host->GetStoragePartition()
 | |
|              ->GetLockManager()
 | |
|              ->CreateService(std::move(request), origin);
 | |
|        }));
 | |
| @@ -164,9 +164,10 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() {
 | |
|    parameterized_binder_registry_.AddInterface(
 | |
|        base::Bind([](blink::mojom::NotificationServiceRequest request,
 | |
|                      RenderProcessHost* host, const url::Origin& origin) {
 | |
| -        static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
 | |
| -            ->GetPlatformNotificationContext()
 | |
| -            ->CreateService(host->GetID(), origin, std::move(request));
 | |
| +        static_cast<PlatformNotificationContextImpl*>(
 | |
| +            host->GetStoragePartition()
 | |
| +                ->GetPlatformNotificationContext())
 | |
| +                ->CreateService(host->GetID(), origin, std::move(request));
 | |
|        }));
 | |
|    parameterized_binder_registry_.AddInterface(
 | |
|        base::BindRepeating(&BackgroundFetchServiceImpl::Create));
 | |
| diff --git content/browser/shared_worker/shared_worker_connector_impl.cc content/browser/shared_worker/shared_worker_connector_impl.cc
 | |
| index 4b08ffd8b662..a09bdc7cb892 100644
 | |
| --- content/browser/shared_worker/shared_worker_connector_impl.cc
 | |
| +++ content/browser/shared_worker/shared_worker_connector_impl.cc
 | |
| @@ -41,8 +41,8 @@ void SharedWorkerConnectorImpl::Connect(
 | |
|      return;
 | |
|    }
 | |
|    SharedWorkerServiceImpl* service =
 | |
| -      static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
 | |
| -          ->GetSharedWorkerService();
 | |
| +      static_cast<SharedWorkerServiceImpl*>(host->GetStoragePartition()
 | |
| +          ->GetSharedWorkerService());
 | |
|    service->ConnectToWorker(process_id_, frame_id_, std::move(info),
 | |
|                             std::move(client), creation_context_type,
 | |
|                             blink::MessagePortChannel(std::move(message_port)));
 | |
| diff --git content/browser/shared_worker/shared_worker_service_impl.cc content/browser/shared_worker/shared_worker_service_impl.cc
 | |
| index 597e99215428..29c6ba3049b7 100644
 | |
| --- content/browser/shared_worker/shared_worker_service_impl.cc
 | |
| +++ content/browser/shared_worker/shared_worker_service_impl.cc
 | |
| @@ -206,8 +206,8 @@ void SharedWorkerServiceImpl::CreateWorker(
 | |
|          BrowserThread::IO, FROM_HERE,
 | |
|          base::BindOnce(
 | |
|              &CreateScriptLoaderOnIO,
 | |
| -            service_worker_context_->storage_partition()
 | |
| -                ->url_loader_factory_getter(),
 | |
| +            base::WrapRefCounted(service_worker_context_->storage_partition()
 | |
| +                ->url_loader_factory_getter()),
 | |
|              service_worker_context_, process_id,
 | |
|              base::BindOnce(&SharedWorkerServiceImpl::StartWorker,
 | |
|                             weak_factory_.GetWeakPtr(), std::move(instance),
 | |
| diff --git content/browser/storage_partition_impl.h content/browser/storage_partition_impl.h
 | |
| index 2cf35167ebaa..646392017593 100644
 | |
| --- content/browser/storage_partition_impl.h
 | |
| +++ content/browser/storage_partition_impl.h
 | |
| @@ -96,7 +96,7 @@ class CONTENT_EXPORT StoragePartitionImpl
 | |
|    storage::FileSystemContext* GetFileSystemContext() override;
 | |
|    storage::DatabaseTracker* GetDatabaseTracker() override;
 | |
|    DOMStorageContextWrapper* GetDOMStorageContext() override;
 | |
| -  LockManager* GetLockManager();  // override; TODO: Add to interface
 | |
| +  LockManager* GetLockManager() override;
 | |
|    IndexedDBContextImpl* GetIndexedDBContext() override;
 | |
|    CacheStorageContextImpl* GetCacheStorageContext() override;
 | |
|    ServiceWorkerContextWrapper* GetServiceWorkerContext() override;
 | |
| @@ -135,14 +135,14 @@ class CONTENT_EXPORT StoragePartitionImpl
 | |
|    void FlushNetworkInterfaceForTesting() override;
 | |
|    void WaitForDeletionTasksForTesting() override;
 | |
|  
 | |
| -  BackgroundFetchContext* GetBackgroundFetchContext();
 | |
| -  BackgroundSyncContext* GetBackgroundSyncContext();
 | |
| -  PaymentAppContextImpl* GetPaymentAppContext();
 | |
| -  BroadcastChannelProvider* GetBroadcastChannelProvider();
 | |
| -  BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap();
 | |
| -  BlobURLLoaderFactory* GetBlobURLLoaderFactory();
 | |
| -  BlobRegistryWrapper* GetBlobRegistry();
 | |
| -  PrefetchURLLoaderService* GetPrefetchURLLoaderService();
 | |
| +  BackgroundFetchContext* GetBackgroundFetchContext() override;
 | |
| +  BackgroundSyncContext* GetBackgroundSyncContext() override;
 | |
| +  PaymentAppContextImpl* GetPaymentAppContext() override;
 | |
| +  BroadcastChannelProvider* GetBroadcastChannelProvider() override;
 | |
| +  BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override;
 | |
| +  BlobURLLoaderFactory* GetBlobURLLoaderFactory() override;
 | |
| +  BlobRegistryWrapper* GetBlobRegistry() override;
 | |
| +  PrefetchURLLoaderService* GetPrefetchURLLoaderService() override;
 | |
|  
 | |
|    // mojom::StoragePartitionService interface.
 | |
|    void OpenLocalStorage(const url::Origin& origin,
 | |
| @@ -151,18 +151,18 @@ class CONTENT_EXPORT StoragePartitionImpl
 | |
|        const std::string& namespace_id,
 | |
|        mojom::SessionStorageNamespaceRequest request) override;
 | |
|  
 | |
| -  scoped_refptr<URLLoaderFactoryGetter> url_loader_factory_getter() {
 | |
| -    return url_loader_factory_getter_;
 | |
| +  URLLoaderFactoryGetter* url_loader_factory_getter() override {
 | |
| +    return url_loader_factory_getter_.get();
 | |
|    }
 | |
|  
 | |
|    // Can return nullptr while |this| is being destroyed.
 | |
| -  BrowserContext* browser_context() const;
 | |
| +  BrowserContext* browser_context() const override;
 | |
|  
 | |
|    // Called by each renderer process once. Returns the id of the created
 | |
|    // binding.
 | |
|    mojo::BindingId Bind(
 | |
|        int process_id,
 | |
| -      mojo::InterfaceRequest<mojom::StoragePartitionService> request);
 | |
| +      mojo::InterfaceRequest<mojom::StoragePartitionService> request) override;
 | |
|  
 | |
|    auto& bindings_for_testing() { return bindings_; }
 | |
|  
 | |
| @@ -173,10 +173,11 @@ class CONTENT_EXPORT StoragePartitionImpl
 | |
|    // one must use the "chrome-guest://blahblah" site URL to ensure that the
 | |
|    // service worker stays in this StoragePartition. This is an empty GURL if
 | |
|    // this StoragePartition is not for guests.
 | |
| -  void set_site_for_service_worker(const GURL& site_for_service_worker) {
 | |
| +  void set_site_for_service_worker(
 | |
| +      const GURL& site_for_service_worker) override {
 | |
|      site_for_service_worker_ = site_for_service_worker;
 | |
|    }
 | |
| -  const GURL& site_for_service_worker() const {
 | |
| +  const GURL& site_for_service_worker() const override {
 | |
|      return site_for_service_worker_;
 | |
|    }
 | |
|  
 | |
| diff --git content/browser/streams/stream_context.cc content/browser/streams/stream_context.cc
 | |
| index 0ab6a2d6f963..f24e547f2396 100644
 | |
| --- content/browser/streams/stream_context.cc
 | |
| +++ content/browser/streams/stream_context.cc
 | |
| @@ -21,6 +21,11 @@ namespace content {
 | |
|  
 | |
|  StreamContext::StreamContext() {}
 | |
|  
 | |
| +// static
 | |
| +const void* StreamContext::GetUserDataKey() {
 | |
| +  return kStreamContextKeyName;
 | |
| +}
 | |
| +
 | |
|  StreamContext* StreamContext::GetFor(BrowserContext* context) {
 | |
|    if (!context->GetUserData(kStreamContextKeyName)) {
 | |
|      scoped_refptr<StreamContext> stream = new StreamContext();
 | |
| diff --git content/browser/streams/stream_context.h content/browser/streams/stream_context.h
 | |
| index 075ae3e7431e..57fb5fd2c4a8 100644
 | |
| --- content/browser/streams/stream_context.h
 | |
| +++ content/browser/streams/stream_context.h
 | |
| @@ -29,6 +29,7 @@ class StreamContext
 | |
|   public:
 | |
|    StreamContext();
 | |
|  
 | |
| +  CONTENT_EXPORT static const void* GetUserDataKey();
 | |
|    CONTENT_EXPORT static StreamContext* GetFor(BrowserContext* browser_context);
 | |
|  
 | |
|    void InitializeOnIOThread();
 | |
| diff --git content/browser/webui/web_ui_url_loader_factory.cc content/browser/webui/web_ui_url_loader_factory.cc
 | |
| index fb7a2fe41f94..f8232c08e924 100644
 | |
| --- content/browser/webui/web_ui_url_loader_factory.cc
 | |
| +++ content/browser/webui/web_ui_url_loader_factory.cc
 | |
| @@ -19,13 +19,13 @@
 | |
|  #include "content/browser/frame_host/render_frame_host_impl.h"
 | |
|  #include "content/browser/histogram_internals_url_loader.h"
 | |
|  #include "content/browser/resource_context_impl.h"
 | |
| -#include "content/browser/storage_partition_impl.h"
 | |
|  #include "content/browser/webui/network_error_url_loader.h"
 | |
|  #include "content/browser/webui/url_data_manager_backend.h"
 | |
|  #include "content/browser/webui/url_data_source_impl.h"
 | |
|  #include "content/public/browser/browser_context.h"
 | |
|  #include "content/public/browser/browser_thread.h"
 | |
|  #include "content/public/browser/render_process_host.h"
 | |
| +#include "content/public/browser/storage_partition.h"
 | |
|  #include "content/public/browser/web_contents.h"
 | |
|  #include "content/public/browser/web_contents_observer.h"
 | |
|  #include "content/public/common/url_constants.h"
 | |
| @@ -313,9 +313,8 @@ class WebUIURLLoaderFactory : public network::mojom::URLLoaderFactory,
 | |
|    const std::string& scheme() const { return scheme_; }
 | |
|  
 | |
|   private:
 | |
| -  StoragePartitionImpl* GetStoragePartition() {
 | |
| -    return static_cast<StoragePartitionImpl*>(
 | |
| -        render_frame_host_->GetProcess()->GetStoragePartition());
 | |
| +  StoragePartition* GetStoragePartition() {
 | |
| +    return render_frame_host_->GetProcess()->GetStoragePartition();
 | |
|    }
 | |
|  
 | |
|    RenderFrameHost* render_frame_host_;
 | |
| diff --git content/public/browser/browser_context.h content/public/browser/browser_context.h
 | |
| index 4df248003ecb..395c670dbd1e 100644
 | |
| --- content/public/browser/browser_context.h
 | |
| +++ content/public/browser/browser_context.h
 | |
| @@ -206,6 +206,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
 | |
|  
 | |
|    BrowserContext();
 | |
|  
 | |
| +  static const void* GetStoragePartitionMapUserDataKey();
 | |
| +
 | |
|    ~BrowserContext() override;
 | |
|  
 | |
|    // Shuts down the storage partitions associated to this browser context.
 | |
| @@ -294,6 +296,14 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
 | |
|            const base::FilePath& partition_path,
 | |
|            bool in_memory) = 0;
 | |
|  
 | |
| +  // CEF returns a proxy object that forwards method calls to |partition_impl|.
 | |
| +  virtual content::StoragePartition* GetStoragePartitionProxy(
 | |
| +      BrowserContext* browser_context,
 | |
| +      content::StoragePartition* partition_impl) {
 | |
| +    NOTREACHED();
 | |
| +    return nullptr;
 | |
| +  }
 | |
| +
 | |
|    using StaticServiceMap =
 | |
|        std::map<std::string, service_manager::EmbeddedServiceInfo>;
 | |
|  
 | |
| diff --git content/public/browser/storage_partition.h content/public/browser/storage_partition.h
 | |
| index 5a3984eb6efb..fa57b523eaf2 100644
 | |
| --- content/public/browser/storage_partition.h
 | |
| +++ content/public/browser/storage_partition.h
 | |
| @@ -14,6 +14,7 @@
 | |
|  #include "base/files/file_path.h"
 | |
|  #include "base/time/time.h"
 | |
|  #include "content/common/content_export.h"
 | |
| +#include "mojo/public/cpp/bindings/binding_set.h"
 | |
|  #include "net/cookies/cookie_store.h"
 | |
|  #include "services/network/public/cpp/shared_url_loader_factory.h"
 | |
|  
 | |
| @@ -59,12 +60,27 @@ class ServiceWorkerContext;
 | |
|  class SharedWorkerService;
 | |
|  class WebPackageContext;
 | |
|  
 | |
| +class BackgroundFetchContext;
 | |
| +class BackgroundSyncContext;
 | |
| +class BlobRegistryWrapper;
 | |
| +class BlobURLLoaderFactory;
 | |
| +class BluetoothAllowedDevicesMap;
 | |
| +class BroadcastChannelProvider;
 | |
| +class LockManager;
 | |
| +class PaymentAppContextImpl;
 | |
| +class PrefetchURLLoaderService;
 | |
| +class URLLoaderFactoryGetter;
 | |
| +
 | |
|  #if !defined(OS_ANDROID)
 | |
|  class HostZoomLevelContext;
 | |
|  class HostZoomMap;
 | |
|  class ZoomLevelDelegate;
 | |
|  #endif  // !defined(OS_ANDROID)
 | |
|  
 | |
| +namespace mojom {
 | |
| +class StoragePartitionService;
 | |
| +}
 | |
| +
 | |
|  // Defines what persistent state a child process can access.
 | |
|  //
 | |
|  // The StoragePartition defines the view each child process has of the
 | |
| @@ -97,6 +113,7 @@ class CONTENT_EXPORT StoragePartition {
 | |
|    virtual storage::FileSystemContext* GetFileSystemContext() = 0;
 | |
|    virtual storage::DatabaseTracker* GetDatabaseTracker() = 0;
 | |
|    virtual DOMStorageContext* GetDOMStorageContext() = 0;
 | |
| +  virtual LockManager* GetLockManager() = 0;
 | |
|    virtual IndexedDBContext* GetIndexedDBContext() = 0;
 | |
|    virtual ServiceWorkerContext* GetServiceWorkerContext() = 0;
 | |
|    virtual SharedWorkerService* GetSharedWorkerService() = 0;
 | |
| @@ -213,6 +230,26 @@ class CONTENT_EXPORT StoragePartition {
 | |
|    // Wait until all deletions tasks are finished. For test use only.
 | |
|    virtual void WaitForDeletionTasksForTesting() = 0;
 | |
|  
 | |
| +  virtual BackgroundFetchContext* GetBackgroundFetchContext() = 0;
 | |
| +  virtual BackgroundSyncContext* GetBackgroundSyncContext() = 0;
 | |
| +  virtual PaymentAppContextImpl* GetPaymentAppContext() = 0;
 | |
| +  virtual BroadcastChannelProvider* GetBroadcastChannelProvider() = 0;
 | |
| +  virtual BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() = 0;
 | |
| +  virtual BlobURLLoaderFactory* GetBlobURLLoaderFactory() = 0;
 | |
| +  virtual BlobRegistryWrapper* GetBlobRegistry() = 0;
 | |
| +  virtual PrefetchURLLoaderService* GetPrefetchURLLoaderService() = 0;
 | |
| +
 | |
| +  virtual URLLoaderFactoryGetter* url_loader_factory_getter() = 0;
 | |
| +  virtual BrowserContext* browser_context() const = 0;
 | |
| +
 | |
| +  virtual mojo::BindingId Bind(
 | |
| +      int process_id,
 | |
| +      mojo::InterfaceRequest<mojom::StoragePartitionService> request) = 0;
 | |
| +      
 | |
| +  virtual void set_site_for_service_worker(
 | |
| +      const GURL& site_for_service_worker) = 0;
 | |
| +  virtual const GURL& site_for_service_worker() const = 0;
 | |
| +
 | |
|   protected:
 | |
|    virtual ~StoragePartition() {}
 | |
|  };
 | |
| diff --git storage/browser/database/database_tracker.cc storage/browser/database/database_tracker.cc
 | |
| index 2b415cceb6cb..e3b71f3f0e74 100644
 | |
| --- storage/browser/database/database_tracker.cc
 | |
| +++ storage/browser/database/database_tracker.cc
 | |
| @@ -482,7 +482,7 @@ bool DatabaseTracker::LazyInit() {
 | |
|      meta_table_.reset(new sql::MetaTable());
 | |
|  
 | |
|      is_initialized_ =
 | |
| -        base::CreateDirectory(db_dir_) &&
 | |
| +        (is_incognito_ ? true : base::CreateDirectory(db_dir_)) &&
 | |
|          (db_->is_open() ||
 | |
|           (is_incognito_ ? db_->OpenInMemory() :
 | |
|            db_->Open(kTrackerDatabaseFullPath))) &&
 |