2020-06-28 23:05:36 +02:00
|
|
|
// Copyright 2020 The Chromium Embedded Framework 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_COMMON_APP_MANAGER_H_
|
|
|
|
#define CEF_LIBCEF_COMMON_APP_MANAGER_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
#include "include/cef_app.h"
|
|
|
|
#include "include/cef_request_context.h"
|
|
|
|
|
|
|
|
#include "base/macros.h"
|
|
|
|
#include "build/build_config.h"
|
|
|
|
#include "content/public/common/content_client.h"
|
|
|
|
|
2020-07-01 02:57:00 +02:00
|
|
|
class CefBrowserContext;
|
2020-06-28 23:05:36 +02:00
|
|
|
struct CefSchemeInfo;
|
|
|
|
|
|
|
|
// Exposes global application state in the main and render processes.
|
|
|
|
class CefAppManager {
|
|
|
|
public:
|
|
|
|
// Returns the singleton instance that is scoped to CEF lifespan.
|
|
|
|
static CefAppManager* Get();
|
|
|
|
|
|
|
|
// The following methods are available in both processes.
|
|
|
|
|
|
|
|
virtual CefRefPtr<CefApp> GetApplication() = 0;
|
|
|
|
virtual content::ContentClient* GetContentClient() = 0;
|
|
|
|
|
|
|
|
// Custom scheme information will be registered first with all processes
|
|
|
|
// (url/url_util.h) via ContentClient::AddAdditionalSchemes which calls
|
|
|
|
// AddCustomScheme, and second with Blink (SchemeRegistry) via
|
|
|
|
// ContentRendererClient::WebKitInitialized which calls GetCustomSchemes.
|
|
|
|
void AddCustomScheme(CefSchemeInfo* scheme_info);
|
|
|
|
bool HasCustomScheme(const std::string& scheme_name);
|
|
|
|
|
|
|
|
using SchemeInfoList = std::list<CefSchemeInfo>;
|
|
|
|
const SchemeInfoList* GetCustomSchemes();
|
|
|
|
|
|
|
|
// Called from ContentClient::AddAdditionalSchemes.
|
|
|
|
void AddAdditionalSchemes(content::ContentClient::Schemes* schemes);
|
|
|
|
|
|
|
|
// The following methods are only available in the main (browser) process.
|
|
|
|
|
2020-07-01 02:57:00 +02:00
|
|
|
// Called from CefRequestContextImpl.
|
2020-06-28 23:05:36 +02:00
|
|
|
virtual CefRefPtr<CefRequestContext> GetGlobalRequestContext() = 0;
|
2020-07-01 02:57:00 +02:00
|
|
|
virtual CefBrowserContext* CreateNewBrowserContext(
|
|
|
|
const CefRequestContextSettings& settings) = 0;
|
2020-06-28 23:05:36 +02:00
|
|
|
|
|
|
|
#if defined(OS_WIN)
|
|
|
|
// Returns the module name (usually libcef.dll).
|
|
|
|
const wchar_t* GetResourceDllName();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CefAppManager();
|
|
|
|
virtual ~CefAppManager();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Custom schemes handled by the client.
|
|
|
|
SchemeInfoList scheme_info_list_;
|
|
|
|
bool scheme_info_list_locked_ = false;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefAppManager);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_COMMON_APP_MANAGER_H_
|