Add CefAppManager and remove global ContentClient accessors (see issue #2969)

This is the first pass in removing direct dependencies on the Alloy
runtime from code that can potentially be shared between runtimes.

CefBrowserHost and CefRequestContext APIs (including CefCookieManager,
CefURLRequest, etc.) are not yet implemented for the Chrome runtime.
Assert early if these API methods are called while the Chrome runtime
is enabled.
This commit is contained in:
Marshall Greenblatt
2020-06-28 17:05:36 -04:00
parent 84f3ff2afd
commit b3a8da9b25
45 changed files with 522 additions and 312 deletions

View File

@@ -3,14 +3,15 @@
// can be found in the LICENSE file.
#include "libcef/browser/request_context_impl.h"
#include "libcef/browser/alloy/alloy_content_browser_client.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/context.h"
#include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/app_manager.h"
#include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/task_runner_impl.h"
#include "libcef/common/values_impl.h"
#include "libcef/features/runtime_checks.h"
#include "base/atomic_sequence_num.h"
#include "base/logging.h"
@@ -622,10 +623,14 @@ void CefRequestContextImpl::OnRenderFrameDeleted(int render_process_id,
// static
CefRefPtr<CefRequestContextImpl>
CefRequestContextImpl::GetOrCreateRequestContext(const Config& config) {
// TODO(chrome-runtime): Add support for this method.
REQUIRE_ALLOY_RUNTIME();
if (config.is_global ||
(config.other && config.other->IsGlobal() && !config.handler)) {
// Return the singleton global context.
return AlloyContentBrowserClient::Get()->request_context();
return static_cast<CefRequestContextImpl*>(
CefAppManager::Get()->GetGlobalRequestContext().get());
}
// The new context will be initialized later by EnsureBrowserContext().