Add StoragePartition and extension object proxy support (issue #1973)

This commit is contained in:
Marshall Greenblatt 2016-08-24 12:28:52 +03:00
parent 1c06d8e3f5
commit 69334e22c2
19 changed files with 810 additions and 138 deletions

View File

@ -379,6 +379,8 @@ static_library("libcef_static") {
"libcef/browser/ssl_host_state_delegate.h",
"libcef/browser/ssl_info_impl.cc",
"libcef/browser/ssl_info_impl.h",
"libcef/browser/storage_partition_proxy.cc",
"libcef/browser/storage_partition_proxy.h",
"libcef/browser/stream_impl.cc",
"libcef/browser/stream_impl.h",
"libcef/browser/trace_impl.cc",

View File

@ -14,8 +14,6 @@
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/common/constants.h"
#ifndef NDEBUG
base::AtomicRefCount CefBrowserContext::DebugObjCt = 0;
@ -41,12 +39,17 @@ void CefBrowserContext::Initialize() {
content::BrowserContext::Initialize(this, GetPath());
const bool extensions_enabled = extensions::ExtensionsEnabled();
bool extensions_initialized = false;
if (extensions_enabled) {
// Create the custom ExtensionSystem first because other KeyedServices
// depend on it.
// The same CefExtensionSystem instance is shared by CefBrowserContextImpl
// and CefBrowserContextProxy objects.
extension_system_ = static_cast<extensions::CefExtensionSystem*>(
extensions::ExtensionSystem::Get(this));
extension_system_->InitForRegularProfile(true);
extensions_initialized = extension_system_->initialized();
if (!extensions_initialized)
extension_system_->InitForRegularProfile(true);
}
resource_context_.reset(new CefResourceContext(
@ -63,25 +66,10 @@ void CefBrowserContext::Initialize() {
DCHECK(pref_service);
user_prefs::UserPrefs::Set(this, pref_service);
if (extensions_enabled)
if (extensions_enabled && !extensions_initialized)
extension_system_->Init();
}
void CefBrowserContext::CreateProtocolHandlers(
content::ProtocolHandlerMap* protocol_handlers) {
if (extensions::ExtensionsEnabled()) {
// Handle only chrome-extension:// requests. CEF does not support
// chrome-extension-resource:// requests (it does not store shared extension
// data in its installation directory).
extensions::InfoMap* extension_info_map =
extension_system()->info_map();
(*protocol_handlers)[extensions::kExtensionScheme] =
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
extensions::CreateExtensionProtocolHandler(
IsOffTheRecord(), extension_info_map).release());
}
}
void CefBrowserContext::Shutdown() {
CEF_REQUIRE_UIT();

View File

@ -33,12 +33,22 @@
//
// BCI = CefBrowserContextImpl
// Entry point from WC when using an isolated RCI. Owns the RC and creates the
// URCGI. Life span controlled by RCI and (for the global context)
// SPI indirectly. Life span controlled by RCI and (for the global context)
// CefBrowserMainParts.
//
// BCP = CefBrowserContextProxy
// Entry point from WC when using a custom RCI. Owns the RC and creates the
// URCGP. Life span controlled by RCI.
// URCGP and SPP. Life span controlled by RCI.
//
// SPI = content::StoragePartitionImpl
// Owns storage-related objects like Quota, IndexedDB, Cache, etc. Created by
// StoragePartitionImplMap::Get(). Provides access to the URCGI. Life span is
// controlled indirectly by BCI.
//
// SPP = CefStoragePartitionProxy
// Forwards requests for storage-related objects to SPI. Created by
// GetStoragePartitionFromConfig() calling BCI::GetStoragePartitionProxy().
// Provides access to the URCGP. Life span is controlled by BCP.
//
// RC = CefResourceContext
// Acts as a bridge for resource loading. URLRequest life span is tied to this
@ -46,11 +56,14 @@
// controlled by BCI/BCP.
//
// URCGI = CefURLRequestContextGetterImpl
// Creates and owns the URCI. Life span is controlled by RC and (for the
// global context) CefBrowserMainParts.
// Creates and owns the URCI. Created by StoragePartitionImplMap::Get()
// calling BCI::CreateRequestContext(). Life span is controlled by RC and (for
// the global context) CefBrowserMainParts, and SPI.
//
// URCGP = CefURLRequestContextGetterProxy
// Creates and owns the URCP. Life span is controlled by RC.
// Creates and owns the URCP. Created by GetStoragePartitionFromConfig()
// calling BCI::GetStoragePartitionProxy(). Life span is controlled by RC and
// SPP.
//
// URCI = CefURLRequestContextImpl
// Owns various network-related objects including the isolated cookie manager.
@ -73,15 +86,15 @@
// own = ownership (scoped_ptr)
// ptr = raw pointer
//
// CefBrowserMainParts isolated cookie manager, etc...
// | | ^
// ref ref ref/own
// v v |
// /---> BCI -ref-> URCGI --own-> URCI <-ptr-- CSP
// / ^ ^ ^
// ptr ref ref /
// / | | /
// BHI -own-> WC -ptr-> BCP -ref-> URCGP -own-> URCP --ref-/
// CefBrowserMainParts----\ isolated cookie manager, etc.
// | \ ^
// ref ref ref/own
// v v |
// /---> BCI -own-> SPI -ref-> URCGI --own-> URCI <-ptr-- CSP
// / ^ ^ ^ ^
// ptr ref ptr ref /
// / | | | /
// BHI -own-> WC -ptr-> BCP -own-> SPP -ref-> URCGP -own-> URCP --ref-/
//
// BHI -ref-> RCI -ref-> BCI/BCP -own-> RC -ref-> URCGI/URCGP
//
@ -166,8 +179,6 @@ class CefBrowserContext
protected:
~CefBrowserContext() override;
void CreateProtocolHandlers(content::ProtocolHandlerMap* protocol_handlers);
// Must be called before the child object destructor has completed.
void Shutdown();

View File

@ -10,6 +10,7 @@
#include "libcef/browser/browser_context_proxy.h"
#include "libcef/browser/context.h"
#include "libcef/browser/download_manager_delegate.h"
#include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/permissions/permission_manager.h"
#include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/ssl_host_state_delegate.h"
@ -35,6 +36,8 @@
#include "content/public/browser/download_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/common/constants.h"
#include "net/proxy/proxy_config_service.h"
using content::BrowserThread;
@ -201,6 +204,9 @@ CefBrowserContextImpl::CefBrowserContextImpl(
}
CefBrowserContextImpl::~CefBrowserContextImpl() {
// Unregister the context first to avoid re-entrancy during shutdown.
g_manager.Get().RemoveImpl(this, cache_path_);
Shutdown();
// The FontFamilyCache references the ProxyService so delete it before the
@ -218,8 +224,6 @@ CefBrowserContextImpl::~CefBrowserContextImpl() {
// when it's accessed from the content::BrowserContext destructor.
if (download_manager_delegate_)
download_manager_delegate_.reset(NULL);
g_manager.Get().RemoveImpl(this, cache_path_);
}
void CefBrowserContextImpl::Initialize() {
@ -390,22 +394,6 @@ content::BackgroundSyncController*
return nullptr;
}
PrefService* CefBrowserContextImpl::GetPrefs() {
return pref_service_.get();
}
const PrefService* CefBrowserContextImpl::GetPrefs() const {
return pref_service_.get();
}
const CefRequestContextSettings& CefBrowserContextImpl::GetSettings() const {
return settings_;
}
CefRefPtr<CefRequestContextHandler> CefBrowserContextImpl::GetHandler() const {
return NULL;
}
net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
@ -417,7 +405,17 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
ProxyServiceFactory::CreateProxyConfigService(
pref_proxy_config_tracker_.get()));
CreateProtocolHandlers(protocol_handlers);
if (extensions::ExtensionsEnabled()) {
// Handle only chrome-extension:// requests. CEF does not support
// chrome-extension-resource:// requests (it does not store shared extension
// data in its installation directory).
extensions::InfoMap* extension_info_map =
extension_system()->info_map();
(*protocol_handlers)[extensions::kExtensionScheme] =
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
extensions::CreateExtensionProtocolHandler(
IsOffTheRecord(), extension_info_map).release());
}
url_request_getter_ = new CefURLRequestContextGetterImpl(
settings_,
@ -437,6 +435,30 @@ net::URLRequestContextGetter*
bool in_memory,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
return nullptr;
}
content::StoragePartition* CefBrowserContextImpl::GetStoragePartitionProxy(
content::BrowserContext* browser_context,
content::StoragePartition* partition_impl) {
CefBrowserContextProxy* proxy =
static_cast<CefBrowserContextProxy*>(browser_context);
return proxy->GetOrCreateStoragePartitionProxy(partition_impl);
}
PrefService* CefBrowserContextImpl::GetPrefs() {
return pref_service_.get();
}
const PrefService* CefBrowserContextImpl::GetPrefs() const {
return pref_service_.get();
}
const CefRequestContextSettings& CefBrowserContextImpl::GetSettings() const {
return settings_;
}
CefRefPtr<CefRequestContextHandler> CefBrowserContextImpl::GetHandler() const {
return NULL;
}

View File

@ -65,14 +65,6 @@ class CefBrowserContextImpl : public CefBrowserContext,
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override;
content::BackgroundSyncController* GetBackgroundSyncController() override;
// Profile methods.
PrefService* GetPrefs() override;
const PrefService* GetPrefs() const override;
// CefBrowserContext methods.
const CefRequestContextSettings& GetSettings() const override;
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
net::URLRequestContextGetter* CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors)
@ -83,6 +75,17 @@ class CefBrowserContextImpl : public CefBrowserContext,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors)
override;
content::StoragePartition* GetStoragePartitionProxy(
content::BrowserContext* browser_context,
content::StoragePartition* partition_impl) override;
// Profile methods.
PrefService* GetPrefs() override;
const PrefService* GetPrefs() const override;
// CefBrowserContext methods.
const CefRequestContextSettings& GetSettings() const override;
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
HostContentSettingsMap* GetHostContentSettingsMap() override;
void AddVisitedURLs(const std::vector<GURL>& urls) override;

View File

@ -7,23 +7,34 @@
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/download_manager_delegate.h"
#include "libcef/browser/net/url_request_context_getter_proxy.h"
#include "libcef/browser/storage_partition_proxy.h"
#include "libcef/browser/thread_util.h"
#include "base/logging.h"
#include "chrome/browser/font_family_cache.h"
#include "components/guest_view/common/guest_view_constants.h"
#include "components/visitedlink/browser/visitedlink_master.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/resource_context_impl.h"
#include "content/browser/streams/stream_context.h"
#include "content/public/browser/storage_partition.h"
namespace {
bool ShouldProxyUserData(const void* key) {
// If this value is not proxied the blob data fails to load for the PDF
// extension.
if (key == content::StreamContext::GetUserDataKey())
// If this value is not proxied then multiple StoragePartitionImpl objects
// will be created and filesystem API access will fail, among other things.
if (key == content::BrowserContext::GetStoragePartitionMapUserDataKey())
return true;
// If these values are not proxied then blob data fails to load for the PDF
// extension.
// See also the call to InitializeResourceContext().
if (key == content::ChromeBlobStorageContext::GetUserDataKey() ||
key == content::StreamContext::GetUserDataKey()) {
return true;
}
// If this value is not proxied then CefBrowserContextImpl::GetGuestManager()
// returns NULL.
// See also CefExtensionsAPIClient::CreateGuestViewManagerDelegate.
@ -129,6 +140,24 @@ content::BackgroundSyncController*
return parent_->GetBackgroundSyncController();
}
net::URLRequestContextGetter* CefBrowserContextProxy::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
// CefBrowserContextImpl::GetOrCreateStoragePartitionProxy is called instead
// of this method.
NOTREACHED();
return nullptr;
}
net::URLRequestContextGetter*
CefBrowserContextProxy::CreateRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
return nullptr;
}
PrefService* CefBrowserContextProxy::GetPrefs() {
return parent_->GetPrefs();
}
@ -145,29 +174,6 @@ CefRefPtr<CefRequestContextHandler> CefBrowserContextProxy::GetHandler() const {
return handler_;
}
net::URLRequestContextGetter* CefBrowserContextProxy::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
CEF_REQUIRE_UIT();
DCHECK(!url_request_getter_.get());
CreateProtocolHandlers(protocol_handlers);
url_request_getter_ =
new CefURLRequestContextGetterProxy(handler_, parent_->request_context());
resource_context()->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get();
}
net::URLRequestContextGetter*
CefBrowserContextProxy::CreateRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
return NULL;
}
HostContentSettingsMap* CefBrowserContextProxy::GetHostContentSettingsMap() {
return parent_->GetHostContentSettingsMap();
}
@ -175,3 +181,29 @@ HostContentSettingsMap* CefBrowserContextProxy::GetHostContentSettingsMap() {
void CefBrowserContextProxy::AddVisitedURLs(const std::vector<GURL>& urls) {
parent_->AddVisitedURLs(urls);
}
content::StoragePartition*
CefBrowserContextProxy::GetOrCreateStoragePartitionProxy(
content::StoragePartition* partition_impl) {
CEF_REQUIRE_UIT();
if (!storage_partition_proxy_) {
scoped_refptr<CefURLRequestContextGetterProxy> url_request_getter =
new CefURLRequestContextGetterProxy(handler_,
parent_->request_context());
resource_context()->set_url_request_context_getter(
url_request_getter.get());
storage_partition_proxy_.reset(
new CefStoragePartitionProxy(partition_impl,
url_request_getter.get()));
// Associates UserData keys with the ResourceContext.
// Called from StoragePartitionImplMap::Get() for CefBrowserContextImpl.
content::InitializeResourceContext(this);
}
// There should only be one CefStoragePartitionProxy for this
// CefBrowserContextProxy.
DCHECK_EQ(storage_partition_proxy_->parent(), partition_impl);
return storage_partition_proxy_.get();
}

View File

@ -13,7 +13,7 @@
#include "base/memory/ref_counted.h"
class CefDownloadManagerDelegate;
class CefURLRequestContextGetterProxy;
class CefStoragePartitionProxy;
// BrowserContext implementation for a particular CefRequestContext. Life span
// is controlled by CefRequestContextImpl. Only accessed on the UI thread. See
@ -40,14 +40,6 @@ class CefBrowserContextProxy : public CefBrowserContext {
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override;
content::BackgroundSyncController* GetBackgroundSyncController() override;
// Profile methods.
PrefService* GetPrefs() override;
const PrefService* GetPrefs() const override;
// CefBrowserContext methods.
const CefRequestContextSettings& GetSettings() const override;
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
net::URLRequestContextGetter* CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors)
@ -58,9 +50,20 @@ class CefBrowserContextProxy : public CefBrowserContext {
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors)
override;
// Profile methods.
PrefService* GetPrefs() override;
const PrefService* GetPrefs() const override;
// CefBrowserContext methods.
const CefRequestContextSettings& GetSettings() const override;
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
HostContentSettingsMap* GetHostContentSettingsMap() override;
void AddVisitedURLs(const std::vector<GURL>& urls) override;
content::StoragePartition* GetOrCreateStoragePartitionProxy(
content::StoragePartition* partition_impl);
scoped_refptr<CefBrowserContextImpl> parent() const {
return parent_;
}
@ -78,7 +81,7 @@ class CefBrowserContextProxy : public CefBrowserContext {
scoped_refptr<CefBrowserContextImpl> parent_;
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
scoped_refptr<CefURLRequestContextGetterProxy> url_request_getter_;
std::unique_ptr<CefStoragePartitionProxy> storage_partition_proxy_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserContextProxy);
};

View File

@ -80,6 +80,7 @@ base::DictionaryValue* ParseManifest(
CefExtensionSystem::CefExtensionSystem(BrowserContext* browser_context)
: browser_context_(browser_context),
initialized_(false),
registry_(ExtensionRegistry::Get(browser_context)),
weak_ptr_factory_(this) {
}
@ -88,6 +89,8 @@ CefExtensionSystem::~CefExtensionSystem() {
}
void CefExtensionSystem::Init() {
DCHECK(!initialized_);
// There's complexity here related to the ordering of message delivery. For
// an extension to load correctly both the ExtensionMsg_Loaded and
// ExtensionMsg_ActivateExtension messages must be sent. These messages are
@ -141,6 +144,8 @@ void CefExtensionSystem::Init() {
AddExtension(pdf_extension_util::GetManifest(),
base::FilePath(FILE_PATH_LITERAL("pdf")));
}
initialized_ = true;
}
// Implementation based on ComponentLoader::Add.
@ -173,6 +178,7 @@ void CefExtensionSystem::Shutdown() {
}
void CefExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
DCHECK(!initialized_);
service_worker_manager_.reset(new ServiceWorkerManager(browser_context_));
runtime_data_.reset(new RuntimeData(registry_));
quota_service_.reset(new QuotaService);

View File

@ -78,6 +78,8 @@ class CefExtensionSystem : public ExtensionSystem {
void InstallUpdate(const std::string& extension_id,
const base::FilePath& temp_dir) override;
bool initialized() const { return initialized_; }
private:
// Information about a registered component extension.
struct ComponentExtensionInfo {
@ -120,6 +122,8 @@ class CefExtensionSystem : public ExtensionSystem {
content::BrowserContext* browser_context_; // Not owned.
bool initialized_;
// Data to be accessed on the IO thread. Must outlive process_manager_.
scoped_refptr<InfoMap> info_map_;

View File

@ -6,6 +6,7 @@
#include "libcef/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/extension_prefs_factory.h"
#include "extensions/browser/extension_registry_factory.h"
@ -45,7 +46,7 @@ KeyedService* CefExtensionSystemFactory::BuildServiceInstanceFor(
BrowserContext* CefExtensionSystemFactory::GetBrowserContextToUse(
BrowserContext* context) const {
// Use a separate instance for incognito.
return context;
return chrome::GetBrowserContextOwnInstanceInIncognito(context);
}
bool CefExtensionSystemFactory::ServiceIsCreatedWithBrowserContext() const {

View File

@ -18,6 +18,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/chrome_url_request_util.h"
#include "chrome/browser/extensions/event_router_forwarder.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
@ -61,7 +62,10 @@ bool CefExtensionsBrowserClient::IsValidContext(BrowserContext* context) {
bool CefExtensionsBrowserClient::IsSameContext(BrowserContext* first,
BrowserContext* second) {
return first == second;
// Returns true if |first| and |second| share the same underlying
// CefBrowserContextImpl.
return CefBrowserContextImpl::GetForContext(first).get() ==
CefBrowserContextImpl::GetForContext(second).get();
}
bool CefExtensionsBrowserClient::HasOffTheRecordContext(
@ -77,7 +81,7 @@ BrowserContext* CefExtensionsBrowserClient::GetOffTheRecordContext(
BrowserContext* CefExtensionsBrowserClient::GetOriginalContext(
BrowserContext* context) {
return context;
return chrome::GetBrowserContextRedirectedInIncognito(context);
}
bool CefExtensionsBrowserClient::IsGuestSession(

View File

@ -74,7 +74,7 @@ std::unique_ptr<net::ClientCertStore>
}
void CefResourceContext::set_url_request_context_getter(
scoped_refptr<CefURLRequestContextGetter> getter) {
CefURLRequestContextGetter* getter) {
DCHECK(!getter_.get());
getter_ = getter;
}

View File

@ -35,8 +35,7 @@ class CefResourceContext : public content::ResourceContext {
std::unique_ptr<net::ClientCertStore> CreateClientCertStore();
void set_url_request_context_getter(
scoped_refptr<CefURLRequestContextGetter> getter);
void set_url_request_context_getter(CefURLRequestContextGetter* getter);
// State transferred from the BrowserContext for use on the IO thread.
bool IsOffTheRecord() const { return is_off_the_record_; }

View File

@ -0,0 +1,131 @@
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/storage_partition_proxy.h"
CefStoragePartitionProxy::CefStoragePartitionProxy(
content::StoragePartition* parent,
CefURLRequestContextGetterProxy* url_request_context)
: parent_(parent),
url_request_context_(url_request_context) {
}
base::FilePath CefStoragePartitionProxy::GetPath() {
return parent_->GetPath();
}
net::URLRequestContextGetter* CefStoragePartitionProxy::GetURLRequestContext() {
return url_request_context_.get();
}
net::URLRequestContextGetter*
CefStoragePartitionProxy::GetMediaURLRequestContext() {
return GetURLRequestContext();
}
storage::QuotaManager* CefStoragePartitionProxy::GetQuotaManager() {
return parent_->GetQuotaManager();
}
content::AppCacheService* CefStoragePartitionProxy::GetAppCacheService() {
return parent_->GetAppCacheService();
}
storage::FileSystemContext* CefStoragePartitionProxy::GetFileSystemContext() {
return parent_->GetFileSystemContext();
}
storage::DatabaseTracker* CefStoragePartitionProxy::GetDatabaseTracker() {
return parent_->GetDatabaseTracker();
}
content::DOMStorageContext* CefStoragePartitionProxy::GetDOMStorageContext() {
return parent_->GetDOMStorageContext();
}
content::IndexedDBContext* CefStoragePartitionProxy::GetIndexedDBContext() {
return parent_->GetIndexedDBContext();
}
content::ServiceWorkerContext*
CefStoragePartitionProxy::GetServiceWorkerContext() {
return parent_->GetServiceWorkerContext();
}
content::CacheStorageContext*
CefStoragePartitionProxy::GetCacheStorageContext() {
return parent_->GetCacheStorageContext();
}
content::HostZoomMap* CefStoragePartitionProxy::GetHostZoomMap() {
return parent_->GetHostZoomMap();
}
content::HostZoomLevelContext*
CefStoragePartitionProxy::GetHostZoomLevelContext() {
return parent_->GetHostZoomLevelContext();
}
content::ZoomLevelDelegate* CefStoragePartitionProxy::GetZoomLevelDelegate() {
return parent_->GetZoomLevelDelegate();
}
content::PlatformNotificationContext*
CefStoragePartitionProxy::GetPlatformNotificationContext() {
return parent_->GetPlatformNotificationContext();
}
content::BackgroundSyncContext*
CefStoragePartitionProxy::GetBackgroundSyncContext() {
return parent_->GetBackgroundSyncContext();
}
webmessaging::BroadcastChannelProvider*
CefStoragePartitionProxy::GetBroadcastChannelProvider() {
return parent_->GetBroadcastChannelProvider();
}
void CefStoragePartitionProxy::ClearDataForOrigin(
uint32_t remove_mask,
uint32_t quota_storage_remove_mask,
const GURL& storage_origin,
net::URLRequestContextGetter* rq_context,
const base::Closure& callback) {
parent_->ClearDataForOrigin(remove_mask, quota_storage_remove_mask,
storage_origin, rq_context, callback);
}
void CefStoragePartitionProxy::ClearData(
uint32_t remove_mask,
uint32_t quota_storage_remove_mask,
const GURL& storage_origin,
const OriginMatcherFunction& origin_matcher,
const base::Time begin,
const base::Time end,
const base::Closure& callback) {
parent_->ClearData(remove_mask, quota_storage_remove_mask, storage_origin,
origin_matcher, begin, end, callback);
}
void CefStoragePartitionProxy::ClearData(
uint32_t remove_mask,
uint32_t quota_storage_remove_mask,
const OriginMatcherFunction& origin_matcher,
const CookieMatcherFunction& cookie_matcher,
const base::Time begin,
const base::Time end,
const base::Closure& callback) {
parent_->ClearData(remove_mask, quota_storage_remove_mask, origin_matcher,
cookie_matcher, begin, end, callback);
}
void CefStoragePartitionProxy::Flush() {
parent_->Flush();
}
void CefStoragePartitionProxy::Bind(
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request) {
parent_->Bind(std::move(request));
}

View File

@ -0,0 +1,75 @@
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_STORAGE_PARTITION_PROXY_H_
#define CEF_LIBCEF_BROWSER_STORAGE_PARTITION_PROXY_H_
#pragma once
#include "libcef/browser/net/url_request_context_getter_proxy.h"
#include "content/public/browser/storage_partition.h"
// StoragePartition implementation for a particular CefBrowserContextProxy. Life
// span is controlled by CefBrowserContextProxy. Only accessed on the UI thread.
// See browser_context.h for an object relationship diagram.
class CefStoragePartitionProxy : public content::StoragePartition {
public:
CefStoragePartitionProxy(
content::StoragePartition* parent,
CefURLRequestContextGetterProxy* url_request_context);
// StoragePartition methods:
base::FilePath GetPath() override;
net::URLRequestContextGetter* GetURLRequestContext() override;
net::URLRequestContextGetter* GetMediaURLRequestContext() override;
storage::QuotaManager* GetQuotaManager() override;
content::AppCacheService* GetAppCacheService() override;
storage::FileSystemContext* GetFileSystemContext() override;
storage::DatabaseTracker* GetDatabaseTracker() override;
content::DOMStorageContext* GetDOMStorageContext() override;
content::IndexedDBContext* GetIndexedDBContext() override;
content::ServiceWorkerContext* GetServiceWorkerContext() override;
content::CacheStorageContext* GetCacheStorageContext() override;
content::HostZoomMap* GetHostZoomMap() override;
content::HostZoomLevelContext* GetHostZoomLevelContext() override;
content::ZoomLevelDelegate* GetZoomLevelDelegate() override;
content::PlatformNotificationContext* GetPlatformNotificationContext()
override;
content::BackgroundSyncContext* GetBackgroundSyncContext() override;
webmessaging::BroadcastChannelProvider*
GetBroadcastChannelProvider() override;
void ClearDataForOrigin(uint32_t remove_mask,
uint32_t quota_storage_remove_mask,
const GURL& storage_origin,
net::URLRequestContextGetter* rq_context,
const base::Closure& callback);
void ClearData(uint32_t remove_mask,
uint32_t quota_storage_remove_mask,
const GURL& storage_origin,
const OriginMatcherFunction& origin_matcher,
const base::Time begin,
const base::Time end,
const base::Closure& callback);
void ClearData(uint32_t remove_mask,
uint32_t quota_storage_remove_mask,
const OriginMatcherFunction& origin_matcher,
const CookieMatcherFunction& cookie_matcher,
const base::Time begin,
const base::Time end,
const base::Closure& callback) override;
void Flush() override;
void Bind(
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request)
override;
content::StoragePartition* parent() const { return parent_; }
private:
content::StoragePartition* parent_; // Not owned.
scoped_refptr<CefURLRequestContextGetterProxy> url_request_context_;
DISALLOW_COPY_AND_ASSIGN(CefStoragePartitionProxy);
};
#endif // CEF_LIBCEF_BROWSER_STORAGE_PARTITION_PROXY_H_

View File

@ -173,12 +173,6 @@ patches = [
'name': 'browser_frame_host_guest_1687',
'path': '../content/browser/frame_host/',
},
{
# Fix loading of the PDF extension with proxy BrowserContext.
# https://bitbucket.org/chromiumembedded/cef/issues/1710
'name': 'stream_context_1710',
'path': '../content/browser/streams/',
},
{
# Fix loading of the PDF extension with proxy BrowserContext.
# https://bitbucket.org/chromiumembedded/cef/issues/1710
@ -253,4 +247,13 @@ patches = [
'name': 'chrome_profile',
'path': '../',
},
{
# Support StoragePartition proxy by:
# (a) Exposing UserData keys for objects owned by BrowserContext;
# (b) Adding BrowserContext::GetStoragePartitionProxy();
# (c) Removing static_cast<> of StoragePartition to StoragePartitionImpl.
# https://bitbucket.org/chromiumembedded/cef/issues/1973
'name': 'storage_partition_1973',
'path': '../',
},
]

View File

@ -0,0 +1,414 @@
diff --git content/browser/appcache/appcache_internals_ui.cc content/browser/appcache/appcache_internals_ui.cc
index 18eb9fc..002feea 100644
--- content/browser/appcache/appcache_internals_ui.cc
+++ content/browser/appcache/appcache_internals_ui.cc
@@ -368,8 +368,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/blob_storage/chrome_blob_storage_context.cc content/browser/blob_storage/chrome_blob_storage_context.cc
index 533d3f1..f0fc700 100644
--- content/browser/blob_storage/chrome_blob_storage_context.cc
+++ content/browser/blob_storage/chrome_blob_storage_context.cc
@@ -41,6 +41,11 @@ class BlobHandleImpl : public BlobHandle {
ChromeBlobStorageContext::ChromeBlobStorageContext() {}
+// static
+const void* ChromeBlobStorageContext::GetUserDataKey() {
+ return kBlobStorageContextKeyName;
+}
+
ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor(
BrowserContext* context) {
if (!context->GetUserData(kBlobStorageContextKeyName)) {
diff --git content/browser/blob_storage/chrome_blob_storage_context.h content/browser/blob_storage/chrome_blob_storage_context.h
index bd02cb1..92d1580 100644
--- content/browser/blob_storage/chrome_blob_storage_context.h
+++ content/browser/blob_storage/chrome_blob_storage_context.h
@@ -41,6 +41,7 @@ class CONTENT_EXPORT ChromeBlobStorageContext
public:
ChromeBlobStorageContext();
+ CONTENT_EXPORT static const void* GetUserDataKey();
static ChromeBlobStorageContext* GetFor(
BrowserContext* browser_context);
diff --git content/browser/browser_context.cc content/browser/browser_context.cc
index 729df89..992c2bc 100644
--- content/browser/browser_context.cc
+++ content/browser/browser_context.cc
@@ -113,7 +113,14 @@ StoragePartition* GetStoragePartitionFromConfig(
if (browser_context->IsOffTheRecord())
in_memory = true;
- return partition_map->Get(partition_domain, partition_name, in_memory);
+ StoragePartitionImpl* partition_impl =
+ partition_map->Get(partition_domain, partition_name, in_memory);
+ 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(
@@ -481,6 +488,11 @@ shell::Connector* BrowserContext::GetShellConnectorFor(
return connection_holder->shell_connection()->GetConnector();
}
+// 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/service_worker_handler.cc content/browser/devtools/protocol/service_worker_handler.cc
index b9f528f..d385da4 100644
--- content/browser/devtools/protocol/service_worker_handler.cc
+++ content/browser/devtools/protocol/service_worker_handler.cc
@@ -523,10 +523,9 @@ Response ServiceWorkerHandler::DispatchSyncEvent(
if (!base::StringToInt64(registration_id, &id))
return CreateInvalidVersionIdErrorResponse();
- StoragePartitionImpl* partition =
- static_cast<StoragePartitionImpl*>(BrowserContext::GetStoragePartition(
+ StoragePartition* partition = BrowserContext::GetStoragePartition(
render_frame_host_->GetProcess()->GetBrowserContext(),
- render_frame_host_->GetSiteInstance()));
+ render_frame_host_->GetSiteInstance());
BackgroundSyncContext* sync_context = partition->GetBackgroundSyncContext();
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc
index f427078..e76cc58 100644
--- content/browser/renderer_host/render_process_host_impl.cc
+++ content/browser/renderer_host/render_process_host_impl.cc
@@ -543,7 +543,7 @@ void RenderProcessHostImpl::EarlyZygoteLaunch() {
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),
@@ -866,6 +866,22 @@ std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy(
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 indexed_db_context = static_cast<IndexedDBContextImpl*>(
+ storage_partition_impl_->GetIndexedDBContext());
+ 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();
media::AudioManager* audio_manager =
@@ -882,8 +898,8 @@ void RenderProcessHostImpl::CreateMessageFilters() {
new RenderMessageFilter(
GetID(), GetBrowserContext(), request_context.get(),
widget_helper_.get(), audio_manager, media_internals,
- storage_partition_impl_->GetDOMStorageContext(),
- storage_partition_impl_->GetCacheStorageContext()));
+ dom_storage_context,
+ cache_storage_context));
AddFilter(render_message_filter.get());
AddFilter(new RenderFrameMessageFilter(
GetID(),
@@ -911,10 +927,10 @@ void RenderProcessHostImpl::CreateMessageFilters() {
ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter(
GetID(), PROCESS_TYPE_RENDERER,
- storage_partition_impl_->GetAppCacheService(),
+ app_cache_service,
blob_storage_context.get(),
storage_partition_impl_->GetFileSystemContext(),
- storage_partition_impl_->GetServiceWorkerContext(),
+ service_worker_context,
storage_partition_impl_->GetHostZoomLevelContext(),
get_contexts_callback);
@@ -936,14 +952,12 @@ void RenderProcessHostImpl::CreateMessageFilters() {
AddFilter(
new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_manager()));
AddFilter(new VideoCaptureHost(media_stream_manager));
- AddFilter(new AppCacheDispatcherHost(
- storage_partition_impl_->GetAppCacheService(), GetID()));
+ AddFilter(new AppCacheDispatcherHost(app_cache_service, GetID()));
AddFilter(new ClipboardMessageFilter(blob_storage_context));
- AddFilter(new DOMStorageMessageFilter(
- storage_partition_impl_->GetDOMStorageContext()));
+ AddFilter(new DOMStorageMessageFilter(dom_storage_context));
AddFilter(new IndexedDBDispatcherHost(
GetID(), storage_partition_impl_->GetURLRequestContext(),
- storage_partition_impl_->GetIndexedDBContext(),
+ indexed_db_context,
blob_storage_context.get()));
#if defined(ENABLE_WEBRTC)
@@ -1002,14 +1016,13 @@ void RenderProcessHostImpl::CreateMessageFilters() {
scoped_refptr<CacheStorageDispatcherHost> cache_storage_filter =
new CacheStorageDispatcherHost();
- cache_storage_filter->Init(storage_partition_impl_->GetCacheStorageContext());
+ cache_storage_filter->Init(cache_storage_context);
AddFilter(cache_storage_filter.get());
scoped_refptr<ServiceWorkerDispatcherHost> service_worker_filter =
new ServiceWorkerDispatcherHost(
GetID(), message_port_message_filter_.get(), resource_context);
- service_worker_filter->Init(
- storage_partition_impl_->GetServiceWorkerContext());
+ service_worker_filter->Init(service_worker_context);
AddFilter(service_worker_filter.get());
AddFilter(new SharedWorkerMessageFilter(
@@ -1017,12 +1030,12 @@ void RenderProcessHostImpl::CreateMessageFilters() {
WorkerStoragePartition(
storage_partition_impl_->GetURLRequestContext(),
storage_partition_impl_->GetMediaURLRequestContext(),
- storage_partition_impl_->GetAppCacheService(),
+ app_cache_service,
storage_partition_impl_->GetQuotaManager(),
storage_partition_impl_->GetFileSystemContext(),
storage_partition_impl_->GetDatabaseTracker(),
- storage_partition_impl_->GetIndexedDBContext(),
- storage_partition_impl_->GetServiceWorkerContext()),
+ indexed_db_context,
+ service_worker_context),
message_port_message_filter_.get()));
#if defined(ENABLE_WEBRTC)
@@ -1038,7 +1051,7 @@ void RenderProcessHostImpl::CreateMessageFilters() {
GetContentClient()->browser()->CreateQuotaPermissionContext()));
notification_message_filter_ = new NotificationMessageFilter(
- GetID(), storage_partition_impl_->GetPlatformNotificationContext(),
+ GetID(), platform_notification_context,
resource_context, browser_context);
AddFilter(notification_message_filter_.get());
@@ -1047,13 +1060,18 @@ void RenderProcessHostImpl::CreateMessageFilters() {
AddFilter(new HistogramMessageFilter());
AddFilter(new MemoryMessageFilter(this));
AddFilter(new PushMessagingMessageFilter(
- GetID(), storage_partition_impl_->GetServiceWorkerContext()));
+ GetID(), service_worker_context));
#if defined(OS_ANDROID)
AddFilter(new ScreenOrientationMessageFilterAndroid());
#endif
}
void RenderProcessHostImpl::RegisterMojoInterfaces() {
+ // Cast to the derived type from StoragePartitionImpl.
+ auto platform_notification_context =
+ static_cast<PlatformNotificationContextImpl*>(
+ storage_partition_impl_->GetPlatformNotificationContext());
+
#if !defined(OS_ANDROID)
GetInterfaceRegistry()->AddInterface(
base::Bind(&device::BatteryMonitorImpl::Create));
@@ -1076,8 +1094,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() {
GetInterfaceRegistry()->AddInterface(base::Bind(
&PlatformNotificationContextImpl::CreateService,
- base::Unretained(
- storage_partition_impl_->GetPlatformNotificationContext()), GetID()));
+ base::Unretained(platform_notification_context), GetID()));
GetInterfaceRegistry()->AddInterface(
base::Bind(&RenderProcessHostImpl::CreateStoragePartitionService,
diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h
index c3aa818..e64cd43 100644
--- content/browser/renderer_host/render_process_host_impl.h
+++ content/browser/renderer_host/render_process_host_impl.h
@@ -66,7 +66,6 @@ class RenderWidgetHost;
class RenderWidgetHostImpl;
class RenderWidgetHostViewFrameSubscriber;
class StoragePartition;
-class StoragePartitionImpl;
namespace mojom {
class StoragePartitionService;
@@ -100,7 +99,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
public ui::GpuSwitchingObserver {
public:
RenderProcessHostImpl(BrowserContext* browser_context,
- StoragePartitionImpl* storage_partition_impl,
+ StoragePartition* storage_partition_impl,
bool is_for_guests_only);
~RenderProcessHostImpl() override;
@@ -420,7 +419,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
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/storage_partition_impl.h content/browser/storage_partition_impl.h
index 49b8d14..7a7d3da 100644
--- content/browser/storage_partition_impl.h
+++ content/browser/storage_partition_impl.h
@@ -22,9 +22,7 @@
#include "content/browser/notifications/platform_notification_context_impl.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/common/content_export.h"
-#include "content/common/storage_partition_service.mojom.h"
#include "content/public/browser/storage_partition.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
#include "net/cookies/cookie_store.h"
#include "storage/browser/quota/special_storage_policy.h"
@@ -67,9 +65,9 @@ class CONTENT_EXPORT StoragePartitionImpl
HostZoomLevelContext* GetHostZoomLevelContext() override;
ZoomLevelDelegate* GetZoomLevelDelegate() override;
PlatformNotificationContextImpl* GetPlatformNotificationContext() override;
-
- BackgroundSyncContext* GetBackgroundSyncContext();
- webmessaging::BroadcastChannelProvider* GetBroadcastChannelProvider();
+ BackgroundSyncContext* GetBackgroundSyncContext() override;
+ webmessaging::BroadcastChannelProvider* GetBroadcastChannelProvider()
+ override;
// mojom::StoragePartitionService interface.
void OpenLocalStorage(
@@ -104,7 +102,8 @@ class CONTENT_EXPORT StoragePartitionImpl
BrowserContext* browser_context() const;
// Called by each renderer process once.
- void Bind(mojo::InterfaceRequest<mojom::StoragePartitionService> request);
+ void Bind(mojo::InterfaceRequest<mojom::StoragePartitionService> request)
+ override;
struct DataDeletionHelper;
struct QuotaManagedDataDeletionHelper;
diff --git content/browser/streams/stream_context.cc content/browser/streams/stream_context.cc
index 3782205..d3b4f07 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 075ae3e..57fb5fd 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/public/browser/browser_context.h content/public/browser/browser_context.h
index 05f8086..825ee9d 100644
--- content/public/browser/browser_context.h
+++ content/public/browser/browser_context.h
@@ -167,6 +167,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
static shell::Connector* GetShellConnectorFor(
BrowserContext* browser_context);
+ static const void* GetStoragePartitionMapUserDataKey();
+
~BrowserContext() override;
// Creates a delegate to initialize a HostZoomMap and persist its information.
@@ -234,6 +236,14 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
CreateMediaRequestContextForStoragePartition(
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;
+ }
};
} // namespace content
diff --git content/public/browser/storage_partition.h content/public/browser/storage_partition.h
index 909b370..b1ffd2a 100644
--- content/public/browser/storage_partition.h
+++ content/public/browser/storage_partition.h
@@ -13,6 +13,8 @@
#include "base/files/file_path.h"
#include "base/time/time.h"
#include "content/common/content_export.h"
+#include "content/common/storage_partition_service.mojom.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
#include "net/cookies/cookie_store.h"
class GURL;
@@ -38,9 +40,14 @@ namespace storage {
class DatabaseTracker;
}
+namespace webmessaging {
+class BroadcastChannelProvider;
+}
+
namespace content {
class AppCacheService;
+class BackgroundSyncContext;
class BrowserContext;
class CacheStorageContext;
class DOMStorageContext;
@@ -74,6 +81,9 @@ class CONTENT_EXPORT StoragePartition {
virtual HostZoomLevelContext* GetHostZoomLevelContext() = 0;
virtual ZoomLevelDelegate* GetZoomLevelDelegate() = 0;
virtual PlatformNotificationContext* GetPlatformNotificationContext() = 0;
+ virtual BackgroundSyncContext* GetBackgroundSyncContext() = 0;
+ virtual webmessaging::BroadcastChannelProvider*
+ GetBroadcastChannelProvider() = 0;
enum : uint32_t {
REMOVE_DATA_MASK_APPCACHE = 1 << 0,
@@ -166,6 +176,10 @@ class CONTENT_EXPORT StoragePartition {
// unwritten data has been written out to the filesystem.
virtual void Flush() = 0;
+ // Called by each renderer process once.
+ virtual void Bind(
+ mojo::InterfaceRequest<mojom::StoragePartitionService> request) = 0;
+
protected:
virtual ~StoragePartition() {}
};

View File

@ -1,27 +0,0 @@
diff --git stream_context.cc stream_context.cc
index 3782205..5d97643 100644
--- stream_context.cc
+++ stream_context.cc
@@ -21,6 +21,10 @@ namespace content {
StreamContext::StreamContext() {}
+const void* StreamContext::GetUserDataKey() {
+ return kStreamContextKeyName;
+}
+
StreamContext* StreamContext::GetFor(BrowserContext* context) {
if (!context->GetUserData(kStreamContextKeyName)) {
scoped_refptr<StreamContext> stream = new StreamContext();
diff --git stream_context.h stream_context.h
index 075ae3e..57fb5fd 100644
--- stream_context.h
+++ 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();

View File

@ -11,9 +11,10 @@
<li><a href="http://tests/dialogs">Dialogs</a></li>
<li><a href="http://html5demos.com/drag">Drag & Drop</a></li>
<li><a href="http://tests/draggable">Draggable Regions</a></li>
<li><a href="http://www.adobe.com/software/flash/about/">Flash Plugin</a></li>
<li><a href="http://www.adobe.com/software/flash/about/">Flash Plugin</a> - requires "enable-system-flash" flag on Win/Mac and "ppapi-flash-path", "ppapi-flash-version" flags on Linux</li>
<li><a href="http://html5demos.com/geo">Geolocation</a></li>
<li><a href="http://www.html5test.com">HTML5 Feature Test</a></li>
<li><a href="http://html5-demos.appspot.com/static/filesystem/filer.js/demos/index.html">HTML5 Filesystem</a> - requires "cache-path" flag</li>
<li><a href="http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True">HTML5 Video</a></li>
<li><a href="http://tests/binding">JavaScript Binding</a></li>
<li><a href="http://tests/performance">JavaScript Performance Tests</a></li>