mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add support for complete isolation of storage and permissions (cache, cookies, localStorage, access grants, etc) on a per-request-context basis (issue #1044).
- CefRequestContext instances can be configured using a new CefRequestContextSettings structure passed to CefRequestContext::CreateContext. - Scheme registration is now per-request-context using new CefRequestContext::RegisterSchemeHandlerFactory and ClearSchemeHandlerFactories methods. - Cookie managers are now per-request-context by default and can be retrieved using a new CefRequestContext::GetDefaultCookieManager method. - CefURLRequest::Create now accepts an optional CefRequestContext argument for associating a URL request with a context (browser process only). - The CefRequestContextHandler associated with a CefRequestContext will not be released until all objects related to that context have been destroyed. - When the cache path is empty an in-memory cache ("incognito mode") will be used for storage and no data will be persisted to disk. - Add CefSettings.user_data_path which specifies the location where user data such as spell checking dictionary files will be stored on disk. - Add asynchronous callbacks for all CefCookieManager methods. - Add PK_LOCAL_APP_DATA and PK_USER_DATA path keys for retrieving user directories via CefGetPath. - cefclient: Add "New Window" test that creates a new window unrelated to existing windows. When used in combination with `--request-context-per-browser` the new window will be given a new and isolated request context. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@2040 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "libcef/browser/browser_context_proxy.h"
|
||||
#include "libcef/browser/browser_message_loop.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools_delegate.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/net_resource_provider.h"
|
||||
@@ -18,7 +19,6 @@
|
||||
#include "base/command_line.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "chrome/browser/net/proxy_service_factory.h"
|
||||
#include "content/browser/webui/content_web_ui_controller_factory.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/browser/web_ui_controller_factory.h"
|
||||
@@ -118,31 +118,16 @@ int CefBrowserMainParts::PreCreateThreads() {
|
||||
// Initialize the V8 proxy integration.
|
||||
net::ProxyResolverV8::EnsureIsolateCreated();
|
||||
|
||||
// Initialize proxy configuration tracker.
|
||||
pref_proxy_config_tracker_.reset(
|
||||
ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
|
||||
pref_service_.get()));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
CefRequestContextSettings settings;
|
||||
CefContext::Get()->PopulateRequestContextSettings(&settings);
|
||||
|
||||
// Create the global BrowserContext.
|
||||
global_browser_context_ = new CefBrowserContextImpl();
|
||||
|
||||
// Initialize the proxy configuration service. This needs to occur before
|
||||
// CefURLRequestContextGetter::GetURLRequestContext() is called for the
|
||||
// first time.
|
||||
proxy_config_service_.reset(
|
||||
ProxyServiceFactory::CreateProxyConfigService(
|
||||
pref_proxy_config_tracker_.get()));
|
||||
|
||||
// Create the global URLRequestContextGetter via an indirect call to
|
||||
// CefBrowserContextImpl::CreateRequestContext. Triggers a call to
|
||||
// CefURLRequestContextGetter::GetURLRequestContext() on the IO thread which
|
||||
// creates the URLRequestContext.
|
||||
global_request_context_ = static_cast<CefURLRequestContextGetterImpl*>(
|
||||
global_browser_context_->GetRequestContext());
|
||||
global_browser_context_ = new CefBrowserContextImpl(settings);
|
||||
global_browser_context_->Initialize();
|
||||
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
@@ -164,9 +149,7 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
|
||||
devtools_delegate_->Stop();
|
||||
devtools_delegate_ = NULL;
|
||||
}
|
||||
pref_proxy_config_tracker_->DetachFromPrefService();
|
||||
|
||||
global_request_context_ = NULL;
|
||||
global_browser_context_ = NULL;
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -176,8 +159,6 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::PostDestroyThreads() {
|
||||
pref_proxy_config_tracker_.reset(NULL);
|
||||
|
||||
#if defined(USE_AURA)
|
||||
aura::Env::DeleteInstance();
|
||||
delete views::ViewsDelegate::views_delegate;
|
||||
|
Reference in New Issue
Block a user