mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-18 05:00:48 +01:00
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:
parent
84f3ff2afd
commit
b3a8da9b25
5
BUILD.gn
5
BUILD.gn
@ -648,6 +648,8 @@ static_library("libcef_static") {
|
|||||||
"libcef/common/alloy/alloy_main_delegate.h",
|
"libcef/common/alloy/alloy_main_delegate.h",
|
||||||
"libcef/common/alloy/alloy_main_runner_delegate.cc",
|
"libcef/common/alloy/alloy_main_runner_delegate.cc",
|
||||||
"libcef/common/alloy/alloy_main_runner_delegate.h",
|
"libcef/common/alloy/alloy_main_runner_delegate.h",
|
||||||
|
"libcef/common/app_manager.cc",
|
||||||
|
"libcef/common/app_manager.h",
|
||||||
"libcef/common/base_impl.cc",
|
"libcef/common/base_impl.cc",
|
||||||
"libcef/common/cef_message_generator.cc",
|
"libcef/common/cef_message_generator.cc",
|
||||||
"libcef/common/cef_message_generator.h",
|
"libcef/common/cef_message_generator.h",
|
||||||
@ -655,6 +657,8 @@ static_library("libcef_static") {
|
|||||||
"libcef/common/cef_messages.h",
|
"libcef/common/cef_messages.h",
|
||||||
"libcef/common/cef_switches.cc",
|
"libcef/common/cef_switches.cc",
|
||||||
"libcef/common/cef_switches.h",
|
"libcef/common/cef_switches.h",
|
||||||
|
"libcef/common/chrome/chrome_content_client_cef.cc",
|
||||||
|
"libcef/common/chrome/chrome_content_client_cef.h",
|
||||||
"libcef/common/chrome/chrome_main_delegate_cef.cc",
|
"libcef/common/chrome/chrome_main_delegate_cef.cc",
|
||||||
"libcef/common/chrome/chrome_main_delegate_cef.h",
|
"libcef/common/chrome/chrome_main_delegate_cef.h",
|
||||||
"libcef/common/chrome/chrome_main_runner_delegate.cc",
|
"libcef/common/chrome/chrome_main_runner_delegate.cc",
|
||||||
@ -734,6 +738,7 @@ static_library("libcef_static") {
|
|||||||
"libcef/common/widevine_loader.cc",
|
"libcef/common/widevine_loader.cc",
|
||||||
"libcef/common/widevine_loader.h",
|
"libcef/common/widevine_loader.h",
|
||||||
"libcef/features/runtime.h",
|
"libcef/features/runtime.h",
|
||||||
|
"libcef/features/runtime_checks.h",
|
||||||
"libcef/renderer/alloy/alloy_content_renderer_client.cc",
|
"libcef/renderer/alloy/alloy_content_renderer_client.cc",
|
||||||
"libcef/renderer/alloy/alloy_content_renderer_client.h",
|
"libcef/renderer/alloy/alloy_content_renderer_client.h",
|
||||||
"libcef/renderer/browser_impl.cc",
|
"libcef/renderer/browser_impl.cc",
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "libcef/browser/alloy/alloy_content_browser_client.h"
|
|
||||||
#include "libcef/browser/browser_context.h"
|
#include "libcef/browser/browser_context.h"
|
||||||
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
@ -19,6 +18,7 @@
|
|||||||
#include "libcef/browser/printing/constrained_window_views_client.h"
|
#include "libcef/browser/printing/constrained_window_views_client.h"
|
||||||
#include "libcef/browser/printing/printing_message_filter.h"
|
#include "libcef/browser/printing/printing_message_filter.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/extensions/extensions_client.h"
|
#include "libcef/common/extensions/extensions_client.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
#include "libcef/common/net/net_resource_provider.h"
|
#include "libcef/common/net/net_resource_provider.h"
|
||||||
@ -101,7 +101,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
|||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
ui::CursorLoaderWin::SetCursorResourceModule(
|
ui::CursorLoaderWin::SetCursorResourceModule(
|
||||||
AlloyContentBrowserClient::Get()->GetResourceDllName());
|
CefAppManager::Get()->GetResourceDllName());
|
||||||
#endif
|
#endif
|
||||||
#endif // defined(USE_AURA)
|
#endif // defined(USE_AURA)
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/browser/x509_certificate_impl.h"
|
#include "libcef/browser/x509_certificate_impl.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/alloy/alloy_content_client.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/cef_messages.h"
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/command_line_impl.h"
|
#include "libcef/common/command_line_impl.h"
|
||||||
@ -541,14 +542,6 @@ AlloyContentBrowserClient::AlloyContentBrowserClient() {
|
|||||||
|
|
||||||
AlloyContentBrowserClient::~AlloyContentBrowserClient() {}
|
AlloyContentBrowserClient::~AlloyContentBrowserClient() {}
|
||||||
|
|
||||||
// static
|
|
||||||
AlloyContentBrowserClient* AlloyContentBrowserClient::Get() {
|
|
||||||
if (!AlloyContentClient::Get())
|
|
||||||
return nullptr;
|
|
||||||
return static_cast<AlloyContentBrowserClient*>(
|
|
||||||
AlloyContentClient::Get()->browser());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<content::BrowserMainParts>
|
std::unique_ptr<content::BrowserMainParts>
|
||||||
AlloyContentBrowserClient::CreateBrowserMainParts(
|
AlloyContentBrowserClient::CreateBrowserMainParts(
|
||||||
const content::MainFunctionParams& parameters) {
|
const content::MainFunctionParams& parameters) {
|
||||||
@ -672,7 +665,7 @@ bool AlloyContentBrowserClient::IsHandledURL(const GURL& url) {
|
|||||||
if (scheme::IsInternalHandledScheme(scheme))
|
if (scheme::IsInternalHandledScheme(scheme))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return AlloyContentClient::Get()->HasCustomScheme(scheme);
|
return CefAppManager::Get()->HasCustomScheme(scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlloyContentBrowserClient::SiteInstanceGotProcess(
|
void AlloyContentBrowserClient::SiteInstanceGotProcess(
|
||||||
@ -867,7 +860,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
|||||||
}
|
}
|
||||||
#endif // defined(OS_LINUX)
|
#endif // defined(OS_LINUX)
|
||||||
|
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app.get()) {
|
if (app.get()) {
|
||||||
CefRefPtr<CefBrowserProcessHandler> handler =
|
CefRefPtr<CefBrowserProcessHandler> handler =
|
||||||
app->GetBrowserProcessHandler();
|
app->GetBrowserProcessHandler();
|
||||||
@ -1148,22 +1141,6 @@ void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
|||||||
#endif // defined(OS_LINUX)
|
#endif // defined(OS_LINUX)
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
const wchar_t* AlloyContentBrowserClient::GetResourceDllName() {
|
|
||||||
static wchar_t file_path[MAX_PATH + 1] = {0};
|
|
||||||
|
|
||||||
if (file_path[0] == 0) {
|
|
||||||
// Retrieve the module path (usually libcef.dll).
|
|
||||||
base::FilePath module;
|
|
||||||
base::PathService::Get(base::FILE_MODULE, &module);
|
|
||||||
const std::wstring wstr = module.value();
|
|
||||||
size_t count = std::min(static_cast<size_t>(MAX_PATH), wstr.size());
|
|
||||||
wcsncpy(file_path, wstr.c_str(), count);
|
|
||||||
file_path[count] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return file_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AlloyContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy,
|
bool AlloyContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy,
|
||||||
RendererSpawnFlags flags) {
|
RendererSpawnFlags flags) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -35,9 +35,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
AlloyContentBrowserClient();
|
AlloyContentBrowserClient();
|
||||||
~AlloyContentBrowserClient() override;
|
~AlloyContentBrowserClient() override;
|
||||||
|
|
||||||
// Returns the singleton AlloyContentBrowserClient instance.
|
|
||||||
static AlloyContentBrowserClient* Get();
|
|
||||||
|
|
||||||
// ContentBrowserClient implementation.
|
// ContentBrowserClient implementation.
|
||||||
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
|
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
|
||||||
const content::MainFunctionParams& parameters) override;
|
const content::MainFunctionParams& parameters) override;
|
||||||
@ -131,7 +128,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
const wchar_t* GetResourceDllName();
|
|
||||||
bool PreSpawnRenderer(sandbox::TargetPolicy* policy,
|
bool PreSpawnRenderer(sandbox::TargetPolicy* policy,
|
||||||
RendererSpawnFlags flags) override;
|
RendererSpawnFlags flags) override;
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
|
|
||||||
#include "libcef/browser/alloy/chrome_profile_manager_alloy.h"
|
#include "libcef/browser/alloy/chrome_profile_manager_alloy.h"
|
||||||
|
|
||||||
#include "libcef/browser/alloy/alloy_content_browser_client.h"
|
|
||||||
#include "libcef/browser/browser_context.h"
|
#include "libcef/browser/browser_context.h"
|
||||||
|
#include "libcef/browser/request_context_impl.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -21,8 +22,9 @@ namespace {
|
|||||||
// Return the main context for now since we don't currently have a good way to
|
// Return the main context for now since we don't currently have a good way to
|
||||||
// determine that.
|
// determine that.
|
||||||
CefBrowserContext* GetActiveBrowserContext() {
|
CefBrowserContext* GetActiveBrowserContext() {
|
||||||
return static_cast<CefBrowserContext*>(
|
auto request_context = static_cast<CefRequestContextImpl*>(
|
||||||
AlloyContentBrowserClient::Get()->request_context()->GetBrowserContext());
|
CefAppManager::Get()->GetGlobalRequestContext().get());
|
||||||
|
return static_cast<CefBrowserContext*>(request_context->GetBrowserContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
#include "libcef/common/request_impl.h"
|
#include "libcef/common/request_impl.h"
|
||||||
#include "libcef/common/values_impl.h"
|
#include "libcef/common/values_impl.h"
|
||||||
|
#include "libcef/features/runtime_checks.h"
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/bind_helpers.h"
|
#include "base/bind_helpers.h"
|
||||||
@ -257,6 +258,9 @@ bool CefBrowserHost::CreateBrowser(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(chrome-runtime): Add support for this method.
|
||||||
|
REQUIRE_ALLOY_RUNTIME();
|
||||||
|
|
||||||
// Verify that the settings structure is a valid size.
|
// Verify that the settings structure is a valid size.
|
||||||
if (settings.size != sizeof(cef_browser_settings_t)) {
|
if (settings.size != sizeof(cef_browser_settings_t)) {
|
||||||
NOTREACHED() << "invalid CefBrowserSettings structure size";
|
NOTREACHED() << "invalid CefBrowserSettings structure size";
|
||||||
@ -299,6 +303,9 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(chrome-runtime): Add support for this method.
|
||||||
|
REQUIRE_ALLOY_RUNTIME();
|
||||||
|
|
||||||
// Verify that the settings structure is a valid size.
|
// Verify that the settings structure is a valid size.
|
||||||
if (settings.size != sizeof(cef_browser_settings_t)) {
|
if (settings.size != sizeof(cef_browser_settings_t)) {
|
||||||
NOTREACHED() << "invalid CefBrowserSettings structure size";
|
NOTREACHED() << "invalid CefBrowserSettings structure size";
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "libcef/browser/browser_info_manager.h"
|
#include "libcef/browser/browser_info_manager.h"
|
||||||
#include "libcef/browser/origin_whitelist_impl.h"
|
#include "libcef/browser/origin_whitelist_impl.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/cef_messages.h"
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/common/values_impl.h"
|
#include "libcef/common/values_impl.h"
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ void CefBrowserMessageFilter::OnGetNewRenderThreadInfo(
|
|||||||
CefProcessHostMsg_GetNewRenderThreadInfo_Params* params) {
|
CefProcessHostMsg_GetNewRenderThreadInfo_Params* params) {
|
||||||
GetCrossOriginWhitelistEntries(¶ms->cross_origin_whitelist_entries);
|
GetCrossOriginWhitelistEntries(¶ms->cross_origin_whitelist_entries);
|
||||||
|
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app.get()) {
|
if (app.get()) {
|
||||||
CefRefPtr<CefBrowserProcessHandler> handler =
|
CefRefPtr<CefBrowserProcessHandler> handler =
|
||||||
app->GetBrowserProcessHandler();
|
app->GetBrowserProcessHandler();
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// be found in the LICENSE file.
|
// be found in the LICENSE file.
|
||||||
|
|
||||||
#include "libcef/browser/browser_message_loop.h"
|
#include "libcef/browser/browser_message_loop.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/message_loop/message_pump.h"
|
#include "base/message_loop/message_pump.h"
|
||||||
@ -91,7 +91,7 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
|||||||
};
|
};
|
||||||
|
|
||||||
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() {
|
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() {
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app)
|
if (app)
|
||||||
return app->GetBrowserProcessHandler();
|
return app->GetBrowserProcessHandler();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "libcef/browser/alloy/alloy_content_browser_client.h"
|
|
||||||
#include "libcef/browser/browser_context.h"
|
#include "libcef/browser/browser_context.h"
|
||||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||||
#include "libcef/browser/net/devtools_scheme_handler.h"
|
#include "libcef/browser/net/devtools_scheme_handler.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
|
#include "libcef/common/task_runner_manager.h"
|
||||||
|
|
||||||
#include "base/base64.h"
|
#include "base/base64.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
@ -606,7 +606,7 @@ void CefDevToolsFrontend::LogProtocolMessage(ProtocolMessageType type,
|
|||||||
std::string to_log = message.substr(0, kMaxLogLineLength).as_string();
|
std::string to_log = message.substr(0, kMaxLogLineLength).as_string();
|
||||||
|
|
||||||
// Execute in an ordered context that allows blocking.
|
// Execute in an ordered context that allows blocking.
|
||||||
auto task_runner = AlloyContentBrowserClient::Get()->background_task_runner();
|
auto task_runner = CefTaskRunnerManager::Get()->GetBackgroundTaskRunner();
|
||||||
task_runner->PostTask(
|
task_runner->PostTask(
|
||||||
FROM_HERE, base::BindOnce(::LogProtocolMessage, protocol_log_file_, type,
|
FROM_HERE, base::BindOnce(::LogProtocolMessage, protocol_log_file_, type,
|
||||||
std::move(to_log)));
|
std::move(to_log)));
|
||||||
|
@ -59,7 +59,7 @@ std::unique_ptr<CefMainRunnerDelegate> MakeDelegate(
|
|||||||
application);
|
application);
|
||||||
} else {
|
} else {
|
||||||
g_runtime_type = RuntimeType::CHROME;
|
g_runtime_type = RuntimeType::CHROME;
|
||||||
return std::make_unique<ChromeMainRunnerDelegate>(runner);
|
return std::make_unique<ChromeMainRunnerDelegate>(runner, application);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "libcef/browser/context_menu_params_impl.h"
|
#include "libcef/browser/context_menu_params_impl.h"
|
||||||
#include "libcef/browser/menu_runner.h"
|
#include "libcef/browser/menu_runner.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
@ -24,7 +24,7 @@ namespace {
|
|||||||
|
|
||||||
CefString GetLabel(int message_id) {
|
CefString GetLabel(int message_id) {
|
||||||
base::string16 label =
|
base::string16 label =
|
||||||
AlloyContentClient::Get()->GetLocalizedString(message_id);
|
CefAppManager::Get()->GetContentClient()->GetLocalizedString(message_id);
|
||||||
DCHECK(!label.empty());
|
DCHECK(!label.empty());
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,11 @@
|
|||||||
|
|
||||||
#include "include/cef_version.h"
|
#include "include/cef_version.h"
|
||||||
#include "include/cef_web_plugin.h"
|
#include "include/cef_web_plugin.h"
|
||||||
#include "libcef/browser/alloy/alloy_content_browser_client.h"
|
|
||||||
#include "libcef/browser/extensions/chrome_api_registration.h"
|
#include "libcef/browser/extensions/chrome_api_registration.h"
|
||||||
#include "libcef/browser/frame_host_impl.h"
|
#include "libcef/browser/frame_host_impl.h"
|
||||||
#include "libcef/browser/net/internal_scheme_handler.h"
|
#include "libcef/browser/net/internal_scheme_handler.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
@ -31,12 +30,14 @@
|
|||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "cef/grit/cef_resources.h"
|
#include "cef/grit/cef_resources.h"
|
||||||
#include "chrome/browser/browser_about_handler.h"
|
#include "chrome/browser/browser_about_handler.h"
|
||||||
|
#include "chrome/browser/profiles/profile.h"
|
||||||
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
|
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
|
||||||
#include "chrome/browser/ui/webui/theme_source.h"
|
#include "chrome/browser/ui/webui/theme_source.h"
|
||||||
#include "chrome/common/url_constants.h"
|
#include "chrome/common/url_constants.h"
|
||||||
#include "content/browser/frame_host/debug_urls.h"
|
#include "content/browser/frame_host/debug_urls.h"
|
||||||
#include "content/browser/webui/content_web_ui_controller_factory.h"
|
#include "content/browser/webui/content_web_ui_controller_factory.h"
|
||||||
#include "content/public/browser/browser_url_handler.h"
|
#include "content/public/browser/browser_url_handler.h"
|
||||||
|
#include "content/public/browser/content_browser_client.h"
|
||||||
#include "content/public/browser/url_data_source.h"
|
#include "content/public/browser/url_data_source.h"
|
||||||
#include "content/public/browser/web_ui_controller.h"
|
#include "content/public/browser/web_ui_controller.h"
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
@ -341,8 +342,9 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||||
base::StringPiece piece = AlloyContentClient::Get()->GetDataResource(
|
base::StringPiece piece =
|
||||||
IDR_CEF_LICENSE_TXT, ui::SCALE_FACTOR_NONE);
|
CefAppManager::Get()->GetContentClient()->GetDataResource(
|
||||||
|
IDR_CEF_LICENSE_TXT, ui::SCALE_FACTOR_NONE);
|
||||||
if (piece.empty()) {
|
if (piece.empty()) {
|
||||||
NOTREACHED() << "Failed to load license txt resource.";
|
NOTREACHED() << "Failed to load license txt resource.";
|
||||||
return false;
|
return false;
|
||||||
@ -358,8 +360,9 @@ bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
|||||||
bool OnVersionUI(Profile* profile,
|
bool OnVersionUI(Profile* profile,
|
||||||
std::string* mime_type,
|
std::string* mime_type,
|
||||||
std::string* output) {
|
std::string* output) {
|
||||||
base::StringPiece piece = AlloyContentClient::Get()->GetDataResource(
|
base::StringPiece piece =
|
||||||
IDR_CEF_VERSION_HTML, ui::SCALE_FACTOR_NONE);
|
CefAppManager::Get()->GetContentClient()->GetDataResource(
|
||||||
|
IDR_CEF_VERSION_HTML, ui::SCALE_FACTOR_NONE);
|
||||||
if (piece.empty()) {
|
if (piece.empty()) {
|
||||||
NOTREACHED() << "Failed to load version html resource.";
|
NOTREACHED() << "Failed to load version html resource.";
|
||||||
return false;
|
return false;
|
||||||
@ -376,7 +379,9 @@ bool OnVersionUI(Profile* profile,
|
|||||||
parser.Add("WEBKIT", content::GetWebKitVersion());
|
parser.Add("WEBKIT", content::GetWebKitVersion());
|
||||||
parser.Add("JAVASCRIPT", v8::V8::GetVersion());
|
parser.Add("JAVASCRIPT", v8::V8::GetVersion());
|
||||||
parser.Add("FLASH", std::string()); // Value populated asynchronously.
|
parser.Add("FLASH", std::string()); // Value populated asynchronously.
|
||||||
parser.Add("USERAGENT", AlloyContentClient::Get()->browser()->GetUserAgent());
|
parser.Add(
|
||||||
|
"USERAGENT",
|
||||||
|
CefAppManager::Get()->GetContentClient()->browser()->GetUserAgent());
|
||||||
parser.Add("COMMANDLINE", GetCommandLine());
|
parser.Add("COMMANDLINE", GetCommandLine());
|
||||||
parser.Add("MODULEPATH", GetModulePath());
|
parser.Add("MODULEPATH", GetModulePath());
|
||||||
parser.Add("CACHEPATH", CefString(profile->GetPath().value()));
|
parser.Add("CACHEPATH", CefString(profile->GetPath().value()));
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
@ -159,7 +159,8 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory {
|
|||||||
|
|
||||||
if (!action.bytes && action.resource_id >= 0) {
|
if (!action.bytes && action.resource_id >= 0) {
|
||||||
action.bytes =
|
action.bytes =
|
||||||
AlloyContentClient::Get()->GetDataResourceBytes(action.resource_id);
|
CefAppManager::Get()->GetContentClient()->GetDataResourceBytes(
|
||||||
|
action.resource_id);
|
||||||
if (!action.bytes) {
|
if (!action.bytes) {
|
||||||
NOTREACHED() << "Failed to load internal resource for id: "
|
NOTREACHED() << "Failed to load internal resource for id: "
|
||||||
<< action.resource_id << " URL: " << url.spec().c_str();
|
<< action.resource_id << " URL: " << url.spec().c_str();
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include "libcef/browser/net_service/resource_request_handler_wrapper.h"
|
#include "libcef/browser/net_service/resource_request_handler_wrapper.h"
|
||||||
|
|
||||||
#include "libcef/browser/alloy/alloy_content_browser_client.h"
|
|
||||||
#include "libcef/browser/browser_host_impl.h"
|
#include "libcef/browser/browser_host_impl.h"
|
||||||
#include "libcef/browser/browser_platform_delegate.h"
|
#include "libcef/browser/browser_platform_delegate.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
@ -14,7 +13,7 @@
|
|||||||
#include "libcef/browser/net_service/response_filter_wrapper.h"
|
#include "libcef/browser/net_service/response_filter_wrapper.h"
|
||||||
#include "libcef/browser/resource_context.h"
|
#include "libcef/browser/resource_context.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/net/scheme_registration.h"
|
#include "libcef/common/net/scheme_registration.h"
|
||||||
#include "libcef/common/net_service/net_service_util.h"
|
#include "libcef/common/net_service/net_service_util.h"
|
||||||
#include "libcef/common/request_impl.h"
|
#include "libcef/common/request_impl.h"
|
||||||
@ -290,7 +289,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
|||||||
accept_language_ = ComputeAcceptLanguageFromPref(
|
accept_language_ = ComputeAcceptLanguageFromPref(
|
||||||
GetAcceptLanguageList(browser_context, browser));
|
GetAcceptLanguageList(browser_context, browser));
|
||||||
DCHECK(!accept_language_.empty());
|
DCHECK(!accept_language_.empty());
|
||||||
user_agent_ = AlloyContentClient::Get()->browser()->GetUserAgent();
|
user_agent_ =
|
||||||
|
CefAppManager::Get()->GetContentClient()->browser()->GetUserAgent();
|
||||||
DCHECK(!user_agent_.empty());
|
DCHECK(!user_agent_.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
|
|
||||||
#include "libcef/browser/net_service/url_loader_factory_getter.h"
|
#include "libcef/browser/net_service/url_loader_factory_getter.h"
|
||||||
|
|
||||||
#include "libcef/browser/alloy/alloy_content_browser_client.h"
|
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
#include "base/threading/thread_task_runner_handle.h"
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "content/browser/devtools/devtools_instrumentation.h"
|
#include "content/browser/devtools/devtools_instrumentation.h"
|
||||||
#include "content/browser/frame_host/render_frame_host_impl.h"
|
#include "content/browser/frame_host/render_frame_host_impl.h"
|
||||||
|
#include "content/public/browser/browser_context.h"
|
||||||
#include "content/public/browser/storage_partition.h"
|
#include "content/public/browser/storage_partition.h"
|
||||||
#include "content/public/common/content_client.h"
|
#include "content/public/common/content_client.h"
|
||||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||||
@ -58,8 +59,10 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
|
|||||||
&maybe_proxy_factory_request, nullptr /* factory_override */);
|
&maybe_proxy_factory_request, nullptr /* factory_override */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto browser_client = CefAppManager::Get()->GetContentClient()->browser();
|
||||||
|
|
||||||
// Allow the Content embedder to inject itself if it wants to.
|
// Allow the Content embedder to inject itself if it wants to.
|
||||||
should_proxy |= AlloyContentBrowserClient::Get()->WillCreateURLLoaderFactory(
|
should_proxy |= browser_client->WillCreateURLLoaderFactory(
|
||||||
browser_context, render_frame_host, render_process_id,
|
browser_context, render_frame_host, render_process_id,
|
||||||
content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource,
|
content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource,
|
||||||
url::Origin(), base::nullopt /* navigation_id */,
|
url::Origin(), base::nullopt /* navigation_id */,
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "libcef/browser/alloy/alloy_content_browser_client.h"
|
|
||||||
#include "libcef/browser/browser_host_impl.h"
|
#include "libcef/browser/browser_host_impl.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
#include "ui/resources/grit/ui_unscaled_resources.h"
|
#include "ui/resources/grit/ui_unscaled_resources.h"
|
||||||
|
|
||||||
@ -165,8 +165,8 @@ ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
|||||||
HMODULE module_handle = NULL;
|
HMODULE module_handle = NULL;
|
||||||
const wchar_t* cursor_id = ToCursorID(type);
|
const wchar_t* cursor_id = ToCursorID(type);
|
||||||
if (!IsSystemCursorID(cursor_id)) {
|
if (!IsSystemCursorID(cursor_id)) {
|
||||||
module_handle = ::GetModuleHandle(
|
module_handle =
|
||||||
AlloyContentBrowserClient::Get()->GetResourceDllName());
|
::GetModuleHandle(CefAppManager::Get()->GetResourceDllName());
|
||||||
if (!module_handle)
|
if (!module_handle)
|
||||||
module_handle = ::GetModuleHandle(NULL);
|
module_handle = ::GetModuleHandle(NULL);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||||
#include "libcef/browser/print_settings_impl.h"
|
#include "libcef/browser/print_settings_impl.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
@ -105,7 +105,7 @@ gfx::Size CefPrintDialogLinux::GetPdfPaperSize(
|
|||||||
|
|
||||||
gfx::Size size;
|
gfx::Size size;
|
||||||
|
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app.get()) {
|
if (app.get()) {
|
||||||
CefRefPtr<CefBrowserProcessHandler> browser_handler =
|
CefRefPtr<CefBrowserProcessHandler> browser_handler =
|
||||||
app->GetBrowserProcessHandler();
|
app->GetBrowserProcessHandler();
|
||||||
@ -136,7 +136,7 @@ void CefPrintDialogLinux::OnPrintStart(int render_process_id,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (!app.get())
|
if (!app.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ void CefPrintDialogLinux::SetHandler() {
|
|||||||
if (handler_.get())
|
if (handler_.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app.get()) {
|
if (app.get()) {
|
||||||
CefRefPtr<CefBrowserProcessHandler> browser_handler =
|
CefRefPtr<CefBrowserProcessHandler> browser_handler =
|
||||||
app->GetBrowserProcessHandler();
|
app->GetBrowserProcessHandler();
|
||||||
|
@ -3,14 +3,15 @@
|
|||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "libcef/browser/request_context_impl.h"
|
#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/browser_context.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/extensions/extension_system.h"
|
#include "libcef/browser/extensions/extension_system.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
#include "libcef/common/task_runner_impl.h"
|
#include "libcef/common/task_runner_impl.h"
|
||||||
#include "libcef/common/values_impl.h"
|
#include "libcef/common/values_impl.h"
|
||||||
|
#include "libcef/features/runtime_checks.h"
|
||||||
|
|
||||||
#include "base/atomic_sequence_num.h"
|
#include "base/atomic_sequence_num.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
@ -622,10 +623,14 @@ void CefRequestContextImpl::OnRenderFrameDeleted(int render_process_id,
|
|||||||
// static
|
// static
|
||||||
CefRefPtr<CefRequestContextImpl>
|
CefRefPtr<CefRequestContextImpl>
|
||||||
CefRequestContextImpl::GetOrCreateRequestContext(const Config& config) {
|
CefRequestContextImpl::GetOrCreateRequestContext(const Config& config) {
|
||||||
|
// TODO(chrome-runtime): Add support for this method.
|
||||||
|
REQUIRE_ALLOY_RUNTIME();
|
||||||
|
|
||||||
if (config.is_global ||
|
if (config.is_global ||
|
||||||
(config.other && config.other->IsGlobal() && !config.handler)) {
|
(config.other && config.other->IsGlobal() && !config.handler)) {
|
||||||
// Return the singleton global context.
|
// 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().
|
// The new context will be initialized later by EnsureBrowserContext().
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/browser/views/window_impl.h"
|
#include "libcef/browser/views/window_impl.h"
|
||||||
|
#include "libcef/features/runtime_checks.h"
|
||||||
|
|
||||||
#include "content/public/browser/native_web_keyboard_event.h"
|
#include "content/public/browser/native_web_keyboard_event.h"
|
||||||
#include "ui/content_accelerators/accelerator_util.h"
|
#include "ui/content_accelerators/accelerator_util.h"
|
||||||
@ -44,6 +45,9 @@ CefRefPtr<CefBrowserViewImpl> CefBrowserViewImpl::Create(
|
|||||||
CefRefPtr<CefDictionaryValue> extra_info,
|
CefRefPtr<CefDictionaryValue> extra_info,
|
||||||
CefRefPtr<CefRequestContext> request_context,
|
CefRefPtr<CefRequestContext> request_context,
|
||||||
CefRefPtr<CefBrowserViewDelegate> delegate) {
|
CefRefPtr<CefBrowserViewDelegate> delegate) {
|
||||||
|
// TODO(chrome-runtime): Add support for this method.
|
||||||
|
REQUIRE_ALLOY_RUNTIME();
|
||||||
|
|
||||||
CEF_REQUIRE_UIT_RETURN(nullptr);
|
CEF_REQUIRE_UIT_RETURN(nullptr);
|
||||||
CefRefPtr<CefBrowserViewImpl> browser_view = new CefBrowserViewImpl(delegate);
|
CefRefPtr<CefBrowserViewImpl> browser_view = new CefBrowserViewImpl(delegate);
|
||||||
browser_view->SetPendingBrowserCreateParams(client, url, settings, extra_info,
|
browser_view->SetPendingBrowserCreateParams(client, url, settings, extra_info,
|
||||||
|
@ -10,10 +10,9 @@
|
|||||||
#include "include/cef_stream.h"
|
#include "include/cef_stream.h"
|
||||||
#include "include/cef_version.h"
|
#include "include/cef_version.h"
|
||||||
#include "libcef/browser/extensions/pdf_extension_util.h"
|
#include "libcef/browser/extensions/pdf_extension_util.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
#include "libcef/common/net/scheme_registration.h"
|
|
||||||
#include "libcef/common/scheme_registrar_impl.h"
|
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
@ -29,7 +28,6 @@
|
|||||||
#include "chrome/common/chrome_paths.h"
|
#include "chrome/common/chrome_paths.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
#include "chrome/common/pepper_flash.h"
|
#include "chrome/common/pepper_flash.h"
|
||||||
#include "content/public/browser/child_process_security_policy.h"
|
|
||||||
#include "content/public/common/content_constants.h"
|
#include "content/public/common/content_constants.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "content/public/common/pepper_plugin_info.h"
|
#include "content/public/common/pepper_plugin_info.h"
|
||||||
@ -44,8 +42,6 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
AlloyContentClient* g_content_client = nullptr;
|
|
||||||
|
|
||||||
// The following plugin-related methods are from
|
// The following plugin-related methods are from
|
||||||
// chrome/common/chrome_content_client.cc
|
// chrome/common/chrome_content_client.cc
|
||||||
|
|
||||||
@ -184,24 +180,8 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) {
|
|||||||
|
|
||||||
const char AlloyContentClient::kPDFPluginPath[] = "internal-pdf-viewer";
|
const char AlloyContentClient::kPDFPluginPath[] = "internal-pdf-viewer";
|
||||||
|
|
||||||
AlloyContentClient::AlloyContentClient(CefRefPtr<CefApp> application)
|
AlloyContentClient::AlloyContentClient() = default;
|
||||||
: application_(application),
|
AlloyContentClient::~AlloyContentClient() = default;
|
||||||
pack_loading_disabled_(false),
|
|
||||||
allow_pack_file_load_(false),
|
|
||||||
scheme_info_list_locked_(false),
|
|
||||||
resource_bundle_delegate_(this) {
|
|
||||||
DCHECK(!g_content_client);
|
|
||||||
g_content_client = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
AlloyContentClient::~AlloyContentClient() {
|
|
||||||
g_content_client = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
AlloyContentClient* AlloyContentClient::Get() {
|
|
||||||
return g_content_client;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AlloyContentClient::AddPepperPlugins(
|
void AlloyContentClient::AddPepperPlugins(
|
||||||
std::vector<content::PepperPluginInfo>* plugins) {
|
std::vector<content::PepperPluginInfo>* plugins) {
|
||||||
@ -224,17 +204,7 @@ void AlloyContentClient::AddContentDecryptionModules(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AlloyContentClient::AddAdditionalSchemes(Schemes* schemes) {
|
void AlloyContentClient::AddAdditionalSchemes(Schemes* schemes) {
|
||||||
DCHECK(!scheme_info_list_locked_);
|
CefAppManager::Get()->AddAdditionalSchemes(schemes);
|
||||||
|
|
||||||
if (application_.get()) {
|
|
||||||
CefSchemeRegistrarImpl schemeRegistrar;
|
|
||||||
application_->OnRegisterCustomSchemes(&schemeRegistrar);
|
|
||||||
schemeRegistrar.GetSchemes(schemes);
|
|
||||||
}
|
|
||||||
|
|
||||||
scheme::AddInternalSchemes(schemes);
|
|
||||||
|
|
||||||
scheme_info_list_locked_ = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base::string16 AlloyContentClient::GetLocalizedString(int message_id) {
|
base::string16 AlloyContentClient::GetLocalizedString(int message_id) {
|
||||||
@ -288,42 +258,6 @@ gfx::Image& AlloyContentClient::GetNativeImageNamed(int resource_id) {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlloyContentClient::AddCustomScheme(const SchemeInfo& scheme_info) {
|
|
||||||
DCHECK(!scheme_info_list_locked_);
|
|
||||||
scheme_info_list_.push_back(scheme_info);
|
|
||||||
|
|
||||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
|
||||||
if (!command_line->HasSwitch(switches::kProcessType)) {
|
|
||||||
// Register as a Web-safe scheme in the browser process so that requests for
|
|
||||||
// the scheme from a render process will be allowed in
|
|
||||||
// resource_dispatcher_host_impl.cc ShouldServiceRequest.
|
|
||||||
content::ChildProcessSecurityPolicy* policy =
|
|
||||||
content::ChildProcessSecurityPolicy::GetInstance();
|
|
||||||
if (!policy->IsWebSafeScheme(scheme_info.scheme_name))
|
|
||||||
policy->RegisterWebSafeScheme(scheme_info.scheme_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const AlloyContentClient::SchemeInfoList*
|
|
||||||
AlloyContentClient::GetCustomSchemes() {
|
|
||||||
DCHECK(scheme_info_list_locked_);
|
|
||||||
return &scheme_info_list_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AlloyContentClient::HasCustomScheme(const std::string& scheme_name) {
|
|
||||||
DCHECK(scheme_info_list_locked_);
|
|
||||||
if (scheme_info_list_.empty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
SchemeInfoList::const_iterator it = scheme_info_list_.begin();
|
|
||||||
for (; it != scheme_info_list_.end(); ++it) {
|
|
||||||
if (it->scheme_name == scheme_name)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void AlloyContentClient::SetPDFEntryFunctions(
|
void AlloyContentClient::SetPDFEntryFunctions(
|
||||||
content::PepperPluginInfo::GetInterfaceFunc get_interface,
|
content::PepperPluginInfo::GetInterfaceFunc get_interface,
|
||||||
|
@ -7,29 +7,18 @@
|
|||||||
#define CEF_LIBCEF_COMMON_ALLOY_ALLOY_CONTENT_CLIENT_H_
|
#define CEF_LIBCEF_COMMON_ALLOY_ALLOY_CONTENT_CLIENT_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <list>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "include/cef_app.h"
|
|
||||||
#include "libcef/common/resource_bundle_delegate.h"
|
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "content/public/common/content_client.h"
|
#include "content/public/common/content_client.h"
|
||||||
#include "content/public/common/pepper_plugin_info.h"
|
#include "content/public/common/pepper_plugin_info.h"
|
||||||
#include "url/url_util.h"
|
|
||||||
|
|
||||||
class AlloyContentClient : public content::ContentClient {
|
class AlloyContentClient : public content::ContentClient {
|
||||||
public:
|
public:
|
||||||
static const char kPDFPluginPath[];
|
static const char kPDFPluginPath[];
|
||||||
|
|
||||||
explicit AlloyContentClient(CefRefPtr<CefApp> application);
|
AlloyContentClient();
|
||||||
~AlloyContentClient() override;
|
~AlloyContentClient() override;
|
||||||
|
|
||||||
// Returns the singleton AlloyContentClient instance.
|
// content::ContentClient overrides.
|
||||||
static AlloyContentClient* Get();
|
|
||||||
|
|
||||||
// content::ContentClient methods.
|
|
||||||
void AddPepperPlugins(
|
void AddPepperPlugins(
|
||||||
std::vector<content::PepperPluginInfo>* plugins) override;
|
std::vector<content::PepperPluginInfo>* plugins) override;
|
||||||
void AddContentDecryptionModules(
|
void AddContentDecryptionModules(
|
||||||
@ -44,83 +33,10 @@ class AlloyContentClient : public content::ContentClient {
|
|||||||
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;
|
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;
|
||||||
gfx::Image& GetNativeImageNamed(int resource_id) override;
|
gfx::Image& GetNativeImageNamed(int resource_id) override;
|
||||||
|
|
||||||
// Values are registered with all processes (url/url_util.h) and with Blink
|
|
||||||
// (SchemeRegistry) unless otherwise indicated.
|
|
||||||
struct SchemeInfo {
|
|
||||||
// Lower-case ASCII scheme name.
|
|
||||||
std::string scheme_name;
|
|
||||||
|
|
||||||
// A scheme that is subject to URL canonicalization and parsing rules as
|
|
||||||
// defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1
|
|
||||||
// available at http://www.ietf.org/rfc/rfc1738.txt.
|
|
||||||
// This value is not registered with Blink.
|
|
||||||
bool is_standard;
|
|
||||||
|
|
||||||
// A scheme that will be treated the same as "file". For example, normal
|
|
||||||
// pages cannot link to or access URLs of this scheme.
|
|
||||||
bool is_local;
|
|
||||||
|
|
||||||
// A scheme that can only be displayed from other content hosted with the
|
|
||||||
// same scheme. For example, pages in other origins cannot create iframes or
|
|
||||||
// hyperlinks to URLs with the scheme. For schemes that must be accessible
|
|
||||||
// from other schemes set this value to false, set |is_cors_enabled| to
|
|
||||||
// true, and use CORS "Access-Control-Allow-Origin" headers to further
|
|
||||||
// restrict access.
|
|
||||||
// This value is registered with Blink only.
|
|
||||||
bool is_display_isolated;
|
|
||||||
|
|
||||||
// A scheme that will be treated the same as "https". For example, loading
|
|
||||||
// this scheme from other secure schemes will not trigger mixed content
|
|
||||||
// warnings.
|
|
||||||
bool is_secure;
|
|
||||||
|
|
||||||
// A scheme that can be sent CORS requests. This value should be true in
|
|
||||||
// most cases where |is_standard| is true.
|
|
||||||
bool is_cors_enabled;
|
|
||||||
|
|
||||||
// A scheme that can bypass Content-Security-Policy (CSP) checks. This value
|
|
||||||
// should be false in most cases where |is_standard| is true.
|
|
||||||
bool is_csp_bypassing;
|
|
||||||
|
|
||||||
// A scheme that can perform fetch request.
|
|
||||||
bool is_fetch_enabled;
|
|
||||||
};
|
|
||||||
typedef std::list<SchemeInfo> SchemeInfoList;
|
|
||||||
|
|
||||||
// Custom scheme information will be registered first with all processes
|
|
||||||
// (url/url_util.h) via AlloyContentClient::AddAdditionalSchemes which calls
|
|
||||||
// AddCustomScheme, and second with Blink (SchemeRegistry) via
|
|
||||||
// AlloyContentRendererClient::WebKitInitialized which calls GetCustomSchemes.
|
|
||||||
void AddCustomScheme(const SchemeInfo& scheme_info);
|
|
||||||
const SchemeInfoList* GetCustomSchemes();
|
|
||||||
bool HasCustomScheme(const std::string& scheme_name);
|
|
||||||
|
|
||||||
CefRefPtr<CefApp> application() const { return application_; }
|
|
||||||
|
|
||||||
void set_pack_loading_disabled(bool val) { pack_loading_disabled_ = val; }
|
|
||||||
bool pack_loading_disabled() const { return pack_loading_disabled_; }
|
|
||||||
void set_allow_pack_file_load(bool val) { allow_pack_file_load_ = val; }
|
|
||||||
bool allow_pack_file_load() { return allow_pack_file_load_; }
|
|
||||||
|
|
||||||
static void SetPDFEntryFunctions(
|
static void SetPDFEntryFunctions(
|
||||||
content::PepperPluginInfo::GetInterfaceFunc get_interface,
|
content::PepperPluginInfo::GetInterfaceFunc get_interface,
|
||||||
content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module,
|
content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module,
|
||||||
content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module);
|
content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module);
|
||||||
|
|
||||||
CefResourceBundleDelegate* GetCefResourceBundleDelegate() {
|
|
||||||
return &resource_bundle_delegate_;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
CefRefPtr<CefApp> application_;
|
|
||||||
bool pack_loading_disabled_;
|
|
||||||
bool allow_pack_file_load_;
|
|
||||||
|
|
||||||
// Custom schemes handled by the client.
|
|
||||||
SchemeInfoList scheme_info_list_;
|
|
||||||
bool scheme_info_list_locked_;
|
|
||||||
|
|
||||||
CefResourceBundleDelegate resource_bundle_delegate_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_COMMON_ALLOY_ALLOY_CONTENT_CLIENT_H_
|
#endif // CEF_LIBCEF_COMMON_ALLOY_ALLOY_CONTENT_CLIENT_H_
|
||||||
|
@ -321,7 +321,7 @@ void OverrideAssetPath() {
|
|||||||
AlloyMainDelegate::AlloyMainDelegate(CefMainRunnerHandler* runner,
|
AlloyMainDelegate::AlloyMainDelegate(CefMainRunnerHandler* runner,
|
||||||
CefSettings* settings,
|
CefSettings* settings,
|
||||||
CefRefPtr<CefApp> application)
|
CefRefPtr<CefApp> application)
|
||||||
: runner_(runner), settings_(settings), content_client_(application) {
|
: runner_(runner), settings_(settings), application_(application) {
|
||||||
// Necessary so that exported functions from base_impl.cc will be included
|
// Necessary so that exported functions from base_impl.cc will be included
|
||||||
// in the binary.
|
// in the binary.
|
||||||
extern void base_impl_stub();
|
extern void base_impl_stub();
|
||||||
@ -551,12 +551,12 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content_client_.application().get()) {
|
if (application_) {
|
||||||
// Give the application a chance to view/modify the command line.
|
// Give the application a chance to view/modify the command line.
|
||||||
CefRefPtr<CefCommandLineImpl> commandLinePtr(
|
CefRefPtr<CefCommandLineImpl> commandLinePtr(
|
||||||
new CefCommandLineImpl(command_line, false, false));
|
new CefCommandLineImpl(command_line, false, false));
|
||||||
content_client_.application()->OnBeforeCommandLineProcessing(
|
application_->OnBeforeCommandLineProcessing(CefString(process_type),
|
||||||
CefString(process_type), commandLinePtr.get());
|
commandLinePtr.get());
|
||||||
commandLinePtr->Detach(nullptr);
|
commandLinePtr->Detach(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,7 +661,7 @@ void AlloyMainDelegate::PreSandboxStartup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (command_line->HasSwitch(switches::kDisablePackLoading))
|
if (command_line->HasSwitch(switches::kDisablePackLoading))
|
||||||
content_client_.set_pack_loading_disabled(true);
|
resource_bundle_delegate_.set_pack_loading_disabled(true);
|
||||||
|
|
||||||
// Initialize crash reporting state for this process/module.
|
// Initialize crash reporting state for this process/module.
|
||||||
// chrome::DIR_CRASH_DUMPS must be configured before calling this function.
|
// chrome::DIR_CRASH_DUMPS must be configured before calling this function.
|
||||||
@ -717,6 +717,12 @@ content::ContentUtilityClient* AlloyMainDelegate::CreateContentUtilityClient() {
|
|||||||
return utility_client_.get();
|
return utility_client_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CefRefPtr<CefRequestContext> AlloyMainDelegate::GetGlobalRequestContext() {
|
||||||
|
if (!browser_client_)
|
||||||
|
return nullptr;
|
||||||
|
return browser_client_->request_context();
|
||||||
|
}
|
||||||
|
|
||||||
scoped_refptr<base::SingleThreadTaskRunner>
|
scoped_refptr<base::SingleThreadTaskRunner>
|
||||||
AlloyMainDelegate::GetBackgroundTaskRunner() {
|
AlloyMainDelegate::GetBackgroundTaskRunner() {
|
||||||
if (browser_client_)
|
if (browser_client_)
|
||||||
@ -769,7 +775,7 @@ void AlloyMainDelegate::InitializeResourceBundle() {
|
|||||||
if (!resources_dir.empty())
|
if (!resources_dir.empty())
|
||||||
base::PathService::Override(chrome::DIR_RESOURCES, resources_dir);
|
base::PathService::Override(chrome::DIR_RESOURCES, resources_dir);
|
||||||
|
|
||||||
if (!content_client_.pack_loading_disabled()) {
|
if (!resource_bundle_delegate_.pack_loading_disabled()) {
|
||||||
if (!resources_dir.empty()) {
|
if (!resources_dir.empty()) {
|
||||||
CHECK(resources_dir.IsAbsolute());
|
CHECK(resources_dir.IsAbsolute());
|
||||||
cef_pak_file = resources_dir.Append(FILE_PATH_LITERAL("cef.pak"));
|
cef_pak_file = resources_dir.Append(FILE_PATH_LITERAL("cef.pak"));
|
||||||
@ -795,18 +801,18 @@ void AlloyMainDelegate::InitializeResourceBundle() {
|
|||||||
|
|
||||||
const std::string loaded_locale =
|
const std::string loaded_locale =
|
||||||
ui::ResourceBundle::InitSharedInstanceWithLocale(
|
ui::ResourceBundle::InitSharedInstanceWithLocale(
|
||||||
locale, content_client_.GetCefResourceBundleDelegate(),
|
locale, &resource_bundle_delegate_,
|
||||||
ui::ResourceBundle::LOAD_COMMON_RESOURCES);
|
ui::ResourceBundle::LOAD_COMMON_RESOURCES);
|
||||||
if (!loaded_locale.empty() && g_browser_process)
|
if (!loaded_locale.empty() && g_browser_process)
|
||||||
g_browser_process->SetApplicationLocale(loaded_locale);
|
g_browser_process->SetApplicationLocale(loaded_locale);
|
||||||
|
|
||||||
ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance();
|
ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance();
|
||||||
|
|
||||||
if (!content_client_.pack_loading_disabled()) {
|
if (!resource_bundle_delegate_.pack_loading_disabled()) {
|
||||||
if (loaded_locale.empty())
|
if (loaded_locale.empty())
|
||||||
LOG(ERROR) << "Could not load locale pak for " << locale;
|
LOG(ERROR) << "Could not load locale pak for " << locale;
|
||||||
|
|
||||||
content_client_.set_allow_pack_file_load(true);
|
resource_bundle_delegate_.set_allow_pack_file_load(true);
|
||||||
|
|
||||||
if (base::PathExists(cef_pak_file)) {
|
if (base::PathExists(cef_pak_file)) {
|
||||||
resource_bundle.AddDataPackFromPath(cef_pak_file, ui::SCALE_FACTOR_NONE);
|
resource_bundle.AddDataPackFromPath(cef_pak_file, ui::SCALE_FACTOR_NONE);
|
||||||
@ -856,6 +862,6 @@ void AlloyMainDelegate::InitializeResourceBundle() {
|
|||||||
ui::SCALE_FACTOR_NONE);
|
ui::SCALE_FACTOR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
content_client_.set_allow_pack_file_load(false);
|
resource_bundle_delegate_.set_allow_pack_file_load(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
|
|
||||||
#include "include/cef_app.h"
|
#include "include/cef_app.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/alloy/alloy_content_client.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/main_runner_handler.h"
|
#include "libcef/common/main_runner_handler.h"
|
||||||
|
#include "libcef/common/resource_bundle_delegate.h"
|
||||||
#include "libcef/common/task_runner_manager.h"
|
#include "libcef/common/task_runner_manager.h"
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
@ -26,6 +28,7 @@ class ChromeContentUtilityClient;
|
|||||||
|
|
||||||
// Manages state specific to the CEF runtime.
|
// Manages state specific to the CEF runtime.
|
||||||
class AlloyMainDelegate : public content::ContentMainDelegate,
|
class AlloyMainDelegate : public content::ContentMainDelegate,
|
||||||
|
public CefAppManager,
|
||||||
public CefTaskRunnerManager {
|
public CefTaskRunnerManager {
|
||||||
public:
|
public:
|
||||||
// |runner| and |settings| will be non-nullptr for the main process only,
|
// |runner| and |settings| will be non-nullptr for the main process only,
|
||||||
@ -51,10 +54,14 @@ class AlloyMainDelegate : public content::ContentMainDelegate,
|
|||||||
content::ContentRendererClient* CreateContentRendererClient() override;
|
content::ContentRendererClient* CreateContentRendererClient() override;
|
||||||
content::ContentUtilityClient* CreateContentUtilityClient() override;
|
content::ContentUtilityClient* CreateContentUtilityClient() override;
|
||||||
|
|
||||||
AlloyContentBrowserClient* browser_client() { return browser_client_.get(); }
|
|
||||||
AlloyContentClient* content_client() { return &content_client_; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// CefAppManager overrides.
|
||||||
|
CefRefPtr<CefApp> GetApplication() override { return application_; }
|
||||||
|
content::ContentClient* GetContentClient() override {
|
||||||
|
return &content_client_;
|
||||||
|
}
|
||||||
|
CefRefPtr<CefRequestContext> GetGlobalRequestContext() override;
|
||||||
|
|
||||||
// CefTaskRunnerManager overrides.
|
// CefTaskRunnerManager overrides.
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner()
|
scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner()
|
||||||
override;
|
override;
|
||||||
@ -70,12 +77,15 @@ class AlloyMainDelegate : public content::ContentMainDelegate,
|
|||||||
|
|
||||||
CefMainRunnerHandler* const runner_;
|
CefMainRunnerHandler* const runner_;
|
||||||
CefSettings* const settings_;
|
CefSettings* const settings_;
|
||||||
|
CefRefPtr<CefApp> application_;
|
||||||
|
|
||||||
std::unique_ptr<AlloyContentBrowserClient> browser_client_;
|
std::unique_ptr<AlloyContentBrowserClient> browser_client_;
|
||||||
std::unique_ptr<AlloyContentRendererClient> renderer_client_;
|
std::unique_ptr<AlloyContentRendererClient> renderer_client_;
|
||||||
std::unique_ptr<ChromeContentUtilityClient> utility_client_;
|
std::unique_ptr<ChromeContentUtilityClient> utility_client_;
|
||||||
AlloyContentClient content_client_;
|
AlloyContentClient content_client_;
|
||||||
|
|
||||||
|
CefResourceBundleDelegate resource_bundle_delegate_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(AlloyMainDelegate);
|
DISALLOW_COPY_AND_ASSIGN(AlloyMainDelegate);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
118
libcef/common/app_manager.cc
Normal file
118
libcef/common/app_manager.cc
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
|
#include "libcef/common/net/scheme_info.h"
|
||||||
|
#include "libcef/common/net/scheme_registration.h"
|
||||||
|
#include "libcef/common/scheme_registrar_impl.h"
|
||||||
|
|
||||||
|
#include "base/command_line.h"
|
||||||
|
#include "base/logging.h"
|
||||||
|
#include "content/public/browser/child_process_security_policy.h"
|
||||||
|
#include "content/public/common/content_switches.h"
|
||||||
|
#include "third_party/blink/public/platform/platform.h"
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
#include <windows.h>
|
||||||
|
#include "base/path_service.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
CefAppManager* g_manager = nullptr;
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
// static
|
||||||
|
CefAppManager* CefAppManager::Get() {
|
||||||
|
return g_manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefAppManager::CefAppManager() {
|
||||||
|
// Only a single instance should exist.
|
||||||
|
DCHECK(!g_manager);
|
||||||
|
g_manager = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefAppManager::~CefAppManager() {
|
||||||
|
g_manager = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefAppManager::AddCustomScheme(CefSchemeInfo* scheme_info) {
|
||||||
|
DCHECK(!scheme_info_list_locked_);
|
||||||
|
scheme_info_list_.push_back(*scheme_info);
|
||||||
|
|
||||||
|
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
|
if (!command_line->HasSwitch(switches::kProcessType)) {
|
||||||
|
// Register as a Web-safe scheme in the browser process so that requests for
|
||||||
|
// the scheme from a render process will be allowed in
|
||||||
|
// resource_dispatcher_host_impl.cc ShouldServiceRequest.
|
||||||
|
content::ChildProcessSecurityPolicy* policy =
|
||||||
|
content::ChildProcessSecurityPolicy::GetInstance();
|
||||||
|
if (!policy->IsWebSafeScheme(scheme_info->scheme_name))
|
||||||
|
policy->RegisterWebSafeScheme(scheme_info->scheme_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefAppManager::HasCustomScheme(const std::string& scheme_name) {
|
||||||
|
DCHECK(scheme_info_list_locked_);
|
||||||
|
if (scheme_info_list_.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SchemeInfoList::const_iterator it = scheme_info_list_.begin();
|
||||||
|
for (; it != scheme_info_list_.end(); ++it) {
|
||||||
|
if (it->scheme_name == scheme_name)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CefAppManager::SchemeInfoList* CefAppManager::GetCustomSchemes() {
|
||||||
|
DCHECK(scheme_info_list_locked_);
|
||||||
|
return &scheme_info_list_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefAppManager::AddAdditionalSchemes(
|
||||||
|
content::ContentClient::Schemes* schemes) {
|
||||||
|
DCHECK(!scheme_info_list_locked_);
|
||||||
|
|
||||||
|
auto application = GetApplication();
|
||||||
|
if (application) {
|
||||||
|
CefSchemeRegistrarImpl schemeRegistrar;
|
||||||
|
application->OnRegisterCustomSchemes(&schemeRegistrar);
|
||||||
|
schemeRegistrar.GetSchemes(schemes);
|
||||||
|
}
|
||||||
|
|
||||||
|
scheme::AddInternalSchemes(schemes);
|
||||||
|
|
||||||
|
scheme_info_list_locked_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
const wchar_t* CefAppManager::GetResourceDllName() {
|
||||||
|
static wchar_t file_path[MAX_PATH + 1] = {0};
|
||||||
|
|
||||||
|
if (file_path[0] == 0) {
|
||||||
|
// Retrieve the module path (usually libcef.dll).
|
||||||
|
base::FilePath module;
|
||||||
|
base::PathService::Get(base::FILE_MODULE, &module);
|
||||||
|
const std::wstring wstr = module.value();
|
||||||
|
size_t count = std::min(static_cast<size_t>(MAX_PATH), wstr.size());
|
||||||
|
wcsncpy(file_path, wstr.c_str(), count);
|
||||||
|
file_path[count] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return file_path;
|
||||||
|
}
|
||||||
|
#endif // defined(OS_WIN)
|
||||||
|
|
||||||
|
blink::WebURLLoaderFactory* CefAppManager::GetDefaultURLLoaderFactory() {
|
||||||
|
if (!default_url_loader_factory_) {
|
||||||
|
default_url_loader_factory_ =
|
||||||
|
blink::Platform::Current()->CreateDefaultURLLoaderFactory();
|
||||||
|
}
|
||||||
|
return default_url_loader_factory_.get();
|
||||||
|
}
|
77
libcef/common/app_manager.h
Normal file
77
libcef/common/app_manager.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
// 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"
|
||||||
|
|
||||||
|
namespace blink {
|
||||||
|
class WebURLLoaderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
virtual CefRefPtr<CefRequestContext> GetGlobalRequestContext() = 0;
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
// Returns the module name (usually libcef.dll).
|
||||||
|
const wchar_t* GetResourceDllName();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// The following methods are only available in the render process.
|
||||||
|
|
||||||
|
// Returns a factory that only supports unintercepted http(s) and blob
|
||||||
|
// requests. Used by CefRenderURLRequest.
|
||||||
|
blink::WebURLLoaderFactory* GetDefaultURLLoaderFactory();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CefAppManager();
|
||||||
|
virtual ~CefAppManager();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Custom schemes handled by the client.
|
||||||
|
SchemeInfoList scheme_info_list_;
|
||||||
|
bool scheme_info_list_locked_ = false;
|
||||||
|
|
||||||
|
std::unique_ptr<blink::WebURLLoaderFactory> default_url_loader_factory_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefAppManager);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_COMMON_APP_MANAGER_H_
|
16
libcef/common/chrome/chrome_content_client_cef.cc
Normal file
16
libcef/common/chrome/chrome_content_client_cef.cc
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Copyright 2015 The Chromium Embedded Framework Authors.
|
||||||
|
// Portions copyright 2014 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/common/chrome/chrome_content_client_cef.h"
|
||||||
|
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
|
ChromeContentClientCef::ChromeContentClientCef() = default;
|
||||||
|
ChromeContentClientCef::~ChromeContentClientCef() = default;
|
||||||
|
|
||||||
|
void ChromeContentClientCef::AddAdditionalSchemes(Schemes* schemes) {
|
||||||
|
ChromeContentClient::AddAdditionalSchemes(schemes);
|
||||||
|
CefAppManager::Get()->AddAdditionalSchemes(schemes);
|
||||||
|
}
|
20
libcef/common/chrome/chrome_content_client_cef.h
Normal file
20
libcef/common/chrome/chrome_content_client_cef.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright 2015 The Chromium Embedded Framework Authors.
|
||||||
|
// Portions copyright 2014 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_COMMON_CHROME_CHROME_CONTENT_CLIENT_CEF_H_
|
||||||
|
#define CEF_LIBCEF_COMMON_CHROME_CHROME_CONTENT_CLIENT_CEF_H_
|
||||||
|
|
||||||
|
#include "chrome/common/chrome_content_client.h"
|
||||||
|
|
||||||
|
class ChromeContentClientCef : public ChromeContentClient {
|
||||||
|
public:
|
||||||
|
ChromeContentClientCef();
|
||||||
|
~ChromeContentClientCef() override;
|
||||||
|
|
||||||
|
// content::ContentClient overrides.
|
||||||
|
void AddAdditionalSchemes(Schemes* schemes) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_COMMON_CHROME_CHROME_CONTENT_CLIENT_CEF_H_
|
@ -7,8 +7,11 @@
|
|||||||
|
|
||||||
#include "libcef/browser/chrome/chrome_content_browser_client_cef.h"
|
#include "libcef/browser/chrome/chrome_content_browser_client_cef.h"
|
||||||
|
|
||||||
ChromeMainDelegateCef::ChromeMainDelegateCef(CefMainRunnerHandler* runner)
|
ChromeMainDelegateCef::ChromeMainDelegateCef(CefMainRunnerHandler* runner,
|
||||||
: ChromeMainDelegate(base::TimeTicks::Now()), runner_(runner) {}
|
CefRefPtr<CefApp> application)
|
||||||
|
: ChromeMainDelegate(base::TimeTicks::Now()),
|
||||||
|
runner_(runner),
|
||||||
|
application_(application) {}
|
||||||
ChromeMainDelegateCef::~ChromeMainDelegateCef() = default;
|
ChromeMainDelegateCef::~ChromeMainDelegateCef() = default;
|
||||||
|
|
||||||
void ChromeMainDelegateCef::PreCreateMainMessageLoop() {
|
void ChromeMainDelegateCef::PreCreateMainMessageLoop() {
|
||||||
@ -27,6 +30,10 @@ int ChromeMainDelegateCef::RunProcess(
|
|||||||
return ChromeMainDelegate::RunProcess(process_type, main_function_params);
|
return ChromeMainDelegate::RunProcess(process_type, main_function_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content::ContentClient* ChromeMainDelegateCef::CreateContentClient() {
|
||||||
|
return &chrome_content_client_cef_;
|
||||||
|
}
|
||||||
|
|
||||||
content::ContentBrowserClient*
|
content::ContentBrowserClient*
|
||||||
ChromeMainDelegateCef::CreateContentBrowserClient() {
|
ChromeMainDelegateCef::CreateContentBrowserClient() {
|
||||||
// Match the logic in the parent ChromeMainDelegate implementation, but create
|
// Match the logic in the parent ChromeMainDelegate implementation, but create
|
||||||
@ -41,6 +48,12 @@ ChromeMainDelegateCef::CreateContentBrowserClient() {
|
|||||||
return chrome_content_browser_client_.get();
|
return chrome_content_browser_client_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CefRefPtr<CefRequestContext> ChromeMainDelegateCef::GetGlobalRequestContext() {
|
||||||
|
// TODO(chrome-runtime): Implement this method.
|
||||||
|
NOTIMPLEMENTED();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
scoped_refptr<base::SingleThreadTaskRunner>
|
scoped_refptr<base::SingleThreadTaskRunner>
|
||||||
ChromeMainDelegateCef::GetBackgroundTaskRunner() {
|
ChromeMainDelegateCef::GetBackgroundTaskRunner() {
|
||||||
auto browser_client = content_browser_client();
|
auto browser_client = content_browser_client();
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_app.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
|
#include "libcef/common/chrome/chrome_content_client_cef.h"
|
||||||
#include "libcef/common/main_runner_handler.h"
|
#include "libcef/common/main_runner_handler.h"
|
||||||
#include "libcef/common/task_runner_manager.h"
|
#include "libcef/common/task_runner_manager.h"
|
||||||
|
|
||||||
@ -19,11 +21,13 @@ class ChromeContentBrowserClientCef;
|
|||||||
|
|
||||||
// CEF override of ChromeMainDelegate
|
// CEF override of ChromeMainDelegate
|
||||||
class ChromeMainDelegateCef : public ChromeMainDelegate,
|
class ChromeMainDelegateCef : public ChromeMainDelegate,
|
||||||
|
public CefAppManager,
|
||||||
public CefTaskRunnerManager {
|
public CefTaskRunnerManager {
|
||||||
public:
|
public:
|
||||||
// |runner| will be non-nullptr for the main process only, and will outlive
|
// |runner| will be non-nullptr for the main process only, and will outlive
|
||||||
// this object.
|
// this object.
|
||||||
explicit ChromeMainDelegateCef(CefMainRunnerHandler* runner);
|
ChromeMainDelegateCef(CefMainRunnerHandler* runner,
|
||||||
|
CefRefPtr<CefApp> application);
|
||||||
~ChromeMainDelegateCef() override;
|
~ChromeMainDelegateCef() override;
|
||||||
|
|
||||||
// ChromeMainDelegate overrides.
|
// ChromeMainDelegate overrides.
|
||||||
@ -31,9 +35,17 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
|
|||||||
int RunProcess(
|
int RunProcess(
|
||||||
const std::string& process_type,
|
const std::string& process_type,
|
||||||
const content::MainFunctionParams& main_function_params) override;
|
const content::MainFunctionParams& main_function_params) override;
|
||||||
|
content::ContentClient* CreateContentClient() override;
|
||||||
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// CefAppManager overrides.
|
||||||
|
CefRefPtr<CefApp> GetApplication() override { return application_; }
|
||||||
|
content::ContentClient* GetContentClient() override {
|
||||||
|
return &chrome_content_client_cef_;
|
||||||
|
}
|
||||||
|
CefRefPtr<CefRequestContext> GetGlobalRequestContext() override;
|
||||||
|
|
||||||
// CefTaskRunnerManager overrides.
|
// CefTaskRunnerManager overrides.
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner()
|
scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner()
|
||||||
override;
|
override;
|
||||||
@ -48,6 +60,10 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
|
|||||||
ChromeContentBrowserClientCef* content_browser_client() const;
|
ChromeContentBrowserClientCef* content_browser_client() const;
|
||||||
|
|
||||||
CefMainRunnerHandler* const runner_;
|
CefMainRunnerHandler* const runner_;
|
||||||
|
CefRefPtr<CefApp> application_;
|
||||||
|
|
||||||
|
// We use this instead of ChromeMainDelegate::chrome_content_client_.
|
||||||
|
ChromeContentClientCef chrome_content_client_cef_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ChromeMainDelegateCef);
|
DISALLOW_COPY_AND_ASSIGN(ChromeMainDelegateCef);
|
||||||
};
|
};
|
||||||
|
@ -18,14 +18,17 @@
|
|||||||
#include "chrome/app/chrome_main_mac.h"
|
#include "chrome/app/chrome_main_mac.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ChromeMainRunnerDelegate::ChromeMainRunnerDelegate(CefMainRunnerHandler* runner)
|
ChromeMainRunnerDelegate::ChromeMainRunnerDelegate(
|
||||||
: runner_(runner) {}
|
CefMainRunnerHandler* runner,
|
||||||
|
CefRefPtr<CefApp> application)
|
||||||
|
: runner_(runner), application_(application) {}
|
||||||
ChromeMainRunnerDelegate::~ChromeMainRunnerDelegate() = default;
|
ChromeMainRunnerDelegate::~ChromeMainRunnerDelegate() = default;
|
||||||
|
|
||||||
content::ContentMainDelegate*
|
content::ContentMainDelegate*
|
||||||
ChromeMainRunnerDelegate::GetContentMainDelegate() {
|
ChromeMainRunnerDelegate::GetContentMainDelegate() {
|
||||||
if (!main_delegate_) {
|
if (!main_delegate_) {
|
||||||
main_delegate_ = std::make_unique<ChromeMainDelegateCef>(runner_);
|
main_delegate_ =
|
||||||
|
std::make_unique<ChromeMainDelegateCef>(runner_, application_);
|
||||||
}
|
}
|
||||||
return main_delegate_.get();
|
return main_delegate_.get();
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_app.h"
|
||||||
#include "libcef/common/main_runner_delegate.h"
|
#include "libcef/common/main_runner_delegate.h"
|
||||||
#include "libcef/common/main_runner_handler.h"
|
#include "libcef/common/main_runner_handler.h"
|
||||||
|
|
||||||
@ -20,7 +20,8 @@ class ChromeMainRunnerDelegate : public CefMainRunnerDelegate {
|
|||||||
public:
|
public:
|
||||||
// |runner| will be non-nullptr for the main process only, and will outlive
|
// |runner| will be non-nullptr for the main process only, and will outlive
|
||||||
// this object.
|
// this object.
|
||||||
explicit ChromeMainRunnerDelegate(CefMainRunnerHandler* runner);
|
ChromeMainRunnerDelegate(CefMainRunnerHandler* runner,
|
||||||
|
CefRefPtr<CefApp> application);
|
||||||
~ChromeMainRunnerDelegate() override;
|
~ChromeMainRunnerDelegate() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -40,6 +41,7 @@ class ChromeMainRunnerDelegate : public CefMainRunnerDelegate {
|
|||||||
std::unique_ptr<ScopedKeepAlive> keep_alive_;
|
std::unique_ptr<ScopedKeepAlive> keep_alive_;
|
||||||
|
|
||||||
CefMainRunnerHandler* const runner_;
|
CefMainRunnerHandler* const runner_;
|
||||||
|
CefRefPtr<CefApp> application_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ChromeMainRunnerDelegate);
|
DISALLOW_COPY_AND_ASSIGN(ChromeMainRunnerDelegate);
|
||||||
};
|
};
|
||||||
|
53
libcef/common/net/scheme_info.h
Normal file
53
libcef/common/net/scheme_info.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// Copyright (c) 2013 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_NET_SCHEME_INFO_H_
|
||||||
|
#define CEF_LIBCEF_COMMON_NET_SCHEME_INFO_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// Values are registered with all processes (url/url_util.h) and with Blink
|
||||||
|
// (SchemeRegistry) unless otherwise indicated.
|
||||||
|
struct CefSchemeInfo {
|
||||||
|
// Lower-case ASCII scheme name.
|
||||||
|
std::string scheme_name;
|
||||||
|
|
||||||
|
// A scheme that is subject to URL canonicalization and parsing rules as
|
||||||
|
// defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1
|
||||||
|
// available at http://www.ietf.org/rfc/rfc1738.txt.
|
||||||
|
// This value is not registered with Blink.
|
||||||
|
bool is_standard;
|
||||||
|
|
||||||
|
// A scheme that will be treated the same as "file". For example, normal
|
||||||
|
// pages cannot link to or access URLs of this scheme.
|
||||||
|
bool is_local;
|
||||||
|
|
||||||
|
// A scheme that can only be displayed from other content hosted with the
|
||||||
|
// same scheme. For example, pages in other origins cannot create iframes or
|
||||||
|
// hyperlinks to URLs with the scheme. For schemes that must be accessible
|
||||||
|
// from other schemes set this value to false, set |is_cors_enabled| to
|
||||||
|
// true, and use CORS "Access-Control-Allow-Origin" headers to further
|
||||||
|
// restrict access.
|
||||||
|
// This value is registered with Blink only.
|
||||||
|
bool is_display_isolated;
|
||||||
|
|
||||||
|
// A scheme that will be treated the same as "https". For example, loading
|
||||||
|
// this scheme from other secure schemes will not trigger mixed content
|
||||||
|
// warnings.
|
||||||
|
bool is_secure;
|
||||||
|
|
||||||
|
// A scheme that can be sent CORS requests. This value should be true in
|
||||||
|
// most cases where |is_standard| is true.
|
||||||
|
bool is_cors_enabled;
|
||||||
|
|
||||||
|
// A scheme that can bypass Content-Security-Policy (CSP) checks. This value
|
||||||
|
// should be false in most cases where |is_standard| is true.
|
||||||
|
bool is_csp_bypassing;
|
||||||
|
|
||||||
|
// A scheme that can perform fetch request.
|
||||||
|
bool is_fetch_enabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_COMMON_NET_SCHEME_INFO_H_
|
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
#include "libcef/common/net/scheme_registration.h"
|
#include "libcef/common/net/scheme_registration.h"
|
||||||
|
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
|
#include "libcef/common/net/scheme_info.h"
|
||||||
|
#include "libcef/features/runtime.h"
|
||||||
|
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
#include "extensions/common/constants.h"
|
#include "extensions/common/constants.h"
|
||||||
@ -15,11 +17,14 @@
|
|||||||
namespace scheme {
|
namespace scheme {
|
||||||
|
|
||||||
void AddInternalSchemes(content::ContentClient::Schemes* schemes) {
|
void AddInternalSchemes(content::ContentClient::Schemes* schemes) {
|
||||||
|
if (!cef::IsAlloyRuntimeEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
// chrome: and chrome-devtools: schemes are registered in
|
// chrome: and chrome-devtools: schemes are registered in
|
||||||
// RenderThreadImpl::RegisterSchemes().
|
// RenderThreadImpl::RegisterSchemes().
|
||||||
// Access restrictions for chrome-extension: and chrome-extension-resource:
|
// Access restrictions for chrome-extension: and chrome-extension-resource:
|
||||||
// schemes will be applied in AlloyContentRendererClient::WillSendRequest().
|
// schemes will be applied in AlloyContentRendererClient::WillSendRequest().
|
||||||
static AlloyContentClient::SchemeInfo internal_schemes[] = {
|
static CefSchemeInfo internal_schemes[] = {
|
||||||
{
|
{
|
||||||
extensions::kExtensionScheme, true, /* is_standard */
|
extensions::kExtensionScheme, true, /* is_standard */
|
||||||
false, /* is_local */
|
false, /* is_local */
|
||||||
@ -32,7 +37,6 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) {
|
|||||||
|
|
||||||
// The |is_display_isolated| value is excluded here because it's registered
|
// The |is_display_isolated| value is excluded here because it's registered
|
||||||
// with Blink only.
|
// with Blink only.
|
||||||
AlloyContentClient* client = AlloyContentClient::Get();
|
|
||||||
for (size_t i = 0; i < sizeof(internal_schemes) / sizeof(internal_schemes[0]);
|
for (size_t i = 0; i < sizeof(internal_schemes) / sizeof(internal_schemes[0]);
|
||||||
++i) {
|
++i) {
|
||||||
if (internal_schemes[i].is_standard)
|
if (internal_schemes[i].is_standard)
|
||||||
@ -45,7 +49,7 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) {
|
|||||||
schemes->cors_enabled_schemes.push_back(internal_schemes[i].scheme_name);
|
schemes->cors_enabled_schemes.push_back(internal_schemes[i].scheme_name);
|
||||||
if (internal_schemes[i].is_csp_bypassing)
|
if (internal_schemes[i].is_csp_bypassing)
|
||||||
schemes->csp_bypassing_schemes.push_back(internal_schemes[i].scheme_name);
|
schemes->csp_bypassing_schemes.push_back(internal_schemes[i].scheme_name);
|
||||||
client->AddCustomScheme(internal_schemes[i]);
|
CefAppManager::Get()->AddCustomScheme(&internal_schemes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
#include "libcef/common/resource_bundle_delegate.h"
|
#include "libcef/common/resource_bundle_delegate.h"
|
||||||
|
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
|
|
||||||
base::FilePath CefResourceBundleDelegate::GetPathForResourcePack(
|
base::FilePath CefResourceBundleDelegate::GetPathForResourcePack(
|
||||||
const base::FilePath& pack_path,
|
const base::FilePath& pack_path,
|
||||||
ui::ScaleFactor scale_factor) {
|
ui::ScaleFactor scale_factor) {
|
||||||
// Only allow the cef pack file to load.
|
// Only allow the cef pack file to load.
|
||||||
if (!content_client_->pack_loading_disabled() &&
|
if (!pack_loading_disabled_ && allow_pack_file_load_) {
|
||||||
content_client_->allow_pack_file_load()) {
|
|
||||||
return pack_path;
|
return pack_path;
|
||||||
}
|
}
|
||||||
return base::FilePath();
|
return base::FilePath();
|
||||||
@ -16,7 +15,7 @@ base::FilePath CefResourceBundleDelegate::GetPathForResourcePack(
|
|||||||
base::FilePath CefResourceBundleDelegate::GetPathForLocalePack(
|
base::FilePath CefResourceBundleDelegate::GetPathForLocalePack(
|
||||||
const base::FilePath& pack_path,
|
const base::FilePath& pack_path,
|
||||||
const std::string& locale) {
|
const std::string& locale) {
|
||||||
if (!content_client_->pack_loading_disabled())
|
if (!pack_loading_disabled_)
|
||||||
return pack_path;
|
return pack_path;
|
||||||
return base::FilePath();
|
return base::FilePath();
|
||||||
}
|
}
|
||||||
@ -38,9 +37,10 @@ base::RefCountedStaticMemory* CefResourceBundleDelegate::LoadDataResourceBytes(
|
|||||||
bool CefResourceBundleDelegate::GetRawDataResource(int resource_id,
|
bool CefResourceBundleDelegate::GetRawDataResource(int resource_id,
|
||||||
ui::ScaleFactor scale_factor,
|
ui::ScaleFactor scale_factor,
|
||||||
base::StringPiece* value) {
|
base::StringPiece* value) {
|
||||||
if (content_client_->application().get()) {
|
auto application = CefAppManager::Get()->GetApplication();
|
||||||
|
if (application) {
|
||||||
CefRefPtr<CefResourceBundleHandler> handler =
|
CefRefPtr<CefResourceBundleHandler> handler =
|
||||||
content_client_->application()->GetResourceBundleHandler();
|
application->GetResourceBundleHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
void* data = nullptr;
|
void* data = nullptr;
|
||||||
size_t data_size = 0;
|
size_t data_size = 0;
|
||||||
@ -56,14 +56,15 @@ bool CefResourceBundleDelegate::GetRawDataResource(int resource_id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (content_client_->pack_loading_disabled() || !value->empty());
|
return (pack_loading_disabled_ || !value->empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefResourceBundleDelegate::GetLocalizedString(int message_id,
|
bool CefResourceBundleDelegate::GetLocalizedString(int message_id,
|
||||||
base::string16* value) {
|
base::string16* value) {
|
||||||
if (content_client_->application().get()) {
|
auto application = CefAppManager::Get()->GetApplication();
|
||||||
|
if (application) {
|
||||||
CefRefPtr<CefResourceBundleHandler> handler =
|
CefRefPtr<CefResourceBundleHandler> handler =
|
||||||
content_client_->application()->GetResourceBundleHandler();
|
application->GetResourceBundleHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
CefString cef_str;
|
CefString cef_str;
|
||||||
if (handler->GetLocalizedString(message_id, cef_str))
|
if (handler->GetLocalizedString(message_id, cef_str))
|
||||||
@ -71,5 +72,5 @@ bool CefResourceBundleDelegate::GetLocalizedString(int message_id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (content_client_->pack_loading_disabled() || !value->empty());
|
return (pack_loading_disabled_ || !value->empty());
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,12 @@ class AlloyContentClient;
|
|||||||
|
|
||||||
class CefResourceBundleDelegate : public ui::ResourceBundle::Delegate {
|
class CefResourceBundleDelegate : public ui::ResourceBundle::Delegate {
|
||||||
public:
|
public:
|
||||||
CefResourceBundleDelegate(AlloyContentClient* content_client)
|
CefResourceBundleDelegate() {}
|
||||||
: content_client_(content_client) {}
|
|
||||||
|
void set_pack_loading_disabled(bool val) { pack_loading_disabled_ = val; }
|
||||||
|
bool pack_loading_disabled() const { return pack_loading_disabled_; }
|
||||||
|
void set_allow_pack_file_load(bool val) { allow_pack_file_load_ = val; }
|
||||||
|
bool allow_pack_file_load() const { return allow_pack_file_load_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// ui::ResourceBundle::Delegate methods.
|
// ui::ResourceBundle::Delegate methods.
|
||||||
@ -33,7 +37,8 @@ class CefResourceBundleDelegate : public ui::ResourceBundle::Delegate {
|
|||||||
bool GetLocalizedString(int message_id, base::string16* value) override;
|
bool GetLocalizedString(int message_id, base::string16* value) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AlloyContentClient* content_client_;
|
bool pack_loading_disabled_ = false;
|
||||||
|
bool allow_pack_file_load_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_COMMON_RESOURCE_BUNDLE_DELEGATE_H_
|
#endif // CEF_LIBCEF_COMMON_RESOURCE_BUNDLE_DELEGATE_H_
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
|
#include "libcef/common/net/scheme_info.h"
|
||||||
#include "libcef/common/net/scheme_registration.h"
|
#include "libcef/common/net/scheme_registration.h"
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
@ -56,10 +57,10 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(const CefString& scheme_name,
|
|||||||
if (is_csp_bypassing)
|
if (is_csp_bypassing)
|
||||||
schemes_.csp_bypassing_schemes.push_back(scheme);
|
schemes_.csp_bypassing_schemes.push_back(scheme);
|
||||||
|
|
||||||
AlloyContentClient::SchemeInfo scheme_info = {
|
CefSchemeInfo scheme_info = {
|
||||||
scheme, is_standard, is_local, is_display_isolated,
|
scheme, is_standard, is_local, is_display_isolated,
|
||||||
is_secure, is_cors_enabled, is_csp_bypassing, is_fetch_enabled};
|
is_secure, is_cors_enabled, is_csp_bypassing, is_fetch_enabled};
|
||||||
AlloyContentClient::Get()->AddCustomScheme(scheme_info);
|
CefAppManager::Get()->AddCustomScheme(&scheme_info);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,10 @@
|
|||||||
|
|
||||||
#include "include/cef_urlrequest.h"
|
#include "include/cef_urlrequest.h"
|
||||||
#include "libcef/browser/net_service/browser_urlrequest_impl.h"
|
#include "libcef/browser/net_service/browser_urlrequest_impl.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/task_runner_impl.h"
|
#include "libcef/common/task_runner_impl.h"
|
||||||
#include "libcef/renderer/render_urlrequest_impl.h"
|
#include "libcef/renderer/render_urlrequest_impl.h"
|
||||||
|
#include "libcef/features/runtime_checks.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
#include "base/message_loop/message_loop.h"
|
||||||
@ -17,6 +18,9 @@ CefRefPtr<CefURLRequest> CefURLRequest::Create(
|
|||||||
CefRefPtr<CefRequest> request,
|
CefRefPtr<CefRequest> request,
|
||||||
CefRefPtr<CefURLRequestClient> client,
|
CefRefPtr<CefURLRequestClient> client,
|
||||||
CefRefPtr<CefRequestContext> request_context) {
|
CefRefPtr<CefRequestContext> request_context) {
|
||||||
|
// TODO(chrome-runtime): Add support for this method.
|
||||||
|
REQUIRE_ALLOY_RUNTIME();
|
||||||
|
|
||||||
if (!request.get() || !client.get()) {
|
if (!request.get() || !client.get()) {
|
||||||
NOTREACHED() << "called with invalid parameters";
|
NOTREACHED() << "called with invalid parameters";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -27,14 +31,15 @@ CefRefPtr<CefURLRequest> CefURLRequest::Create(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AlloyContentClient::Get()->browser()) {
|
auto content_client = CefAppManager::Get()->GetContentClient();
|
||||||
|
if (content_client->browser()) {
|
||||||
// In the browser process.
|
// In the browser process.
|
||||||
CefRefPtr<CefBrowserURLRequest> impl =
|
CefRefPtr<CefBrowserURLRequest> impl =
|
||||||
new CefBrowserURLRequest(nullptr, request, client, request_context);
|
new CefBrowserURLRequest(nullptr, request, client, request_context);
|
||||||
if (impl->Start())
|
if (impl->Start())
|
||||||
return impl.get();
|
return impl.get();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else if (AlloyContentClient::Get()->renderer()) {
|
} else if (content_client->renderer()) {
|
||||||
// In the render process.
|
// In the render process.
|
||||||
CefRefPtr<CefRenderURLRequest> impl =
|
CefRefPtr<CefRenderURLRequest> impl =
|
||||||
new CefRenderURLRequest(nullptr, request, client);
|
new CefRenderURLRequest(nullptr, request, client);
|
||||||
|
18
libcef/features/runtime_checks.h
Normal file
18
libcef/features/runtime_checks.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// 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_FEATURES_RUNTIME_CHECKS_H_
|
||||||
|
#define CEF_LIBCEF_FEATURES_RUNTIME_CHECKS_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "base/logging.h"
|
||||||
|
#include "cef/libcef/features/runtime.h"
|
||||||
|
|
||||||
|
#define REQUIRE_ALLOY_RUNTIME() \
|
||||||
|
CHECK(cef::IsAlloyRuntimeEnabled()) << "Alloy runtime is required"
|
||||||
|
|
||||||
|
#define REQUIRE_CHROME_RUNTIME() \
|
||||||
|
CHECK(cef::IsChrimeRuntimeEnabled()) << "Chrome runtime is required"
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_FEATURES_RUNTIME_CHECKS_H_
|
@ -23,12 +23,15 @@
|
|||||||
#include "libcef/browser/alloy/alloy_content_browser_client.h"
|
#include "libcef/browser/alloy/alloy_content_browser_client.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/alloy/alloy_content_client.h"
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/cef_messages.h"
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/extensions/extensions_client.h"
|
#include "libcef/common/extensions/extensions_client.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
|
#include "libcef/common/net/scheme_info.h"
|
||||||
#include "libcef/common/request_impl.h"
|
#include "libcef/common/request_impl.h"
|
||||||
#include "libcef/common/values_impl.h"
|
#include "libcef/common/values_impl.h"
|
||||||
|
#include "libcef/features/runtime_checks.h"
|
||||||
#include "libcef/renderer/blink_glue.h"
|
#include "libcef/renderer/blink_glue.h"
|
||||||
#include "libcef/renderer/browser_impl.h"
|
#include "libcef/renderer/browser_impl.h"
|
||||||
#include "libcef/renderer/extensions/extensions_renderer_client.h"
|
#include "libcef/renderer/extensions/extensions_renderer_client.h"
|
||||||
@ -92,7 +95,6 @@
|
|||||||
#include "services/service_manager/public/cpp/interface_provider.h"
|
#include "services/service_manager/public/cpp/interface_provider.h"
|
||||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
||||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
||||||
#include "third_party/blink/public/platform/platform.h"
|
|
||||||
#include "third_party/blink/public/platform/scheduler/web_renderer_process_type.h"
|
#include "third_party/blink/public/platform/scheduler/web_renderer_process_type.h"
|
||||||
#include "third_party/blink/public/platform/url_conversion.h"
|
#include "third_party/blink/public/platform/url_conversion.h"
|
||||||
#include "third_party/blink/public/platform/web_runtime_features.h"
|
#include "third_party/blink/public/platform/web_runtime_features.h"
|
||||||
@ -179,8 +181,9 @@ AlloyContentRendererClient::~AlloyContentRendererClient() {}
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
AlloyContentRendererClient* AlloyContentRendererClient::Get() {
|
AlloyContentRendererClient* AlloyContentRendererClient::Get() {
|
||||||
|
REQUIRE_ALLOY_RUNTIME();
|
||||||
return static_cast<AlloyContentRendererClient*>(
|
return static_cast<AlloyContentRendererClient*>(
|
||||||
AlloyContentClient::Get()->renderer());
|
CefAppManager::Get()->GetContentClient()->renderer());
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefBrowserImpl> AlloyContentRendererClient::GetBrowserForView(
|
CefRefPtr<CefBrowserImpl> AlloyContentRendererClient::GetBrowserForView(
|
||||||
@ -246,15 +249,6 @@ void AlloyContentRendererClient::OnGuestViewDestroyed(
|
|||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
blink::WebURLLoaderFactory*
|
|
||||||
AlloyContentRendererClient::GetDefaultURLLoaderFactory() {
|
|
||||||
if (!default_url_loader_factory_) {
|
|
||||||
default_url_loader_factory_ =
|
|
||||||
blink::Platform::Current()->CreateDefaultURLLoaderFactory();
|
|
||||||
}
|
|
||||||
return default_url_loader_factory_.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AlloyContentRendererClient::WebKitInitialized() {
|
void AlloyContentRendererClient::WebKitInitialized() {
|
||||||
const base::CommandLine* command_line =
|
const base::CommandLine* command_line =
|
||||||
base::CommandLine::ForCurrentProcess();
|
base::CommandLine::ForCurrentProcess();
|
||||||
@ -265,14 +259,14 @@ void AlloyContentRendererClient::WebKitInitialized() {
|
|||||||
// TODO(cef): Enable these once the implementation supports it.
|
// TODO(cef): Enable these once the implementation supports it.
|
||||||
blink::WebRuntimeFeatures::EnableNotifications(false);
|
blink::WebRuntimeFeatures::EnableNotifications(false);
|
||||||
|
|
||||||
const AlloyContentClient::SchemeInfoList* schemes =
|
const CefAppManager::SchemeInfoList* schemes =
|
||||||
AlloyContentClient::Get()->GetCustomSchemes();
|
CefAppManager::Get()->GetCustomSchemes();
|
||||||
if (!schemes->empty()) {
|
if (!schemes->empty()) {
|
||||||
// Register the custom schemes. The |is_standard| value is excluded here
|
// Register the custom schemes. The |is_standard| value is excluded here
|
||||||
// because it's not explicitly registered with Blink.
|
// because it's not explicitly registered with Blink.
|
||||||
AlloyContentClient::SchemeInfoList::const_iterator it = schemes->begin();
|
CefAppManager::SchemeInfoList::const_iterator it = schemes->begin();
|
||||||
for (; it != schemes->end(); ++it) {
|
for (; it != schemes->end(); ++it) {
|
||||||
const AlloyContentClient::SchemeInfo& info = *it;
|
const CefSchemeInfo& info = *it;
|
||||||
const blink::WebString& scheme =
|
const blink::WebString& scheme =
|
||||||
blink::WebString::FromUTF8(info.scheme_name);
|
blink::WebString::FromUTF8(info.scheme_name);
|
||||||
if (info.is_local)
|
if (info.is_local)
|
||||||
@ -319,7 +313,7 @@ void AlloyContentRendererClient::WebKitInitialized() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Notify the render process handler.
|
// Notify the render process handler.
|
||||||
CefRefPtr<CefApp> application = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> application = CefAppManager::Get()->GetApplication();
|
||||||
if (application.get()) {
|
if (application.get()) {
|
||||||
CefRefPtr<CefRenderProcessHandler> handler =
|
CefRefPtr<CefRenderProcessHandler> handler =
|
||||||
application->GetRenderProcessHandler();
|
application->GetRenderProcessHandler();
|
||||||
@ -459,7 +453,7 @@ void AlloyContentRendererClient::RenderThreadConnected() {
|
|||||||
cross_origin_whitelist_entries_ = params.cross_origin_whitelist_entries;
|
cross_origin_whitelist_entries_ = params.cross_origin_whitelist_entries;
|
||||||
|
|
||||||
// Notify the render process handler.
|
// Notify the render process handler.
|
||||||
CefRefPtr<CefApp> application = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> application = CefAppManager::Get()->GetApplication();
|
||||||
if (application.get()) {
|
if (application.get()) {
|
||||||
CefRefPtr<CefRenderProcessHandler> handler =
|
CefRefPtr<CefRenderProcessHandler> handler =
|
||||||
application->GetRenderProcessHandler();
|
application->GetRenderProcessHandler();
|
||||||
@ -778,7 +772,7 @@ CefRefPtr<CefBrowserImpl> AlloyContentRendererClient::MaybeCreateBrowser(
|
|||||||
browsers_.insert(std::make_pair(render_view, browser));
|
browsers_.insert(std::make_pair(render_view, browser));
|
||||||
|
|
||||||
// Notify the render process handler.
|
// Notify the render process handler.
|
||||||
CefRefPtr<CefApp> application = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> application = CefAppManager::Get()->GetApplication();
|
||||||
if (application.get()) {
|
if (application.get()) {
|
||||||
CefRefPtr<CefRenderProcessHandler> handler =
|
CefRefPtr<CefRenderProcessHandler> handler =
|
||||||
application->GetRenderProcessHandler();
|
application->GetRenderProcessHandler();
|
||||||
|
@ -25,10 +25,6 @@
|
|||||||
#include "mojo/public/cpp/bindings/generic_pending_receiver.h"
|
#include "mojo/public/cpp/bindings/generic_pending_receiver.h"
|
||||||
#include "services/service_manager/public/cpp/local_interface_provider.h"
|
#include "services/service_manager/public/cpp/local_interface_provider.h"
|
||||||
|
|
||||||
namespace blink {
|
|
||||||
class WebURLLoaderFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace extensions {
|
namespace extensions {
|
||||||
class CefExtensionsRendererClient;
|
class CefExtensionsRendererClient;
|
||||||
class Dispatcher;
|
class Dispatcher;
|
||||||
@ -62,6 +58,7 @@ class AlloyContentRendererClient
|
|||||||
~AlloyContentRendererClient() override;
|
~AlloyContentRendererClient() override;
|
||||||
|
|
||||||
// Returns the singleton AlloyContentRendererClient instance.
|
// Returns the singleton AlloyContentRendererClient instance.
|
||||||
|
// This method is deprecated and should not be used in new callsites.
|
||||||
static AlloyContentRendererClient* Get();
|
static AlloyContentRendererClient* Get();
|
||||||
|
|
||||||
// Returns the browser associated with the specified RenderView.
|
// Returns the browser associated with the specified RenderView.
|
||||||
@ -88,10 +85,6 @@ class AlloyContentRendererClient
|
|||||||
return uncaught_exception_stack_size_;
|
return uncaught_exception_stack_size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a factory that only supports unintercepted http(s) and blob
|
|
||||||
// requests. Used by CefRenderURLRequest.
|
|
||||||
blink::WebURLLoaderFactory* GetDefaultURLLoaderFactory();
|
|
||||||
|
|
||||||
void WebKitInitialized();
|
void WebKitInitialized();
|
||||||
|
|
||||||
// Returns the task runner for the current thread. Returns NULL if the current
|
// Returns the task runner for the current thread. Returns NULL if the current
|
||||||
@ -171,8 +164,6 @@ class AlloyContentRendererClient
|
|||||||
std::unique_ptr<SpellCheck> spellcheck_;
|
std::unique_ptr<SpellCheck> spellcheck_;
|
||||||
std::unique_ptr<visitedlink::VisitedLinkReader> visited_link_slave_;
|
std::unique_ptr<visitedlink::VisitedLinkReader> visited_link_slave_;
|
||||||
|
|
||||||
std::unique_ptr<blink::WebURLLoaderFactory> default_url_loader_factory_;
|
|
||||||
|
|
||||||
// Map of RenderView pointers to CefBrowserImpl references.
|
// Map of RenderView pointers to CefBrowserImpl references.
|
||||||
typedef std::map<content::RenderView*, CefRefPtr<CefBrowserImpl>> BrowserMap;
|
typedef std::map<content::RenderView*, CefRefPtr<CefBrowserImpl>> BrowserMap;
|
||||||
BrowserMap browsers_;
|
BrowserMap browsers_;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/cef_messages.h"
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/renderer/alloy/alloy_content_renderer_client.h"
|
#include "libcef/renderer/alloy/alloy_content_renderer_client.h"
|
||||||
#include "libcef/renderer/blink_glue.h"
|
#include "libcef/renderer/blink_glue.h"
|
||||||
@ -345,7 +345,7 @@ void CefBrowserImpl::AddFrameObject(int64_t frame_id,
|
|||||||
|
|
||||||
void CefBrowserImpl::OnDestruct() {
|
void CefBrowserImpl::OnDestruct() {
|
||||||
// Notify that the browser window has been destroyed.
|
// Notify that the browser window has been destroyed.
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app.get()) {
|
if (app.get()) {
|
||||||
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
|
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
|
||||||
if (handler.get())
|
if (handler.get())
|
||||||
@ -373,7 +373,7 @@ void CefBrowserImpl::FrameDetached(int64_t frame_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::OnLoadingStateChange(bool isLoading) {
|
void CefBrowserImpl::OnLoadingStateChange(bool isLoading) {
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app.get()) {
|
if (app.get()) {
|
||||||
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
|
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/cef_messages.h"
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/common/net/http_header_utils.h"
|
#include "libcef/common/net/http_header_utils.h"
|
||||||
#include "libcef/common/process_message_impl.h"
|
#include "libcef/common/process_message_impl.h"
|
||||||
@ -325,7 +325,7 @@ void CefFrameImpl::OnDidFinishLoad() {
|
|||||||
Send(new CefHostMsg_DidFinishLoad(MSG_ROUTING_NONE, dl->GetUrl(),
|
Send(new CefHostMsg_DidFinishLoad(MSG_ROUTING_NONE, dl->GetUrl(),
|
||||||
http_status_code));
|
http_status_code));
|
||||||
|
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app) {
|
if (app) {
|
||||||
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
|
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
|
||||||
if (handler) {
|
if (handler) {
|
||||||
@ -417,7 +417,7 @@ void CefFrameImpl::OnRequest(const Cef_Request_Params& params) {
|
|||||||
|
|
||||||
if (params.user_initiated) {
|
if (params.user_initiated) {
|
||||||
// Give the user a chance to handle the request.
|
// Give the user a chance to handle the request.
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app.get()) {
|
if (app.get()) {
|
||||||
CefRefPtr<CefRenderProcessHandler> handler =
|
CefRefPtr<CefRenderProcessHandler> handler =
|
||||||
app->GetRenderProcessHandler();
|
app->GetRenderProcessHandler();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "libcef/renderer/render_frame_observer.h"
|
#include "libcef/renderer/render_frame_observer.h"
|
||||||
|
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/renderer/blink_glue.h"
|
#include "libcef/renderer/blink_glue.h"
|
||||||
#include "libcef/renderer/browser_impl.h"
|
#include "libcef/renderer/browser_impl.h"
|
||||||
#include "libcef/renderer/dom_document_impl.h"
|
#include "libcef/renderer/dom_document_impl.h"
|
||||||
@ -96,7 +96,7 @@ void CefRenderFrameObserver::FocusedElementChanged(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
CefRefPtr<CefRenderProcessHandler> handler;
|
CefRefPtr<CefRenderProcessHandler> handler;
|
||||||
CefRefPtr<CefApp> application = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> application = CefAppManager::Get()->GetApplication();
|
||||||
if (application)
|
if (application)
|
||||||
handler = application->GetRenderProcessHandler();
|
handler = application->GetRenderProcessHandler();
|
||||||
if (!handler)
|
if (!handler)
|
||||||
@ -138,7 +138,7 @@ void CefRenderFrameObserver::DidCreateScriptContext(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
CefRefPtr<CefRenderProcessHandler> handler;
|
CefRefPtr<CefRenderProcessHandler> handler;
|
||||||
CefRefPtr<CefApp> application = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> application = CefAppManager::Get()->GetApplication();
|
||||||
if (application)
|
if (application)
|
||||||
handler = application->GetRenderProcessHandler();
|
handler = application->GetRenderProcessHandler();
|
||||||
if (!handler)
|
if (!handler)
|
||||||
@ -164,7 +164,7 @@ void CefRenderFrameObserver::WillReleaseScriptContext(
|
|||||||
CefRefPtr<CefBrowserImpl> browserPtr =
|
CefRefPtr<CefBrowserImpl> browserPtr =
|
||||||
CefBrowserImpl::GetBrowserForMainFrame(frame->Top());
|
CefBrowserImpl::GetBrowserForMainFrame(frame->Top());
|
||||||
if (browserPtr) {
|
if (browserPtr) {
|
||||||
CefRefPtr<CefApp> application = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> application = CefAppManager::Get()->GetApplication();
|
||||||
if (application) {
|
if (application) {
|
||||||
CefRefPtr<CefRenderProcessHandler> handler =
|
CefRefPtr<CefRenderProcessHandler> handler =
|
||||||
application->GetRenderProcessHandler();
|
application->GetRenderProcessHandler();
|
||||||
@ -210,7 +210,7 @@ void CefRenderFrameObserver::AttachFrame(CefFrameImpl* frame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderFrameObserver::OnLoadStart() {
|
void CefRenderFrameObserver::OnLoadStart() {
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app.get()) {
|
if (app.get()) {
|
||||||
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
|
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
@ -226,7 +226,7 @@ void CefRenderFrameObserver::OnLoadStart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderFrameObserver::OnLoadError() {
|
void CefRenderFrameObserver::OnLoadError() {
|
||||||
CefRefPtr<CefApp> app = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
|
||||||
if (app.get()) {
|
if (app.get()) {
|
||||||
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
|
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
|
@ -6,16 +6,18 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/request_impl.h"
|
#include "libcef/common/request_impl.h"
|
||||||
#include "libcef/common/response_impl.h"
|
#include "libcef/common/response_impl.h"
|
||||||
#include "libcef/common/task_runner_impl.h"
|
#include "libcef/common/task_runner_impl.h"
|
||||||
#include "libcef/renderer/alloy/alloy_content_renderer_client.h"
|
|
||||||
#include "libcef/renderer/blink_glue.h"
|
#include "libcef/renderer/blink_glue.h"
|
||||||
|
#include "libcef/renderer/frame_impl.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
#include "base/message_loop/message_loop.h"
|
||||||
#include "net/base/request_priority.h"
|
#include "net/base/request_priority.h"
|
||||||
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
|
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
|
||||||
|
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h"
|
||||||
#include "third_party/blink/public/platform/web_security_origin.h"
|
#include "third_party/blink/public/platform/web_security_origin.h"
|
||||||
#include "third_party/blink/public/platform/web_string.h"
|
#include "third_party/blink/public/platform/web_string.h"
|
||||||
#include "third_party/blink/public/platform/web_url.h"
|
#include "third_party/blink/public/platform/web_url.h"
|
||||||
@ -155,7 +157,7 @@ class CefRenderURLRequest::Context
|
|||||||
}
|
}
|
||||||
if (!factory) {
|
if (!factory) {
|
||||||
// This factory only supports unintercepted http(s) and blob requests.
|
// This factory only supports unintercepted http(s) and blob requests.
|
||||||
factory = AlloyContentRendererClient::Get()->GetDefaultURLLoaderFactory();
|
factory = CefAppManager::Get()->GetDefaultURLLoaderFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
loader_ = factory->CreateURLLoader(
|
loader_ = factory->CreateURLLoader(
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "libcef/renderer/v8_impl.h"
|
#include "libcef/renderer/v8_impl.h"
|
||||||
|
|
||||||
#include "libcef/common/alloy/alloy_content_client.h"
|
#include "libcef/common/app_manager.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
#include "libcef/common/task_runner_impl.h"
|
#include "libcef/common/task_runner_impl.h"
|
||||||
#include "libcef/common/tracker.h"
|
#include "libcef/common/tracker.h"
|
||||||
@ -783,7 +783,7 @@ class CefV8ExceptionImpl : public CefV8Exception {
|
|||||||
|
|
||||||
void MessageListenerCallbackImpl(v8::Handle<v8::Message> message,
|
void MessageListenerCallbackImpl(v8::Handle<v8::Message> message,
|
||||||
v8::Handle<v8::Value> data) {
|
v8::Handle<v8::Value> data) {
|
||||||
CefRefPtr<CefApp> application = AlloyContentClient::Get()->application();
|
CefRefPtr<CefApp> application = CefAppManager::Get()->GetApplication();
|
||||||
if (!application.get())
|
if (!application.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user