Compare commits
8 Commits
231701d98b
...
60ce575e53
Author | SHA1 | Date |
---|---|---|
Marshall Greenblatt | 60ce575e53 | |
Marshall Greenblatt | 0d166c3c90 | |
Marshall Greenblatt | 9b284ec8f7 | |
Marshall Greenblatt | b080705ec8 | |
Marshall Greenblatt | 1cdf02815e | |
Marshall Greenblatt | cd3f617171 | |
Marshall Greenblatt | bd57a40256 | |
Marshall Greenblatt | c0a3c897cf |
23
BUILD.gn
23
BUILD.gn
|
@ -477,8 +477,12 @@ source_set("libcef_static") {
|
|||
"libcef/browser/browser_contents_delegate.h",
|
||||
"libcef/browser/browser_context.cc",
|
||||
"libcef/browser/browser_context.h",
|
||||
"libcef/browser/browser_event_util.cc",
|
||||
"libcef/browser/browser_event_util.h",
|
||||
"libcef/browser/browser_frame.cc",
|
||||
"libcef/browser/browser_frame.h",
|
||||
"libcef/browser/browser_guest_util.cc",
|
||||
"libcef/browser/browser_guest_util.h",
|
||||
"libcef/browser/browser_host_base.cc",
|
||||
"libcef/browser/browser_host_base.h",
|
||||
"libcef/browser/browser_host_create.cc",
|
||||
|
@ -493,8 +497,6 @@ source_set("libcef_static") {
|
|||
"libcef/browser/browser_platform_delegate.cc",
|
||||
"libcef/browser/browser_platform_delegate.h",
|
||||
"libcef/browser/browser_platform_delegate_create.cc",
|
||||
"libcef/browser/browser_util.cc",
|
||||
"libcef/browser/browser_util.h",
|
||||
"libcef/browser/certificate_query.cc",
|
||||
"libcef/browser/certificate_query.h",
|
||||
"libcef/browser/chrome/browser_delegate.h",
|
||||
|
@ -512,12 +514,9 @@ source_set("libcef_static") {
|
|||
"libcef/browser/chrome/chrome_content_browser_client_cef.h",
|
||||
"libcef/browser/chrome/chrome_context_menu_handler.cc",
|
||||
"libcef/browser/chrome/chrome_context_menu_handler.h",
|
||||
"libcef/browser/chrome/chrome_devtools_window_runner.cc",
|
||||
"libcef/browser/chrome/chrome_devtools_window_runner.h",
|
||||
"libcef/browser/chrome/chrome_startup_browser_creator.cc",
|
||||
"libcef/browser/chrome/chrome_startup_browser_creator.h",
|
||||
"libcef/browser/chrome/chrome_web_contents_view_delegate_cef.h",
|
||||
"libcef/browser/chrome_crash_reporter_client_stub.cc",
|
||||
"libcef/browser/chrome/extensions/chrome_extension_util.cc",
|
||||
"libcef/browser/chrome/extensions/chrome_extension_util.h",
|
||||
"libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.cc",
|
||||
|
@ -546,16 +545,14 @@ source_set("libcef_static") {
|
|||
"libcef/browser/devtools/devtools_controller.h",
|
||||
"libcef/browser/devtools/devtools_protocol_manager.cc",
|
||||
"libcef/browser/devtools/devtools_protocol_manager.h",
|
||||
"libcef/browser/devtools/devtools_window_runner.cc",
|
||||
"libcef/browser/devtools/devtools_window_runner.h",
|
||||
"libcef/browser/devtools/devtools_window_runner_create.cc",
|
||||
"libcef/browser/download_item_impl.cc",
|
||||
"libcef/browser/download_item_impl.h",
|
||||
"libcef/browser/download_manager_delegate.cc",
|
||||
"libcef/browser/download_manager_delegate.h",
|
||||
"libcef/browser/download_manager_delegate_impl.cc",
|
||||
"libcef/browser/download_manager_delegate_impl.h",
|
||||
"libcef/browser/extensions/browser_extensions_util.cc",
|
||||
"libcef/browser/extensions/browser_extensions_util.h",
|
||||
"libcef/browser/file_dialog_manager.cc",
|
||||
"libcef/browser/file_dialog_manager.h",
|
||||
"libcef/browser/file_dialog_runner.cc",
|
||||
|
@ -603,8 +600,6 @@ source_set("libcef_static") {
|
|||
"libcef/browser/native/window_delegate_view.h",
|
||||
"libcef/browser/navigation_entry_impl.cc",
|
||||
"libcef/browser/navigation_entry_impl.h",
|
||||
"libcef/browser/net/chrome_scheme_handler.cc",
|
||||
"libcef/browser/net/chrome_scheme_handler.h",
|
||||
"libcef/browser/net/crlset_file_util_impl.cc",
|
||||
"libcef/browser/net/throttle_handler.cc",
|
||||
"libcef/browser/net/throttle_handler.h",
|
||||
|
@ -687,6 +682,8 @@ source_set("libcef_static") {
|
|||
"libcef/browser/trace_subscriber.cc",
|
||||
"libcef/browser/trace_subscriber.h",
|
||||
"libcef/browser/thread_util.h",
|
||||
"libcef/browser/ui_thread.cc",
|
||||
"libcef/browser/ui_thread.h",
|
||||
"libcef/browser/views/basic_label_button_impl.cc",
|
||||
"libcef/browser/views/basic_label_button_impl.h",
|
||||
"libcef/browser/views/basic_label_button_view.cc",
|
||||
|
@ -768,8 +765,6 @@ source_set("libcef_static") {
|
|||
"libcef/common/chrome/chrome_content_client_cef.h",
|
||||
"libcef/common/chrome/chrome_main_delegate_cef.cc",
|
||||
"libcef/common/chrome/chrome_main_delegate_cef.h",
|
||||
"libcef/common/chrome/chrome_main_runner_delegate.cc",
|
||||
"libcef/common/chrome/chrome_main_runner_delegate.h",
|
||||
"libcef/common/command_line_impl.cc",
|
||||
"libcef/common/command_line_impl.h",
|
||||
"libcef/common/crash_reporter_client.cc",
|
||||
|
@ -783,8 +778,6 @@ source_set("libcef_static") {
|
|||
"libcef/common/frame_util.h",
|
||||
"libcef/common/i18n_util_impl.cc",
|
||||
"libcef/common/json_impl.cc",
|
||||
"libcef/common/main_runner_delegate.h",
|
||||
"libcef/common/main_runner_handler.h",
|
||||
"libcef/common/net/http_header_utils.cc",
|
||||
"libcef/common/net/http_header_utils.h",
|
||||
"libcef/common/net/scheme_registration.cc",
|
||||
|
@ -834,8 +827,6 @@ source_set("libcef_static") {
|
|||
"libcef/common/values_impl.h",
|
||||
"libcef/common/waitable_event_impl.cc",
|
||||
"libcef/common/waitable_event_impl.h",
|
||||
"libcef/features/runtime.h",
|
||||
"libcef/features/runtime_checks.h",
|
||||
"libcef/renderer/browser_impl.cc",
|
||||
"libcef/renderer/browser_impl.h",
|
||||
"libcef/renderer/chrome/chrome_content_renderer_client_cef.cc",
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
#include "cef/libcef/browser/alloy/browser_platform_delegate_alloy.h"
|
||||
#include "cef/libcef/browser/audio_capturer.h"
|
||||
#include "cef/libcef/browser/browser_context.h"
|
||||
#include "cef/libcef/browser/browser_guest_util.h"
|
||||
#include "cef/libcef/browser/browser_info.h"
|
||||
#include "cef/libcef/browser/browser_info_manager.h"
|
||||
#include "cef/libcef/browser/browser_platform_delegate.h"
|
||||
#include "cef/libcef/browser/context.h"
|
||||
#include "cef/libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "cef/libcef/browser/hang_monitor.h"
|
||||
#include "cef/libcef/browser/media_access_query.h"
|
||||
#include "cef/libcef/browser/osr/osr_util.h"
|
||||
|
@ -559,8 +559,8 @@ void AlloyBrowserHostImpl::CancelContextMenu() {
|
|||
bool AlloyBrowserHostImpl::MaybeAllowNavigation(
|
||||
content::RenderFrameHost* opener,
|
||||
const content::OpenURLParams& params) {
|
||||
const bool is_guest_view = extensions::IsBrowserPluginGuest(
|
||||
content::WebContents::FromRenderFrameHost(opener));
|
||||
const bool is_guest_view =
|
||||
IsBrowserPluginGuest(content::WebContents::FromRenderFrameHost(opener));
|
||||
if (is_guest_view && !params.is_pdf &&
|
||||
!params.url.SchemeIs(extensions::kExtensionScheme) &&
|
||||
!params.url.SchemeIs(content::kChromeUIScheme)) {
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
#include "cef/libcef/browser/browser_contents_delegate.h"
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "cef/libcef/browser/browser_event_util.h"
|
||||
#include "cef/libcef/browser/browser_host_base.h"
|
||||
#include "cef/libcef/browser/browser_platform_delegate.h"
|
||||
#include "cef/libcef/browser/browser_util.h"
|
||||
#include "cef/libcef/browser/native/cursor_util.h"
|
||||
#include "cef/libcef/common/frame_util.h"
|
||||
#include "chrome/browser/ui/views/sad_tab_view.h"
|
||||
|
@ -252,7 +252,7 @@ CefBrowserContentsDelegate::PreHandleKeyboardEvent(
|
|||
if (auto c = client()) {
|
||||
if (auto handler = c->GetKeyboardHandler()) {
|
||||
CefKeyEvent cef_event;
|
||||
if (browser_util::GetCefKeyEvent(event, cef_event)) {
|
||||
if (GetCefKeyEvent(event, cef_event)) {
|
||||
cef_event.focus_on_editable_field = focus_on_editable_field_;
|
||||
|
||||
auto event_handle = delegate->GetEventHandle(event);
|
||||
|
@ -284,7 +284,7 @@ bool CefBrowserContentsDelegate::HandleKeyboardEvent(
|
|||
if (auto c = client()) {
|
||||
if (auto handler = c->GetKeyboardHandler()) {
|
||||
CefKeyEvent cef_event;
|
||||
if (browser_util::GetCefKeyEvent(event, cef_event)) {
|
||||
if (GetCefKeyEvent(event, cef_event)) {
|
||||
cef_event.focus_on_editable_field = focus_on_editable_field_;
|
||||
|
||||
auto event_handle = delegate->GetEventHandle(event);
|
||||
|
|
|
@ -2,12 +2,10 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#include "cef/libcef/browser/browser_util.h"
|
||||
#include "cef/libcef/browser/browser_event_util.h"
|
||||
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
|
||||
namespace browser_util {
|
||||
|
||||
bool GetCefKeyEvent(const input::NativeWebKeyboardEvent& event,
|
||||
CefKeyEvent& cef_event) {
|
||||
switch (event.GetType()) {
|
||||
|
@ -69,5 +67,3 @@ bool GetCefKeyEvent(const ui::KeyEvent& event, CefKeyEvent& cef_event) {
|
|||
input::NativeWebKeyboardEvent native_event(event);
|
||||
return GetCefKeyEvent(native_event, cef_event);
|
||||
}
|
||||
|
||||
} // namespace browser_util
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_UTIL_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_UTIL_H_
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_EVENT_UTIL_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_EVENT_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include "cef/include/internal/cef_types_wrappers.h"
|
||||
|
@ -16,8 +16,6 @@ namespace ui {
|
|||
class KeyEvent;
|
||||
}
|
||||
|
||||
namespace browser_util {
|
||||
|
||||
// Convert a input::NativeWebKeyboardEvent to a CefKeyEvent.
|
||||
bool GetCefKeyEvent(const input::NativeWebKeyboardEvent& event,
|
||||
CefKeyEvent& cef_event);
|
||||
|
@ -25,6 +23,4 @@ bool GetCefKeyEvent(const input::NativeWebKeyboardEvent& event,
|
|||
// Convert a ui::KeyEvent to a CefKeyEvent.
|
||||
bool GetCefKeyEvent(const ui::KeyEvent& event, CefKeyEvent& cef_event);
|
||||
|
||||
} // namespace browser_util
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_UTIL_H_
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_EVENT_UTIL_H_
|
|
@ -2,15 +2,13 @@
|
|||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cef/libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "cef/libcef/browser/browser_guest_util.h"
|
||||
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/printing/print_preview_dialog_controller.h"
|
||||
#include "content/browser/browser_plugin/browser_plugin_guest.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
namespace {
|
||||
|
||||
content::WebContents* GetOwnerForBrowserPluginGuest(
|
||||
|
@ -62,5 +60,3 @@ bool IsBrowserPluginGuest(const content::WebContents* web_contents) {
|
|||
bool IsPrintPreviewDialog(const content::WebContents* web_contents) {
|
||||
return !!GetInitiatorForPrintPreviewDialog(web_contents);
|
||||
}
|
||||
|
||||
} // namespace extensions
|
|
@ -2,15 +2,13 @@
|
|||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_
|
||||
#define CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_GUEST_UTIL_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_GUEST_UTIL_H_
|
||||
|
||||
namespace content {
|
||||
class WebContents;
|
||||
} // namespace content
|
||||
|
||||
namespace extensions {
|
||||
|
||||
// Returns the WebContents that owns the specified |guest|, if any.
|
||||
content::WebContents* GetOwnerForGuestContents(
|
||||
const content::WebContents* guest);
|
||||
|
@ -19,6 +17,4 @@ content::WebContents* GetOwnerForGuestContents(
|
|||
bool IsBrowserPluginGuest(const content::WebContents* web_contents);
|
||||
bool IsPrintPreviewDialog(const content::WebContents* web_contents);
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_GUEST_UTIL_H_
|
|
@ -7,10 +7,10 @@
|
|||
#include <tuple>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "cef/libcef/browser/browser_guest_util.h"
|
||||
#include "cef/libcef/browser/browser_info_manager.h"
|
||||
#include "cef/libcef/browser/browser_platform_delegate.h"
|
||||
#include "cef/libcef/browser/context.h"
|
||||
#include "cef/libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "cef/libcef/browser/hang_monitor.h"
|
||||
#include "cef/libcef/browser/image_impl.h"
|
||||
#include "cef/libcef/browser/navigation_entry_impl.h"
|
||||
|
@ -128,7 +128,7 @@ CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForContents(
|
|||
// Try the owner WebContents if |contents| originates from an excluded view
|
||||
// such as the PDF viewer or Print Preview. This is safe to call even if Alloy
|
||||
// extensions are disabled.
|
||||
if (auto* owner_contents = extensions::GetOwnerForGuestContents(contents)) {
|
||||
if (auto* owner_contents = GetOwnerForGuestContents(contents)) {
|
||||
return WebContentsUserDataAdapter::Get(owner_contents);
|
||||
}
|
||||
|
||||
|
@ -1360,7 +1360,7 @@ CefMediaStreamRegistrar* CefBrowserHostBase::GetMediaStreamRegistrar() {
|
|||
|
||||
CefDevToolsWindowRunner* CefBrowserHostBase::GetDevToolsWindowRunner() {
|
||||
if (!devtools_window_runner_) {
|
||||
devtools_window_runner_ = CefDevToolsWindowRunner::Create();
|
||||
devtools_window_runner_ = std::make_unique<CefDevToolsWindowRunner>();
|
||||
}
|
||||
return devtools_window_runner_.get();
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "cef/libcef/browser/browser_guest_util.h"
|
||||
#include "cef/libcef/browser/browser_host_base.h"
|
||||
#include "cef/libcef/browser/browser_platform_delegate.h"
|
||||
#include "cef/libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "cef/libcef/common/cef_switches.h"
|
||||
#include "cef/libcef/common/frame_util.h"
|
||||
|
@ -492,10 +492,8 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfoManager::GetFrameHost(
|
|||
|
||||
const bool is_pdf_process = rfh->GetProcess()->IsPdf();
|
||||
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
|
||||
const bool is_browser_process_guest =
|
||||
extensions::IsBrowserPluginGuest(web_contents);
|
||||
const bool is_print_preview_dialog =
|
||||
extensions::IsPrintPreviewDialog(web_contents);
|
||||
const bool is_browser_process_guest = IsBrowserPluginGuest(web_contents);
|
||||
const bool is_print_preview_dialog = IsPrintPreviewDialog(web_contents);
|
||||
|
||||
bool excluded =
|
||||
is_pdf_process || is_browser_process_guest || is_print_preview_dialog;
|
||||
|
@ -504,7 +502,7 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfoManager::GetFrameHost(
|
|||
|
||||
// A BrowserHost may match an excluded RFH type. Some associations are
|
||||
// registered directly via CefBrowserInfo::MaybeCreateFrame and some are
|
||||
// discovered indirectly via extensions::GetOwnerForGuestContents.
|
||||
// discovered indirectly via GetOwnerForGuestContents.
|
||||
auto browser = CefBrowserHostBase::GetBrowserForHost(rfh);
|
||||
if (browser && !excluded) {
|
||||
frame = browser->browser_info()->GetFrameForHost(rfh, prefer_speculative);
|
||||
|
@ -544,13 +542,11 @@ bool CefBrowserInfoManager::IsExcludedFrameHost(content::RenderFrameHost* rfh) {
|
|||
}
|
||||
|
||||
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
|
||||
const bool is_browser_process_guest =
|
||||
extensions::IsBrowserPluginGuest(web_contents);
|
||||
const bool is_browser_process_guest = IsBrowserPluginGuest(web_contents);
|
||||
if (is_browser_process_guest) {
|
||||
return true;
|
||||
}
|
||||
const bool is_print_preview_dialog =
|
||||
extensions::IsPrintPreviewDialog(web_contents);
|
||||
const bool is_print_preview_dialog = IsPrintPreviewDialog(web_contents);
|
||||
if (is_print_preview_dialog) {
|
||||
return true;
|
||||
}
|
||||
|
@ -777,8 +773,8 @@ void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(
|
|||
// - When the PDF renderer is loaded in the print preview dialog. There will
|
||||
// be no RFH in this case.
|
||||
// Any additional cases should be debugged and, if possible,
|
||||
// extensions::GetOwnerForGuestContents should be improved to find the
|
||||
// associated CefBrowserHost.
|
||||
// GetOwnerForGuestContents should be improved to find the associated
|
||||
// CefBrowserHost.
|
||||
const bool has_rfh =
|
||||
!!content::RenderFrameHost::FromFrameToken(global_token);
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#include "cef/libcef/browser/browser_platform_delegate.h"
|
||||
#include "cef/libcef/browser/chrome/chrome_browser_context.h"
|
||||
#include "cef/libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||
#include "cef/libcef/browser/chrome/chrome_devtools_window_runner.h"
|
||||
#include "cef/libcef/browser/chrome/views/chrome_browser_view.h"
|
||||
#include "cef/libcef/browser/chrome/views/chrome_child_window.h"
|
||||
#include "cef/libcef/browser/devtools/devtools_window_runner.h"
|
||||
#include "cef/libcef/browser/hang_monitor.h"
|
||||
#include "cef/libcef/browser/media_access_query.h"
|
||||
#include "cef/libcef/browser/request_context_impl.h"
|
||||
|
@ -98,8 +98,7 @@ Browser* ChromeBrowserDelegate::CreateDevToolsBrowser(
|
|||
CefBrowserCreateParams create_params;
|
||||
CefWindowInfo window_info;
|
||||
|
||||
auto* devtools_window_runner = static_cast<ChromeDevToolsWindowRunner*>(
|
||||
opener_browser_host->GetDevToolsWindowRunner());
|
||||
auto* devtools_window_runner = opener_browser_host->GetDevToolsWindowRunner();
|
||||
auto pending_show_devtools_params =
|
||||
devtools_window_runner->TakePendingParams();
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "cef/libcef/browser/chrome/chrome_startup_browser_creator.h"
|
||||
#include "cef/libcef/browser/context.h"
|
||||
#include "cef/libcef/browser/file_dialog_runner.h"
|
||||
#include "cef/libcef/browser/net/chrome_scheme_handler.h"
|
||||
#include "cef/libcef/browser/permission_prompt.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
|
||||
|
@ -68,7 +67,6 @@ void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() {
|
|||
{base::TaskPriority::USER_BLOCKING,
|
||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||
|
||||
scheme::RegisterWebUIControllerFactory();
|
||||
context_menu::RegisterCallbacks();
|
||||
file_dialog_runner::RegisterFactory();
|
||||
permission_prompt::RegisterCreateCallback();
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "cef/libcef/browser/certificate_query.h"
|
||||
#include "cef/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h"
|
||||
#include "cef/libcef/browser/context.h"
|
||||
#include "cef/libcef/browser/net/chrome_scheme_handler.h"
|
||||
#include "cef/libcef/browser/net/throttle_handler.h"
|
||||
#include "cef/libcef/browser/net_service/cookie_manager_impl.h"
|
||||
#include "cef/libcef/browser/net_service/login_delegate.h"
|
||||
|
@ -466,18 +465,6 @@ ChromeContentBrowserClientCef::CreateLoginDelegate(
|
|||
std::move(auth_required_callback));
|
||||
}
|
||||
|
||||
void ChromeContentBrowserClientCef::BrowserURLHandlerCreated(
|
||||
content::BrowserURLHandler* handler) {
|
||||
// Register the Chrome handlers first for proper URL rewriting.
|
||||
ChromeContentBrowserClient::BrowserURLHandlerCreated(handler);
|
||||
scheme::BrowserURLHandlerCreated(handler);
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClientCef::IsWebUIAllowedToMakeNetworkRequests(
|
||||
const url::Origin& origin) {
|
||||
return scheme::IsWebUIAllowedToMakeNetworkRequests(origin);
|
||||
}
|
||||
|
||||
void ChromeContentBrowserClientCef::ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
|
|
|
@ -121,8 +121,6 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
|||
scoped_refptr<net::HttpResponseHeaders> response_headers,
|
||||
bool first_auth_attempt,
|
||||
LoginAuthRequiredCallback auth_required_callback) override;
|
||||
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
|
||||
bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) override;
|
||||
void ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright 2024 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_BROWSER_CHROME_CHROME_DEVTOOLS_WINDOW_RUNNER_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_CHROME_DEVTOOLS_WINDOW_RUNNER_H_
|
||||
#pragma once
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "cef/libcef/browser/devtools/devtools_window_runner.h"
|
||||
|
||||
class ChromeBrowserHostImpl;
|
||||
|
||||
// Creates and runs a DevTools window instance. Only accessed on the UI thread.
|
||||
class ChromeDevToolsWindowRunner : public CefDevToolsWindowRunner {
|
||||
public:
|
||||
ChromeDevToolsWindowRunner() = default;
|
||||
|
||||
ChromeDevToolsWindowRunner(const ChromeDevToolsWindowRunner&) = delete;
|
||||
ChromeDevToolsWindowRunner& operator=(const ChromeDevToolsWindowRunner&) =
|
||||
delete;
|
||||
|
||||
// CefDevToolsWindowRunner methods:
|
||||
void ShowDevTools(CefBrowserHostBase* opener,
|
||||
std::unique_ptr<CefShowDevToolsParams> params) override;
|
||||
void CloseDevTools() override;
|
||||
bool HasDevTools() override;
|
||||
|
||||
std::unique_ptr<CefShowDevToolsParams> TakePendingParams();
|
||||
|
||||
void SetDevToolsBrowserHost(
|
||||
base::WeakPtr<ChromeBrowserHostImpl> browser_host);
|
||||
|
||||
private:
|
||||
std::unique_ptr<CefShowDevToolsParams> pending_params_;
|
||||
|
||||
base::WeakPtr<ChromeBrowserHostImpl> browser_host_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_DEVTOOLS_WINDOW_RUNNER_H_
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (c) 2019 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2013 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 "build/build_config.h"
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
|
||||
#include "chrome/app/chrome_crash_reporter_client.h"
|
||||
|
||||
// Required due to https://crrev.com/1c9f89a06f
|
||||
void ChromeCrashReporterClient::Create() {}
|
||||
|
||||
#endif // BUILDFLAG(IS_MAC)
|
|
@ -2,14 +2,14 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cef/libcef/browser/chrome/chrome_devtools_window_runner.h"
|
||||
#include "cef/libcef/browser/devtools/devtools_window_runner.h"
|
||||
|
||||
#include "cef/libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||
#include "cef/libcef/browser/request_context_impl.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "chrome/browser/devtools/devtools_window.h"
|
||||
|
||||
void ChromeDevToolsWindowRunner::ShowDevTools(
|
||||
void CefDevToolsWindowRunner::ShowDevTools(
|
||||
CefBrowserHostBase* opener,
|
||||
std::unique_ptr<CefShowDevToolsParams> params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
@ -46,7 +46,7 @@ void ChromeDevToolsWindowRunner::ShowDevTools(
|
|||
DCHECK(browser_host_);
|
||||
}
|
||||
|
||||
void ChromeDevToolsWindowRunner::CloseDevTools() {
|
||||
void CefDevToolsWindowRunner::CloseDevTools() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (browser_host_) {
|
||||
browser_host_->TryCloseBrowser();
|
||||
|
@ -54,18 +54,18 @@ void ChromeDevToolsWindowRunner::CloseDevTools() {
|
|||
}
|
||||
}
|
||||
|
||||
bool ChromeDevToolsWindowRunner::HasDevTools() {
|
||||
bool CefDevToolsWindowRunner::HasDevTools() {
|
||||
CEF_REQUIRE_UIT();
|
||||
return !!browser_host_;
|
||||
}
|
||||
|
||||
std::unique_ptr<CefShowDevToolsParams>
|
||||
ChromeDevToolsWindowRunner::TakePendingParams() {
|
||||
CefDevToolsWindowRunner::TakePendingParams() {
|
||||
CEF_REQUIRE_UIT();
|
||||
return std::move(pending_params_);
|
||||
}
|
||||
|
||||
void ChromeDevToolsWindowRunner::SetDevToolsBrowserHost(
|
||||
void CefDevToolsWindowRunner::SetDevToolsBrowserHost(
|
||||
base::WeakPtr<ChromeBrowserHostImpl> browser_host) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!browser_host_);
|
|
@ -8,9 +8,11 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "cef/include/cef_client.h"
|
||||
|
||||
class CefBrowserHostBase;
|
||||
class ChromeBrowserHostImpl;
|
||||
|
||||
// Parameters passed to ShowDevTools.
|
||||
struct CefShowDevToolsParams {
|
||||
|
@ -30,18 +32,28 @@ struct CefShowDevToolsParams {
|
|||
};
|
||||
|
||||
// Creates and runs a DevTools window instance. Only accessed on the UI thread.
|
||||
class CefDevToolsWindowRunner {
|
||||
class CefDevToolsWindowRunner final {
|
||||
public:
|
||||
// Creates the appropriate runner type based on the current runtime.
|
||||
static std::unique_ptr<CefDevToolsWindowRunner> Create();
|
||||
CefDevToolsWindowRunner() = default;
|
||||
|
||||
// See documentation on CefBrowserHost methods of the same name.
|
||||
virtual void ShowDevTools(CefBrowserHostBase* opener,
|
||||
std::unique_ptr<CefShowDevToolsParams> params) = 0;
|
||||
virtual void CloseDevTools() = 0;
|
||||
virtual bool HasDevTools() = 0;
|
||||
CefDevToolsWindowRunner(const CefDevToolsWindowRunner&) = delete;
|
||||
CefDevToolsWindowRunner& operator=(const CefDevToolsWindowRunner&) =
|
||||
delete;
|
||||
|
||||
virtual ~CefDevToolsWindowRunner() = default;
|
||||
void ShowDevTools(CefBrowserHostBase* opener,
|
||||
std::unique_ptr<CefShowDevToolsParams> params);
|
||||
void CloseDevTools();
|
||||
bool HasDevTools();
|
||||
|
||||
std::unique_ptr<CefShowDevToolsParams> TakePendingParams();
|
||||
|
||||
void SetDevToolsBrowserHost(
|
||||
base::WeakPtr<ChromeBrowserHostImpl> browser_host);
|
||||
|
||||
private:
|
||||
std::unique_ptr<CefShowDevToolsParams> pending_params_;
|
||||
|
||||
base::WeakPtr<ChromeBrowserHostImpl> browser_host_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_RUNNER_H_
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright 2024 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 "cef/libcef/browser/chrome/chrome_devtools_window_runner.h"
|
||||
#include "cef/libcef/browser/devtools/devtools_window_runner.h"
|
||||
|
||||
// static
|
||||
std::unique_ptr<CefDevToolsWindowRunner> CefDevToolsWindowRunner::Create() {
|
||||
return std::make_unique<ChromeDevToolsWindowRunner>();
|
||||
}
|
|
@ -10,8 +10,8 @@
|
|||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/logging.h"
|
||||
#include "cef/libcef/browser/browser_guest_util.h"
|
||||
#include "cef/libcef/browser/browser_host_base.h"
|
||||
#include "cef/libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "components/javascript_dialogs/tab_modal_dialog_manager.h"
|
||||
|
||||
|
@ -71,8 +71,7 @@ javascript_dialogs::TabModalDialogManager* GetTabModalDialogManager(
|
|||
// Try the owner WebContents if the dialog originates from an excluded view
|
||||
// such as the PDF viewer or Print Preview. This is safe to call even if Alloy
|
||||
// extensions are disabled.
|
||||
if (auto* owner_contents =
|
||||
extensions::GetOwnerForGuestContents(web_contents)) {
|
||||
if (auto* owner_contents = GetOwnerForGuestContents(web_contents)) {
|
||||
return javascript_dialogs::TabModalDialogManager::FromWebContents(
|
||||
owner_contents);
|
||||
}
|
||||
|
|
|
@ -5,40 +5,31 @@
|
|||
|
||||
#include "cef/libcef/browser/main_runner.h"
|
||||
|
||||
#include "base/at_exit.h"
|
||||
#include "base/base_switches.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/debug/debugger.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/threading/thread.h"
|
||||
#include "cef/libcef/browser/browser_message_loop.h"
|
||||
#include "cef/libcef/browser/chrome/chrome_content_browser_client_cef.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "cef/libcef/common/app_manager.h"
|
||||
#include "cef/libcef/common/cef_switches.h"
|
||||
#include "cef/libcef/common/chrome/chrome_main_runner_delegate.h"
|
||||
#include "chrome/browser/browser_process_impl.h"
|
||||
#include "chrome/browser/chrome_process_singleton.h"
|
||||
#include "chrome/common/chrome_result_codes.h"
|
||||
#include "components/crash/core/app/crash_switches.h"
|
||||
#include "components/keep_alive_registry/keep_alive_types.h"
|
||||
#include "components/metrics/persistent_system_profile.h"
|
||||
#include "content/app/content_main_runner_impl.h"
|
||||
#include "content/browser/scheduler/browser_task_executor.h"
|
||||
#include "content/public/app/content_main.h"
|
||||
#include "content/public/app/content_main_runner.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "third_party/crashpad/crashpad/handler/handler_main.h"
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#include "ui/base/ozone_buildflags.h"
|
||||
#if BUILDFLAG(IS_OZONE_X11)
|
||||
#include "ui/ozone/platform/x11/ozone_platform_x11.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include <Objbase.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <memory>
|
||||
|
@ -49,21 +40,6 @@
|
|||
|
||||
namespace {
|
||||
|
||||
enum class RuntimeType {
|
||||
UNINITIALIZED,
|
||||
CHROME,
|
||||
};
|
||||
RuntimeType g_runtime_type = RuntimeType::UNINITIALIZED;
|
||||
|
||||
std::unique_ptr<CefMainRunnerDelegate> MakeDelegate(
|
||||
CefMainRunnerHandler* runner,
|
||||
CefSettings* settings,
|
||||
CefRefPtr<CefApp> application) {
|
||||
g_runtime_type = RuntimeType::CHROME;
|
||||
return std::make_unique<ChromeMainRunnerDelegate>(runner, settings,
|
||||
application);
|
||||
}
|
||||
|
||||
// Based on components/crash/core/app/run_as_crashpad_handler_win.cc
|
||||
// Remove the "--type=crashpad-handler" command-line flag that will otherwise
|
||||
// confuse the crashpad handler.
|
||||
|
@ -110,148 +86,19 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
|||
|
||||
} // namespace
|
||||
|
||||
// Used to run the UI on a separate thread.
|
||||
class CefUIThread : public base::PlatformThread::Delegate {
|
||||
public:
|
||||
CefUIThread(CefMainRunner* runner, base::OnceClosure setup_callback)
|
||||
: runner_(runner), setup_callback_(std::move(setup_callback)) {}
|
||||
~CefUIThread() override { Stop(); }
|
||||
|
||||
void Start() {
|
||||
base::AutoLock lock(thread_lock_);
|
||||
bool success = base::PlatformThread::CreateWithType(
|
||||
0, this, &thread_, base::ThreadType::kDefault);
|
||||
if (!success) {
|
||||
LOG(FATAL) << "failed to UI create thread";
|
||||
}
|
||||
}
|
||||
|
||||
void Stop() {
|
||||
base::AutoLock lock(thread_lock_);
|
||||
|
||||
if (!stopping_) {
|
||||
stopping_ = true;
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefMainRunner::QuitMessageLoop,
|
||||
base::Unretained(runner_)));
|
||||
}
|
||||
|
||||
// Can't join if the |thread_| is either already gone or is non-joinable.
|
||||
if (thread_.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
base::PlatformThread::Join(thread_);
|
||||
thread_ = base::PlatformThreadHandle();
|
||||
|
||||
stopping_ = false;
|
||||
}
|
||||
|
||||
bool WaitUntilThreadStarted() const {
|
||||
DCHECK(owning_sequence_checker_.CalledOnValidSequence());
|
||||
start_event_.Wait();
|
||||
return true;
|
||||
}
|
||||
|
||||
void InitializeBrowserRunner(
|
||||
content::MainFunctionParams main_function_params) {
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#if BUILDFLAG(IS_OZONE_X11)
|
||||
// Disable creation of GtkUi (interface to GTK desktop features) and cause
|
||||
// ui::GetDefaultLinuxUi() (and related functions) to return nullptr. We
|
||||
// can't use GtkUi in combination with multi-threaded-message-loop because
|
||||
// Chromium's GTK implementation doesn't use GDK threads. Light/dark theme
|
||||
// changes will still be detected via DarkModeManagerLinux.
|
||||
ui::SetMultiThreadedMessageLoopX11();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Use our own browser process runner.
|
||||
browser_runner_ = content::BrowserMainRunner::Create();
|
||||
|
||||
// Initialize browser process state. Uses the current thread's message loop.
|
||||
int exit_code =
|
||||
browser_runner_->Initialize(std::move(main_function_params));
|
||||
CHECK_EQ(exit_code, -1);
|
||||
}
|
||||
|
||||
void set_shutdown_callback(base::OnceClosure shutdown_callback) {
|
||||
shutdown_callback_ = std::move(shutdown_callback);
|
||||
}
|
||||
|
||||
protected:
|
||||
void ThreadMain() override {
|
||||
base::PlatformThread::SetName("CefUIThread");
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Initializes the COM library on the current thread.
|
||||
CoInitialize(nullptr);
|
||||
#endif
|
||||
|
||||
start_event_.Signal();
|
||||
|
||||
std::move(setup_callback_).Run();
|
||||
|
||||
runner_->RunMessageLoop();
|
||||
|
||||
// Stop may be called before InitializeBrowserRunner if
|
||||
// content::ContentMainRun was not successful (for example, due to process
|
||||
// singleton relaunch).
|
||||
if (browser_runner_) {
|
||||
browser_runner_->Shutdown();
|
||||
browser_runner_.reset();
|
||||
}
|
||||
|
||||
// This will be a no-op if there is no BrowserTaskExecutor.
|
||||
content::BrowserTaskExecutor::Shutdown();
|
||||
|
||||
if (!shutdown_callback_.is_null()) {
|
||||
std::move(shutdown_callback_).Run();
|
||||
}
|
||||
|
||||
// Run exit callbacks on the UI thread to avoid sequence check failures.
|
||||
base::AtExitManager::ProcessCallbacksNow();
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Closes the COM library on the current thread. CoInitialize must
|
||||
// be balanced by a corresponding call to CoUninitialize.
|
||||
CoUninitialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
const raw_ptr<CefMainRunner> runner_;
|
||||
base::OnceClosure setup_callback_;
|
||||
base::OnceClosure shutdown_callback_;
|
||||
|
||||
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
|
||||
|
||||
bool stopping_ = false;
|
||||
|
||||
// The thread's handle.
|
||||
base::PlatformThreadHandle thread_;
|
||||
mutable base::Lock thread_lock_; // Protects |thread_|.
|
||||
|
||||
mutable base::WaitableEvent start_event_;
|
||||
|
||||
// This class is not thread-safe, use this to verify access from the owning
|
||||
// sequence of the Thread.
|
||||
base::SequenceChecker owning_sequence_checker_;
|
||||
};
|
||||
|
||||
CefMainRunner::CefMainRunner(bool multi_threaded_message_loop,
|
||||
bool external_message_pump)
|
||||
: multi_threaded_message_loop_(multi_threaded_message_loop),
|
||||
external_message_pump_(external_message_pump) {}
|
||||
|
||||
CefMainRunner::~CefMainRunner() = default;
|
||||
|
||||
bool CefMainRunner::Initialize(CefSettings* settings,
|
||||
CefRefPtr<CefApp> application,
|
||||
const CefMainArgs& args,
|
||||
void* windows_sandbox_info,
|
||||
bool* initialized,
|
||||
base::OnceClosure context_initialized) {
|
||||
DCHECK(!main_delegate_);
|
||||
main_delegate_ = MakeDelegate(this, settings, application);
|
||||
settings_ = settings;
|
||||
application_ = application;
|
||||
|
||||
exit_code_ =
|
||||
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox);
|
||||
|
@ -294,8 +141,6 @@ void CefMainRunner::Shutdown(base::OnceClosure shutdown_on_ui_thread,
|
|||
ui_thread_.reset();
|
||||
}
|
||||
|
||||
main_delegate_->BeforeMainThreadShutdown();
|
||||
|
||||
if (!multi_threaded_message_loop_) {
|
||||
// Main thread and UI thread are the same.
|
||||
StartShutdownOnUIThread(std::move(shutdown_on_ui_thread));
|
||||
|
@ -312,10 +157,12 @@ void CefMainRunner::Shutdown(base::OnceClosure shutdown_on_ui_thread,
|
|||
main_runner_.reset();
|
||||
|
||||
std::move(finalize_shutdown).Run();
|
||||
main_delegate_->AfterMainThreadShutdown();
|
||||
|
||||
main_delegate_.reset();
|
||||
g_runtime_type = RuntimeType::UNINITIALIZED;
|
||||
sampling_profiler_.reset();
|
||||
keep_alive_.reset();
|
||||
settings_ = nullptr;
|
||||
application_ = nullptr;
|
||||
}
|
||||
|
||||
void CefMainRunner::RunMessageLoop() {
|
||||
|
@ -324,7 +171,21 @@ void CefMainRunner::RunMessageLoop() {
|
|||
DCHECK(quit_callback_.is_null());
|
||||
quit_callback_ = run_loop.QuitClosure();
|
||||
|
||||
main_delegate_->BeforeMainMessageLoopRun(&run_loop);
|
||||
// May be nullptr if content::ContentMainRun exits early.
|
||||
if (g_browser_process) {
|
||||
// The ScopedKeepAlive instance triggers shutdown logic when released on the
|
||||
// UI thread before terminating the message loop (e.g. from
|
||||
// CefQuitMessageLoop or FinishShutdownOnUIThread when running with
|
||||
// multi-threaded message loop).
|
||||
keep_alive_ = std::make_unique<ScopedKeepAlive>(
|
||||
KeepAliveOrigin::APP_CONTROLLER, KeepAliveRestartOption::DISABLED);
|
||||
|
||||
// The QuitClosure will be executed from BrowserProcessImpl::Unpin() via
|
||||
// KeepAliveRegistry when the last ScopedKeepAlive is released.
|
||||
// ScopedKeepAlives are also held by Browser objects.
|
||||
static_cast<BrowserProcessImpl*>(g_browser_process)
|
||||
->SetQuitClosure(run_loop.QuitClosure());
|
||||
}
|
||||
|
||||
// Blocks until QuitMessageLoop() is called.
|
||||
run_loop.Run();
|
||||
|
@ -332,7 +193,7 @@ void CefMainRunner::RunMessageLoop() {
|
|||
|
||||
void CefMainRunner::QuitMessageLoop() {
|
||||
if (!quit_callback_.is_null()) {
|
||||
if (main_delegate_->HandleMainMessageLoopQuit()) {
|
||||
if (HandleMainMessageLoopQuit()) {
|
||||
return;
|
||||
}
|
||||
std::move(quit_callback_).Run();
|
||||
|
@ -363,21 +224,16 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
|
|||
return -1;
|
||||
}
|
||||
|
||||
auto main_delegate = MakeDelegate(
|
||||
auto main_delegate = std::make_unique<ChromeMainDelegateCef>(
|
||||
/*runner=*/nullptr, /*settings=*/nullptr, application);
|
||||
main_delegate->BeforeExecuteProcess(args);
|
||||
|
||||
int result;
|
||||
BeforeMainInitialize(args);
|
||||
|
||||
if (process_type == crash_reporter::switches::kCrashpadHandler) {
|
||||
result = RunAsCrashpadHandler(command_line);
|
||||
main_delegate->AfterExecuteProcess();
|
||||
return result;
|
||||
return RunAsCrashpadHandler(command_line);
|
||||
}
|
||||
|
||||
// Execute the secondary process.
|
||||
content::ContentMainParams main_params(
|
||||
main_delegate->GetContentMainDelegate());
|
||||
content::ContentMainParams main_params(main_delegate.get());
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
sandbox::SandboxInterfaceInfo sandbox_info = {nullptr};
|
||||
if (windows_sandbox_info == nullptr) {
|
||||
|
@ -392,22 +248,20 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
|
|||
main_params.argc = args.argc;
|
||||
main_params.argv = const_cast<const char**>(args.argv);
|
||||
#endif
|
||||
result = content::ContentMain(std::move(main_params));
|
||||
|
||||
main_delegate->AfterExecuteProcess();
|
||||
|
||||
return result;
|
||||
return content::ContentMain(std::move(main_params));
|
||||
}
|
||||
|
||||
int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
|
||||
void* windows_sandbox_info,
|
||||
int* no_sandbox) {
|
||||
main_delegate_->BeforeMainThreadInitialize(args);
|
||||
BeforeMainInitialize(args);
|
||||
|
||||
main_delegate_ =
|
||||
std::make_unique<ChromeMainDelegateCef>(this, settings_, application_);
|
||||
|
||||
// Initialize the content runner.
|
||||
main_runner_ = content::ContentMainRunner::Create();
|
||||
content::ContentMainParams main_params(
|
||||
main_delegate_->GetContentMainDelegate());
|
||||
content::ContentMainParams main_params(main_delegate_.get());
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
sandbox::SandboxInterfaceInfo sandbox_info = {nullptr};
|
||||
|
@ -430,7 +284,12 @@ int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
|
|||
|
||||
int CefMainRunner::ContentMainRun(bool* initialized,
|
||||
base::OnceClosure context_initialized) {
|
||||
main_delegate_->BeforeMainThreadRun(multi_threaded_message_loop_);
|
||||
if (multi_threaded_message_loop_) {
|
||||
// Detach from the main thread so that these objects can be attached and
|
||||
// modified from the UI thread going forward.
|
||||
metrics::GlobalPersistentSystemProfile::GetInstance()
|
||||
->DetachFromCurrentThread();
|
||||
}
|
||||
|
||||
int exit_code = -1;
|
||||
|
||||
|
@ -446,7 +305,7 @@ int CefMainRunner::ContentMainRun(bool* initialized,
|
|||
if (!CreateUIThread(base::BindOnce(
|
||||
[](CefMainRunner* runner, base::WaitableEvent* event,
|
||||
int* exit_code) {
|
||||
runner->main_delegate_->BeforeUIThreadInitialize();
|
||||
runner->BeforeUIThreadInitialize();
|
||||
*exit_code = content::ContentMainRun(runner->main_runner_.get());
|
||||
|
||||
if (*exit_code != content::RESULT_CODE_NORMAL_EXIT) {
|
||||
|
@ -473,7 +332,7 @@ int CefMainRunner::ContentMainRun(bool* initialized,
|
|||
}
|
||||
} else {
|
||||
*initialized = true;
|
||||
main_delegate_->BeforeUIThreadInitialize();
|
||||
BeforeUIThreadInitialize();
|
||||
exit_code = content::ContentMainRun(main_runner_.get());
|
||||
}
|
||||
|
||||
|
@ -493,6 +352,30 @@ int CefMainRunner::ContentMainRun(bool* initialized,
|
|||
return exit_code;
|
||||
}
|
||||
|
||||
// static
|
||||
void CefMainRunner::BeforeMainInitialize(const CefMainArgs& args) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
base::CommandLine::Init(0, nullptr);
|
||||
#else
|
||||
base::CommandLine::Init(args.argc, args.argv);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CefMainRunner::HandleMainMessageLoopQuit() {
|
||||
// May be nullptr if content::ContentMainRun exits early.
|
||||
if (!g_browser_process) {
|
||||
// Proceed with direct execution of the QuitClosure().
|
||||
return false;
|
||||
}
|
||||
|
||||
// May be called multiple times. See comments in RunMainMessageLoopBefore.
|
||||
keep_alive_.reset();
|
||||
|
||||
// Cancel direct execution of the QuitClosure() in QuitMessageLoop. We
|
||||
// instead wait for all Chrome browser windows to exit.
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefMainRunner::PreBrowserMain() {
|
||||
if (external_message_pump_) {
|
||||
InitExternalMessagePumpFactoryForUI();
|
||||
|
@ -506,8 +389,7 @@ int CefMainRunner::RunMainProcess(
|
|||
browser_runner_ = content::BrowserMainRunner::Create();
|
||||
|
||||
// Initialize browser process state. Results in a call to
|
||||
// AlloyBrowserMain::PreBrowserMain() which creates the UI message
|
||||
// loop.
|
||||
// PreBrowserMain() which creates the UI message loop.
|
||||
int exit_code =
|
||||
browser_runner_->Initialize(std::move(main_function_params));
|
||||
if (exit_code >= 0) {
|
||||
|
@ -539,7 +421,6 @@ void CefMainRunner::OnContextInitialized(
|
|||
base::OnceClosure context_initialized) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
main_delegate_->AfterUIThreadInitialize();
|
||||
std::move(context_initialized).Run();
|
||||
}
|
||||
|
||||
|
@ -561,18 +442,26 @@ void CefMainRunner::StartShutdownOnUIThread(
|
|||
->ShutdownOnUIThread();
|
||||
|
||||
std::move(shutdown_on_ui_thread).Run();
|
||||
main_delegate_->BeforeUIThreadShutdown();
|
||||
BeforeUIThreadShutdown();
|
||||
}
|
||||
|
||||
void CefMainRunner::FinishShutdownOnUIThread() {
|
||||
main_delegate_->AfterUIThreadShutdown();
|
||||
if (multi_threaded_message_loop_) {
|
||||
// Don't wait for this to be called in ChromeMainDelegate::ProcessExiting.
|
||||
// It is safe to call multiple times.
|
||||
ChromeProcessSingleton::DeleteInstance();
|
||||
}
|
||||
}
|
||||
|
||||
// From libcef/features/runtime.h:
|
||||
namespace cef {
|
||||
|
||||
bool IsChromeRuntimeEnabled() {
|
||||
return g_runtime_type == RuntimeType::CHROME;
|
||||
void CefMainRunner::BeforeUIThreadInitialize() {
|
||||
sampling_profiler_ = std::make_unique<MainThreadStackSamplingProfiler>();
|
||||
}
|
||||
|
||||
} // namespace cef
|
||||
void CefMainRunner::BeforeUIThreadShutdown() {
|
||||
static_cast<ChromeContentBrowserClientCef*>(
|
||||
CefAppManager::Get()->GetContentClient()->browser())
|
||||
->CleanupOnUIThread();
|
||||
main_delegate_->CleanupOnUIThread();
|
||||
|
||||
sampling_profiler_.reset();
|
||||
}
|
||||
|
|
|
@ -7,32 +7,30 @@
|
|||
#define CEF_LIBCEF_BROWSER_MAIN_RUNNER_H_
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "cef/include/cef_app.h"
|
||||
#include "cef/libcef/common/main_runner_delegate.h"
|
||||
#include "cef/libcef/common/main_runner_handler.h"
|
||||
#include "cef/libcef/browser/ui_thread.h"
|
||||
#include "cef/libcef/common/chrome/chrome_main_delegate_cef.h"
|
||||
#include "chrome/common/profiler/main_thread_stack_sampling_profiler.h"
|
||||
#include "components/keep_alive_registry/scoped_keep_alive.h"
|
||||
#include "content/public/app/content_main_runner.h"
|
||||
#include "content/public/browser/browser_main_runner.h"
|
||||
|
||||
namespace base {
|
||||
class WaitableEvent;
|
||||
}
|
||||
|
||||
namespace content {
|
||||
class ContentMainRunner;
|
||||
} // namespace content
|
||||
|
||||
class CefUIThread;
|
||||
|
||||
// Manages the main process lifespan and related objects.
|
||||
class CefMainRunner : public CefMainRunnerHandler {
|
||||
class CefMainRunner final {
|
||||
public:
|
||||
CefMainRunner(bool multi_threaded_message_loop, bool external_message_pump);
|
||||
|
||||
CefMainRunner(const CefMainRunner&) = delete;
|
||||
CefMainRunner& operator=(const CefMainRunner&) = delete;
|
||||
|
||||
~CefMainRunner() override;
|
||||
|
||||
// Called from CefContext::Initialize.
|
||||
bool Initialize(CefSettings* settings,
|
||||
CefRefPtr<CefApp> application,
|
||||
|
@ -56,6 +54,10 @@ class CefMainRunner : public CefMainRunnerHandler {
|
|||
CefRefPtr<CefApp> application,
|
||||
void* windows_sandbox_info);
|
||||
|
||||
// Called from ChromeMainDelegateCef.
|
||||
void PreBrowserMain();
|
||||
int RunMainProcess(content::MainFunctionParams main_function_params);
|
||||
|
||||
private:
|
||||
// Called from Initialize().
|
||||
int ContentMainInitialize(const CefMainArgs& args,
|
||||
|
@ -63,9 +65,8 @@ class CefMainRunner : public CefMainRunnerHandler {
|
|||
int* no_sandbox);
|
||||
int ContentMainRun(bool* initialized, base::OnceClosure context_initialized);
|
||||
|
||||
// CefMainRunnerHandler methods:
|
||||
void PreBrowserMain() override;
|
||||
int RunMainProcess(content::MainFunctionParams main_function_params) override;
|
||||
static void BeforeMainInitialize(const CefMainArgs& args);
|
||||
bool HandleMainMessageLoopQuit();
|
||||
|
||||
// Create the UI thread when running with multi-threaded message loop mode.
|
||||
bool CreateUIThread(base::OnceClosure setup_callback);
|
||||
|
@ -81,10 +82,12 @@ class CefMainRunner : public CefMainRunnerHandler {
|
|||
// thread RunLoop has stopped and before running exit callbacks.
|
||||
void FinishShutdownOnUIThread();
|
||||
|
||||
void BeforeUIThreadInitialize();
|
||||
void BeforeUIThreadShutdown();
|
||||
|
||||
const bool multi_threaded_message_loop_;
|
||||
const bool external_message_pump_;
|
||||
|
||||
std::unique_ptr<CefMainRunnerDelegate> main_delegate_;
|
||||
std::unique_ptr<content::ContentMainRunner> main_runner_;
|
||||
|
||||
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
|
||||
|
@ -94,6 +97,14 @@ class CefMainRunner : public CefMainRunnerHandler {
|
|||
base::OnceClosure quit_callback_;
|
||||
|
||||
int exit_code_ = -1;
|
||||
|
||||
std::unique_ptr<ChromeMainDelegateCef> main_delegate_;
|
||||
|
||||
std::unique_ptr<MainThreadStackSamplingProfiler> sampling_profiler_;
|
||||
std::unique_ptr<ScopedKeepAlive> keep_alive_;
|
||||
|
||||
raw_ptr<CefSettings> settings_ = nullptr;
|
||||
CefRefPtr<CefApp> application_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MAIN_RUNNER_H_
|
||||
|
|
|
@ -1,639 +0,0 @@
|
|||
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2012 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 "cef/libcef/browser/net/chrome_scheme_handler.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "cef/grit/cef_resources.h"
|
||||
#include "cef/include/cef_version.h"
|
||||
#include "cef/libcef/browser/frame_host_impl.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "cef/libcef/common/app_manager.h"
|
||||
#include "chrome/browser/browser_about_handler.h"
|
||||
#include "chrome/browser/devtools/devtools_ui_bindings.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/webui/chrome_untrusted_web_ui_configs.h"
|
||||
#include "chrome/browser/ui/webui/chrome_web_ui_configs.h"
|
||||
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
|
||||
#include "chrome/browser/ui/webui/theme_source.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/url_constants.h"
|
||||
#include "content/browser/renderer_host/debug_urls.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/web_ui_controller.h"
|
||||
#include "content/public/browser/webui_config_map.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/url_utils.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "third_party/blink/public/common/chrome_debug_urls.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
namespace scheme {
|
||||
|
||||
const char kChromeURL[] = "chrome://";
|
||||
|
||||
namespace {
|
||||
|
||||
const char kChromeUIExtensionsSupportHost[] = "extensions-support";
|
||||
const char kChromeUILicenseHost[] = "license";
|
||||
const char kChromeUIWebUIHostsHost[] = "webui-hosts";
|
||||
|
||||
// TODO(network): Consider handling content::kChromeDevToolsScheme via WebUI
|
||||
// (DevToolsUI class) with the following changes:
|
||||
// 1. Add an entry for content::kChromeDevToolsScheme in
|
||||
// AlloyContentBrowserClient::GetAdditionalWebUISchemes.
|
||||
// 2. Allow the scheme in CefWebUIControllerFactory::AllowWebUIForURL.
|
||||
// 3. Add an entry for chrome::kChromeUIDevToolsHost in kAllowedWebUIHosts and
|
||||
// kUnlistedHosts.
|
||||
// 4. Remove scheme::RegisterInternalHandlers and related plumbing.
|
||||
|
||||
// Chrome hosts implemented by WebUI.
|
||||
// Some WebUI handlers have Chrome dependencies that may fail in CEF without
|
||||
// additional changes. Do not add new hosts to this list without also manually
|
||||
// testing all related functionality in CEF.
|
||||
const char* kAllowedWebUIHosts[] = {
|
||||
chrome::kChromeUIAccessibilityHost,
|
||||
content::kChromeUIBlobInternalsHost,
|
||||
chrome::kChromeUIChromeURLsHost,
|
||||
chrome::kChromeUICreditsHost,
|
||||
kChromeUIExtensionsSupportHost,
|
||||
content::kChromeUIGpuHost,
|
||||
content::kChromeUIHistogramHost,
|
||||
content::kChromeUIIndexedDBInternalsHost,
|
||||
kChromeUILicenseHost,
|
||||
content::kChromeUIMediaInternalsHost,
|
||||
chrome::kChromeUINetExportHost,
|
||||
chrome::kChromeUINetInternalsHost,
|
||||
content::kChromeUINetworkErrorHost,
|
||||
content::kChromeUINetworkErrorsListingHost,
|
||||
chrome::kChromeUIPrintHost,
|
||||
content::kChromeUIProcessInternalsHost,
|
||||
content::kChromeUIResourcesHost,
|
||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
|
||||
chrome::kChromeUISandboxHost,
|
||||
#endif
|
||||
content::kChromeUIServiceWorkerInternalsHost,
|
||||
chrome::kChromeUISystemInfoHost,
|
||||
chrome::kChromeUIThemeHost,
|
||||
content::kChromeUITracingHost,
|
||||
chrome::kChromeUIVersionHost,
|
||||
content::kChromeUIWebRTCInternalsHost,
|
||||
kChromeUIWebUIHostsHost,
|
||||
};
|
||||
|
||||
// Hosts that don't have useful output when linked directly. They'll be excluded
|
||||
// from the "chrome://webui-hosts" listing.
|
||||
const char* kUnlistedHosts[] = {
|
||||
content::kChromeUINetworkErrorHost,
|
||||
content::kChromeUIResourcesHost,
|
||||
chrome::kChromeUIThemeHost,
|
||||
};
|
||||
|
||||
enum ChromeHostId {
|
||||
CHROME_UNKNOWN = 0,
|
||||
CHROME_EXTENSIONS_SUPPORT,
|
||||
CHROME_LICENSE,
|
||||
CHROME_VERSION,
|
||||
CHROME_WEBUI_HOSTS,
|
||||
};
|
||||
|
||||
// Chrome hosts implemented by CEF.
|
||||
const struct {
|
||||
const char* host;
|
||||
ChromeHostId host_id;
|
||||
} kAllowedCefHosts[] = {
|
||||
{chrome::kChromeUIChromeURLsHost, CHROME_WEBUI_HOSTS},
|
||||
{kChromeUIExtensionsSupportHost, CHROME_EXTENSIONS_SUPPORT},
|
||||
{kChromeUILicenseHost, CHROME_LICENSE},
|
||||
{chrome::kChromeUIVersionHost, CHROME_VERSION},
|
||||
{kChromeUIWebUIHostsHost, CHROME_WEBUI_HOSTS},
|
||||
};
|
||||
|
||||
ChromeHostId GetChromeHostId(const std::string& host) {
|
||||
for (auto kAllowedCefHost : kAllowedCefHosts) {
|
||||
if (base::EqualsCaseInsensitiveASCII(kAllowedCefHost.host, host.c_str())) {
|
||||
return kAllowedCefHost.host_id;
|
||||
}
|
||||
}
|
||||
|
||||
return CHROME_UNKNOWN;
|
||||
}
|
||||
|
||||
// Returns WebUI hosts. Does not include chrome debug hosts (for crashing, etc).
|
||||
void GetAllowedHosts(std::vector<std::string>* hosts) {
|
||||
// Explicitly whitelisted WebUI hosts.
|
||||
for (auto& kAllowedWebUIHost : kAllowedWebUIHosts) {
|
||||
hosts->push_back(kAllowedWebUIHost);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns true if a host should not be listed on "chrome://webui-hosts".
|
||||
bool IsUnlistedHost(const std::string& host) {
|
||||
for (auto& kUnlistedHost : kUnlistedHosts) {
|
||||
if (host == kUnlistedHost) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Additional debug URLs that are not included in chrome::kChromeDebugURLs.
|
||||
const char* kAllowedDebugURLs[] = {
|
||||
blink::kChromeUIBrowserCrashURL,
|
||||
};
|
||||
|
||||
void GetDebugURLs(std::vector<std::string>* urls) {
|
||||
for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
urls->push_back(chrome::kChromeDebugURLs[i]);
|
||||
}
|
||||
|
||||
for (auto& kAllowedDebugURL : kAllowedDebugURLs) {
|
||||
urls->push_back(kAllowedDebugURL);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetOSType() {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
return "Windows";
|
||||
#elif BUILDFLAG(IS_MAC)
|
||||
return "Mac OS X";
|
||||
#elif BUILDFLAG(IS_LINUX)
|
||||
return "Linux";
|
||||
#else
|
||||
return "Unknown";
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string GetCommandLine() {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
return base::WideToUTF8(
|
||||
base::CommandLine::ForCurrentProcess()->GetCommandLineString());
|
||||
#elif BUILDFLAG(IS_POSIX)
|
||||
std::string command_line = "";
|
||||
using ArgvList = std::vector<std::string>;
|
||||
const ArgvList& argv = base::CommandLine::ForCurrentProcess()->argv();
|
||||
for (ArgvList::const_iterator iter = argv.begin(); iter != argv.end();
|
||||
iter++) {
|
||||
command_line += " " + *iter;
|
||||
}
|
||||
// TODO(viettrungluu): |command_line| could really have any encoding, whereas
|
||||
// below we assumes it's UTF-8.
|
||||
return command_line;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string GetModulePath() {
|
||||
base::FilePath path;
|
||||
if (base::PathService::Get(base::FILE_MODULE, &path)) {
|
||||
return CefString(path.value());
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
class TemplateParser {
|
||||
public:
|
||||
TemplateParser() : ident_start_("$$"), ident_end_("$$") {}
|
||||
|
||||
TemplateParser(const std::string& ident_start, const std::string& ident_end)
|
||||
: ident_start_(ident_start), ident_end_(ident_end) {}
|
||||
|
||||
void Add(const std::string& key, const std::string& value) {
|
||||
values_.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
void Parse(std::string* tmpl) {
|
||||
int start_pos, end_pos = 0;
|
||||
int ident_start_len = ident_start_.length();
|
||||
int ident_end_len = ident_end_.length();
|
||||
|
||||
while (true) {
|
||||
start_pos = tmpl->find(ident_start_, end_pos);
|
||||
if (start_pos >= 0) {
|
||||
end_pos = tmpl->find(ident_end_, start_pos + ident_start_len);
|
||||
if (end_pos >= 0) {
|
||||
// Found an identifier. Check if a substitution exists.
|
||||
std::string key = tmpl->substr(start_pos + ident_start_len,
|
||||
end_pos - start_pos - ident_start_len);
|
||||
KeyMap::const_iterator it = values_.find(key);
|
||||
if (it != values_.end()) {
|
||||
// Peform the substitution.
|
||||
tmpl->replace(start_pos, end_pos + ident_end_len - start_pos,
|
||||
it->second);
|
||||
end_pos = start_pos + it->second.length();
|
||||
} else {
|
||||
// Leave the unknown identifier in place.
|
||||
end_pos += ident_end_len;
|
||||
}
|
||||
|
||||
if (end_pos >= static_cast<int>(tmpl->length()) - ident_start_len -
|
||||
ident_end_len) {
|
||||
// Not enough room remaining for more identifiers.
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// No end identifier found.
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// No start identifier found.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
using KeyMap = std::map<std::string, std::string>;
|
||||
KeyMap values_;
|
||||
std::string ident_start_;
|
||||
std::string ident_end_;
|
||||
};
|
||||
|
||||
bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
|
||||
*mime_type = "text/html";
|
||||
|
||||
// Redirect to the Chrome documentation.
|
||||
*output =
|
||||
"<html><head>\n"
|
||||
"<meta http-equiv=\"refresh\" "
|
||||
"content=\"0;URL='https://developer.chrome.com/docs/extensions/'\"/>\n"
|
||||
"</head></html>\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||
std::string piece =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_LICENSE_TXT);
|
||||
if (piece.empty()) {
|
||||
DCHECK(false) << "Failed to load license txt resource.";
|
||||
return false;
|
||||
}
|
||||
|
||||
*mime_type = "text/html";
|
||||
*output = "<html><head><title>License</title></head><body><pre>" + piece +
|
||||
"</pre></body></html>";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnVersionUI(Profile* profile,
|
||||
std::string* mime_type,
|
||||
std::string* output) {
|
||||
std::string tmpl =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_VERSION_HTML);
|
||||
if (tmpl.empty()) {
|
||||
DCHECK(false) << "Failed to load version html resource.";
|
||||
return false;
|
||||
}
|
||||
|
||||
base::FilePath user_data_dir =
|
||||
base::PathService::CheckedGet(chrome::DIR_USER_DATA);
|
||||
|
||||
TemplateParser parser;
|
||||
parser.Add("YEAR", MAKE_STRING(COPYRIGHT_YEAR));
|
||||
parser.Add("CEF", CEF_VERSION);
|
||||
parser.Add("CHROMIUM",
|
||||
base::StringPrintf("%d.%d.%d.%d", CHROME_VERSION_MAJOR,
|
||||
CHROME_VERSION_MINOR, CHROME_VERSION_BUILD,
|
||||
CHROME_VERSION_PATCH));
|
||||
parser.Add("OS", GetOSType());
|
||||
parser.Add("WEBKIT", content::GetWebKitVersion());
|
||||
parser.Add("JAVASCRIPT", v8::V8::GetVersion());
|
||||
parser.Add(
|
||||
"USERAGENT",
|
||||
CefAppManager::Get()->GetContentClient()->browser()->GetUserAgent());
|
||||
parser.Add("COMMANDLINE", GetCommandLine());
|
||||
parser.Add("MODULEPATH", GetModulePath());
|
||||
parser.Add("ROOTCACHEPATH", CefString(user_data_dir.value()));
|
||||
parser.Add("CACHEPATH", CefString(profile->GetPath().value()));
|
||||
|
||||
parser.Parse(&tmpl);
|
||||
|
||||
*mime_type = "text/html";
|
||||
*output = tmpl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnWebUIHostsUI(std::string* mime_type, std::string* output) {
|
||||
std::string html =
|
||||
"<html>\n<head><title>Chrome URLs</title></head>\n"
|
||||
"<body bgcolor=\"white\"><h3>List of Chrome URLs</h3>\n<ul>\n";
|
||||
|
||||
std::vector<std::string> list;
|
||||
GetAllowedHosts(&list);
|
||||
std::sort(list.begin(), list.end());
|
||||
|
||||
for (const auto& i : list) {
|
||||
if (IsUnlistedHost(i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
html += "<li><a href=\"chrome://" + i + "\">chrome://" + i + "</a></li>\n";
|
||||
}
|
||||
|
||||
list.clear();
|
||||
GetDebugURLs(&list);
|
||||
std::sort(list.begin(), list.end());
|
||||
|
||||
html +=
|
||||
"</ul>\n<h3>For Debug</h3>\n"
|
||||
"<p>The following pages are for debugging purposes only. Because they "
|
||||
"crash or hang the renderer, they're not linked directly; you can type "
|
||||
"them into the address bar if you need them.</p>\n<ul>\n";
|
||||
for (const auto& i : list) {
|
||||
html += "<li>" + std::string(i) + "</li>\n";
|
||||
}
|
||||
html += "</ul>\n";
|
||||
|
||||
html += "</body>\n</html>";
|
||||
|
||||
*mime_type = "text/html";
|
||||
*output = html;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const content::WebUI::TypeID kCefWebUITypeID = &kCefWebUITypeID;
|
||||
|
||||
class CefURLDataSource : public content::URLDataSource {
|
||||
public:
|
||||
CefURLDataSource(const std::string& host,
|
||||
ChromeHostId host_id,
|
||||
Profile* profile)
|
||||
: host_(host), host_id_(host_id), profile_(profile) {
|
||||
CEF_REQUIRE_UIT();
|
||||
output_ = new base::RefCountedString();
|
||||
bool handled = false;
|
||||
switch (host_id_) {
|
||||
case CHROME_EXTENSIONS_SUPPORT:
|
||||
handled = OnExtensionsSupportUI(&mime_type_, &output_->as_string());
|
||||
break;
|
||||
case CHROME_LICENSE:
|
||||
handled = OnLicenseUI(&mime_type_, &output_->as_string());
|
||||
break;
|
||||
case CHROME_VERSION:
|
||||
handled = OnVersionUI(profile_, &mime_type_, &output_->as_string());
|
||||
break;
|
||||
case CHROME_WEBUI_HOSTS:
|
||||
handled = OnWebUIHostsUI(&mime_type_, &output_->as_string());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DCHECK(handled) << "Unhandled WebUI host: " << host;
|
||||
}
|
||||
|
||||
CefURLDataSource(const CefURLDataSource&) = delete;
|
||||
CefURLDataSource& operator=(const CefURLDataSource&) = delete;
|
||||
|
||||
~CefURLDataSource() override = default;
|
||||
|
||||
// content::URLDataSource implementation.
|
||||
std::string GetSource() override { return host_; }
|
||||
|
||||
void StartDataRequest(
|
||||
const GURL& path,
|
||||
const content::WebContents::Getter& wc_getter,
|
||||
content::URLDataSource::GotDataCallback callback) override {
|
||||
std::move(callback).Run(output_);
|
||||
}
|
||||
|
||||
std::string GetMimeType(const GURL& url) override { return mime_type_; }
|
||||
|
||||
bool AllowCaching() override { return false; }
|
||||
|
||||
private:
|
||||
const std::string host_;
|
||||
const ChromeHostId host_id_;
|
||||
const raw_ptr<Profile> profile_;
|
||||
|
||||
std::string mime_type_;
|
||||
scoped_refptr<base::RefCountedString> output_;
|
||||
};
|
||||
|
||||
class CefWebUIController : public content::WebUIController {
|
||||
public:
|
||||
CefWebUIController(content::WebUI* web_ui,
|
||||
const std::string& host,
|
||||
ChromeHostId host_id)
|
||||
: content::WebUIController(web_ui) {
|
||||
Profile* profile = Profile::FromWebUI(web_ui);
|
||||
content::URLDataSource::Add(
|
||||
profile, std::make_unique<CefURLDataSource>(host, host_id, profile));
|
||||
}
|
||||
|
||||
CefWebUIController(const CefWebUIController&) = delete;
|
||||
CefWebUIController& operator=(const CefWebUIController&) = delete;
|
||||
|
||||
~CefWebUIController() override = default;
|
||||
};
|
||||
|
||||
// Intercepts all WebUI calls and either blocks them or forwards them to the
|
||||
// Content or Chrome WebUI factory as appropriate.
|
||||
class CefWebUIControllerFactory : public content::WebUIControllerFactory {
|
||||
public:
|
||||
CefWebUIControllerFactory(const CefWebUIControllerFactory&) = delete;
|
||||
CefWebUIControllerFactory& operator=(const CefWebUIControllerFactory&) =
|
||||
delete;
|
||||
|
||||
// Returns true if WebUI is allowed to handle the specified |url|.
|
||||
static bool AllowWebUIForURL(const GURL& url) {
|
||||
if (url.SchemeIs(content::kChromeDevToolsScheme)) {
|
||||
return DevToolsUIBindings::IsValidFrontendURL(url);
|
||||
}
|
||||
|
||||
if (!url.SchemeIs(content::kChromeUIScheme) &&
|
||||
!url.SchemeIs(content::kChromeUIUntrustedScheme)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns true if WebUI is allowed to make network requests.
|
||||
static bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) {
|
||||
if (!AllowWebUIForURL(origin.GetURL())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ChromeWebUIControllerFactory::IsWebUIAllowedToMakeNetworkRequests(
|
||||
origin)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(
|
||||
content::WebUI* web_ui,
|
||||
const GURL& url) override {
|
||||
std::unique_ptr<content::WebUIController> controller;
|
||||
if (!AllowWebUIForURL(url)) {
|
||||
return controller;
|
||||
}
|
||||
|
||||
// Set up the chrome://theme/ source. These URLs are referenced from many
|
||||
// places (WebUI and chrome://resources which live in //ui). WebUI code
|
||||
// can live in both //content and //chrome. Since ThemeSource lives in
|
||||
// //chrome the WebUI from //content is not performing this setup despite
|
||||
// the fact that it's needed for proper handling of theme resource requests.
|
||||
// See https://crbug.com/1011280.
|
||||
Profile* profile = Profile::FromWebUI(web_ui);
|
||||
content::URLDataSource::Add(profile,
|
||||
std::make_unique<ThemeSource>(profile));
|
||||
|
||||
const auto host_id = GetChromeHostId(url.host());
|
||||
if (host_id != CHROME_UNKNOWN) {
|
||||
return std::make_unique<CefWebUIController>(web_ui, url.host(), host_id);
|
||||
}
|
||||
|
||||
controller = content::WebUIConfigMap::GetInstance()
|
||||
.controller_factory()
|
||||
->CreateWebUIControllerForURL(web_ui, url);
|
||||
if (controller) {
|
||||
return controller;
|
||||
}
|
||||
|
||||
return ChromeWebUIControllerFactory::GetInstance()
|
||||
->CreateWebUIControllerForURL(web_ui, url);
|
||||
}
|
||||
|
||||
content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
|
||||
const GURL& url) override {
|
||||
content::WebUI::TypeID type = content::WebUI::kNoWebUI;
|
||||
if (!AllowWebUIForURL(url)) {
|
||||
return type;
|
||||
}
|
||||
|
||||
const auto host_id = GetChromeHostId(url.host());
|
||||
if (host_id != CHROME_UNKNOWN) {
|
||||
return kCefWebUITypeID;
|
||||
}
|
||||
|
||||
type = content::WebUIConfigMap::GetInstance()
|
||||
.controller_factory()
|
||||
->GetWebUIType(browser_context, url);
|
||||
if (type != content::WebUI::kNoWebUI) {
|
||||
return type;
|
||||
}
|
||||
|
||||
type = ChromeWebUIControllerFactory::GetInstance()->GetWebUIType(
|
||||
browser_context, url);
|
||||
if (type != content::WebUI::kNoWebUI) {
|
||||
return type;
|
||||
}
|
||||
|
||||
return content::WebUI::kNoWebUI;
|
||||
}
|
||||
|
||||
bool UseWebUIForURL(content::BrowserContext* browser_context,
|
||||
const GURL& url) override {
|
||||
if (!AllowWebUIForURL(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto host_id = GetChromeHostId(url.host());
|
||||
if (host_id != CHROME_UNKNOWN) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (content::WebUIConfigMap::GetInstance()
|
||||
.controller_factory()
|
||||
->UseWebUIForURL(browser_context, url) ||
|
||||
ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL(
|
||||
browser_context, url)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) {
|
||||
// chrome: & friends. The default registration is disabled is
|
||||
// ChromeContentBrowserClient::BrowserURLHandlerCreated().
|
||||
handler->AddHandlerPair(&HandleWebUI, &HandleWebUIReverse);
|
||||
}
|
||||
|
||||
static CefWebUIControllerFactory* GetInstance();
|
||||
|
||||
protected:
|
||||
CefWebUIControllerFactory() = default;
|
||||
~CefWebUIControllerFactory() override = default;
|
||||
|
||||
private:
|
||||
friend struct base::LazyInstanceTraitsBase<CefWebUIControllerFactory>;
|
||||
|
||||
// From chrome/browser/chrome_content_browser_client.cc
|
||||
|
||||
// Handles rewriting Web UI URLs.
|
||||
static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
|
||||
if (!GetInstance()->UseWebUIForURL(browser_context, *url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reverse URL handler for Web UI.
|
||||
static bool HandleWebUIReverse(GURL* url,
|
||||
content::BrowserContext* browser_context) {
|
||||
// No need to actually reverse-rewrite the URL.
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
base::LazyInstance<CefWebUIControllerFactory>::Leaky
|
||||
g_web_ui_controller_factory = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// static
|
||||
CefWebUIControllerFactory* CefWebUIControllerFactory::GetInstance() {
|
||||
return &g_web_ui_controller_factory.Get();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void RegisterWebUIControllerFactory() {
|
||||
// Channel all WebUI handling through CefWebUIControllerFactory.
|
||||
content::WebUIControllerFactory::UnregisterFactoryForTesting(
|
||||
content::WebUIConfigMap::GetInstance().controller_factory());
|
||||
|
||||
content::WebUIControllerFactory::RegisterFactory(
|
||||
CefWebUIControllerFactory::GetInstance());
|
||||
|
||||
RegisterChromeWebUIConfigs();
|
||||
RegisterChromeUntrustedWebUIConfigs();
|
||||
}
|
||||
|
||||
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) {
|
||||
CefWebUIControllerFactory::BrowserURLHandlerCreated(handler);
|
||||
}
|
||||
|
||||
bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) {
|
||||
return CefWebUIControllerFactory::IsWebUIAllowedToMakeNetworkRequests(origin);
|
||||
}
|
||||
|
||||
} // namespace scheme
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (c) 2012 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_BROWSER_NET_CHROME_SCHEME_HANDLER_H_
|
||||
#define CEF_LIBCEF_BROWSER_NET_CHROME_SCHEME_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "cef/include/cef_browser.h"
|
||||
#include "cef/include/cef_frame.h"
|
||||
#include "cef/include/cef_process_message.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace base {
|
||||
class ListValue;
|
||||
}
|
||||
|
||||
namespace content {
|
||||
class BrowserURLHandler;
|
||||
}
|
||||
|
||||
namespace url {
|
||||
class Origin;
|
||||
}
|
||||
|
||||
namespace scheme {
|
||||
|
||||
extern const char kChromeURL[];
|
||||
|
||||
// Register the WebUI controller factory.
|
||||
void RegisterWebUIControllerFactory();
|
||||
|
||||
// Register the WebUI handler.
|
||||
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler);
|
||||
|
||||
// Returns true if WebUI is allowed to make network requests.
|
||||
bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin);
|
||||
|
||||
} // namespace scheme
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_SCHEME_HANDLER_H_
|
|
@ -0,0 +1,126 @@
|
|||
// Copyright 2020 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 "cef/libcef/browser/ui_thread.h"
|
||||
|
||||
#include "base/at_exit.h"
|
||||
#include "base/logging.h"
|
||||
#include "cef/libcef/browser/main_runner.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "content/browser/scheduler/browser_task_executor.h"
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#include "ui/base/ozone_buildflags.h"
|
||||
#if BUILDFLAG(IS_OZONE_X11)
|
||||
#include "ui/ozone/platform/x11/ozone_platform_x11.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include <Objbase.h>
|
||||
#endif
|
||||
|
||||
CefUIThread::CefUIThread(CefMainRunner* runner,
|
||||
base::OnceClosure setup_callback)
|
||||
: runner_(runner), setup_callback_(std::move(setup_callback)) {}
|
||||
|
||||
CefUIThread::~CefUIThread() {
|
||||
Stop();
|
||||
}
|
||||
|
||||
void CefUIThread::Start() {
|
||||
base::AutoLock lock(thread_lock_);
|
||||
bool success = base::PlatformThread::CreateWithType(
|
||||
0, this, &thread_, base::ThreadType::kDefault);
|
||||
if (!success) {
|
||||
LOG(FATAL) << "failed to UI create thread";
|
||||
}
|
||||
}
|
||||
|
||||
void CefUIThread::Stop() {
|
||||
base::AutoLock lock(thread_lock_);
|
||||
|
||||
if (!stopping_) {
|
||||
stopping_ = true;
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefMainRunner::QuitMessageLoop,
|
||||
base::Unretained(runner_)));
|
||||
}
|
||||
|
||||
// Can't join if the |thread_| is either already gone or is non-joinable.
|
||||
if (thread_.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
base::PlatformThread::Join(thread_);
|
||||
thread_ = base::PlatformThreadHandle();
|
||||
|
||||
stopping_ = false;
|
||||
}
|
||||
|
||||
bool CefUIThread::WaitUntilThreadStarted() const {
|
||||
DCHECK(owning_sequence_checker_.CalledOnValidSequence());
|
||||
start_event_.Wait();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefUIThread::InitializeBrowserRunner(
|
||||
content::MainFunctionParams main_function_params) {
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#if BUILDFLAG(IS_OZONE_X11)
|
||||
// Disable creation of GtkUi (interface to GTK desktop features) and cause
|
||||
// ui::GetDefaultLinuxUi() (and related functions) to return nullptr. We
|
||||
// can't use GtkUi in combination with multi-threaded-message-loop because
|
||||
// Chromium's GTK implementation doesn't use GDK threads. Light/dark theme
|
||||
// changes will still be detected via DarkModeManagerLinux.
|
||||
ui::SetMultiThreadedMessageLoopX11();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Use our own browser process runner.
|
||||
browser_runner_ = content::BrowserMainRunner::Create();
|
||||
|
||||
// Initialize browser process state. Uses the current thread's message loop.
|
||||
int exit_code = browser_runner_->Initialize(std::move(main_function_params));
|
||||
CHECK_EQ(exit_code, -1);
|
||||
}
|
||||
|
||||
void CefUIThread::ThreadMain() {
|
||||
base::PlatformThread::SetName("CefUIThread");
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Initializes the COM library on the current thread.
|
||||
CoInitialize(nullptr);
|
||||
#endif
|
||||
|
||||
start_event_.Signal();
|
||||
|
||||
std::move(setup_callback_).Run();
|
||||
|
||||
runner_->RunMessageLoop();
|
||||
|
||||
// Stop may be called before InitializeBrowserRunner if
|
||||
// content::ContentMainRun was not successful (for example, due to process
|
||||
// singleton relaunch).
|
||||
if (browser_runner_) {
|
||||
browser_runner_->Shutdown();
|
||||
browser_runner_.reset();
|
||||
}
|
||||
|
||||
// This will be a no-op if there is no BrowserTaskExecutor.
|
||||
content::BrowserTaskExecutor::Shutdown();
|
||||
|
||||
if (!shutdown_callback_.is_null()) {
|
||||
std::move(shutdown_callback_).Run();
|
||||
}
|
||||
|
||||
// Run exit callbacks on the UI thread to avoid sequence check failures.
|
||||
base::AtExitManager::ProcessCallbacksNow();
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Closes the COM library on the current thread. CoInitialize must
|
||||
// be balanced by a corresponding call to CoUninitialize.
|
||||
CoUninitialize();
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
// Copyright 2020 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_BROWSER_UI_THREAD_H_
|
||||
#define CEF_LIBCEF_BROWSER_UI_THREAD_H_
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/functional/callback_forward.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "content/public/browser/browser_main_runner.h"
|
||||
#include "content/public/common/main_function_params.h"
|
||||
|
||||
class CefMainRunner;
|
||||
|
||||
// Used to run the UI on a separate thread.
|
||||
class CefUIThread final : public base::PlatformThread::Delegate {
|
||||
public:
|
||||
CefUIThread(CefMainRunner* runner, base::OnceClosure setup_callback);
|
||||
~CefUIThread() override;
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
|
||||
bool WaitUntilThreadStarted() const;
|
||||
|
||||
void InitializeBrowserRunner(
|
||||
content::MainFunctionParams main_function_params);
|
||||
|
||||
void set_shutdown_callback(base::OnceClosure shutdown_callback) {
|
||||
shutdown_callback_ = std::move(shutdown_callback);
|
||||
}
|
||||
|
||||
private:
|
||||
void ThreadMain() override;
|
||||
|
||||
const raw_ptr<CefMainRunner> runner_;
|
||||
base::OnceClosure setup_callback_;
|
||||
base::OnceClosure shutdown_callback_;
|
||||
|
||||
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
|
||||
|
||||
bool stopping_ = false;
|
||||
|
||||
// The thread's handle.
|
||||
base::PlatformThreadHandle thread_;
|
||||
mutable base::Lock thread_lock_; // Protects |thread_|.
|
||||
|
||||
mutable base::WaitableEvent start_event_;
|
||||
|
||||
// This class is not thread-safe, use this to verify access from the owning
|
||||
// sequence of the Thread.
|
||||
base::SequenceChecker owning_sequence_checker_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_UI_THREAD_H_
|
|
@ -7,8 +7,8 @@
|
|||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
#include "cef/libcef/browser/browser_event_util.h"
|
||||
#include "cef/libcef/browser/browser_host_base.h"
|
||||
#include "cef/libcef/browser/browser_util.h"
|
||||
#include "cef/libcef/browser/chrome/views/chrome_browser_view.h"
|
||||
#include "cef/libcef/browser/context.h"
|
||||
#include "cef/libcef/browser/request_context_impl.h"
|
||||
|
@ -184,7 +184,7 @@ bool CefBrowserViewImpl::HandleKeyboardEvent(
|
|||
// Give the CefWindowDelegate a chance to handle the event.
|
||||
if (auto* window_impl = cef_window_impl()) {
|
||||
CefKeyEvent cef_event;
|
||||
if (browser_util::GetCefKeyEvent(event, cef_event) &&
|
||||
if (GetCefKeyEvent(event, cef_event) &&
|
||||
window_impl->OnKeyEvent(cef_event)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "cef/libcef/browser/views/textfield_view.h"
|
||||
|
||||
#include "cef/libcef/browser/browser_util.h"
|
||||
#include "cef/libcef/browser/browser_event_util.h"
|
||||
|
||||
CefTextfieldView::CefTextfieldView(CefTextfieldDelegate* cef_delegate)
|
||||
: ParentClass(cef_delegate) {
|
||||
|
@ -27,7 +27,7 @@ bool CefTextfieldView::HandleKeyEvent(views::Textfield* sender,
|
|||
}
|
||||
|
||||
CefKeyEvent cef_key_event;
|
||||
if (!browser_util::GetCefKeyEvent(key_event, cef_key_event)) {
|
||||
if (!GetCefKeyEvent(key_event, cef_key_event)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "base/i18n/rtl.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "cef/libcef/browser/browser_util.h"
|
||||
#include "cef/libcef/browser/browser_event_util.h"
|
||||
#include "cef/libcef/browser/thread_util.h"
|
||||
#include "cef/libcef/browser/views/browser_view_impl.h"
|
||||
#include "cef/libcef/browser/views/display_impl.h"
|
||||
|
@ -86,7 +86,7 @@ class CefUnhandledKeyEventHandler : public ui::EventHandler {
|
|||
}
|
||||
|
||||
CefKeyEvent cef_event;
|
||||
if (browser_util::GetCefKeyEvent(*event, cef_event) &&
|
||||
if (GetCefKeyEvent(*event, cef_event) &&
|
||||
window_impl_->OnKeyEvent(cef_event)) {
|
||||
event->StopPropagation();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "base/threading/threading_features.h"
|
||||
#include "cef/libcef/browser/chrome/chrome_browser_context.h"
|
||||
#include "cef/libcef/browser/chrome/chrome_content_browser_client_cef.h"
|
||||
#include "cef/libcef/browser/main_runner.h"
|
||||
#include "cef/libcef/common/cef_switches.h"
|
||||
#include "cef/libcef/common/command_line_impl.h"
|
||||
#include "cef/libcef/common/crash_reporting.h"
|
||||
|
@ -114,7 +115,7 @@ void InitLogging(const base::CommandLine* command_line) {
|
|||
|
||||
} // namespace
|
||||
|
||||
ChromeMainDelegateCef::ChromeMainDelegateCef(CefMainRunnerHandler* runner,
|
||||
ChromeMainDelegateCef::ChromeMainDelegateCef(CefMainRunner* runner,
|
||||
CefSettings* settings,
|
||||
CefRefPtr<CefApp> application)
|
||||
: ChromeMainDelegate(base::TimeTicks::Now()),
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
#include "cef/include/cef_app.h"
|
||||
#include "cef/libcef/common/app_manager.h"
|
||||
#include "cef/libcef/common/chrome/chrome_content_client_cef.h"
|
||||
#include "cef/libcef/common/main_runner_handler.h"
|
||||
#include "cef/libcef/common/resource_bundle_delegate.h"
|
||||
#include "cef/libcef/common/task_runner_manager.h"
|
||||
#include "chrome/app/chrome_main_delegate.h"
|
||||
|
||||
class CefMainRunner;
|
||||
class ChromeContentBrowserClientCef;
|
||||
class ChromeContentRendererClientCef;
|
||||
|
||||
|
@ -27,7 +27,7 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
|
|||
public:
|
||||
// |runner| will be non-nullptr for the main process only, and will outlive
|
||||
// this object.
|
||||
ChromeMainDelegateCef(CefMainRunnerHandler* runner,
|
||||
ChromeMainDelegateCef(CefMainRunner* runner,
|
||||
CefSettings* settings,
|
||||
CefRefPtr<CefApp> application);
|
||||
|
||||
|
@ -36,6 +36,7 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
|
|||
|
||||
~ChromeMainDelegateCef() override;
|
||||
|
||||
protected:
|
||||
// ChromeMainDelegate overrides.
|
||||
std::optional<int> BasicStartupComplete() override;
|
||||
void PreSandboxStartup() override;
|
||||
|
@ -51,8 +52,10 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
|
|||
content::ContentClient* CreateContentClient() override;
|
||||
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
||||
content::ContentRendererClient* CreateContentRendererClient() override;
|
||||
ui::ResourceBundle::Delegate* GetResourceBundleDelegate() override {
|
||||
return &resource_bundle_delegate_;
|
||||
}
|
||||
|
||||
protected:
|
||||
// CefAppManager overrides.
|
||||
CefRefPtr<CefApp> GetApplication() override { return application_; }
|
||||
content::ContentClient* GetContentClient() override {
|
||||
|
@ -73,16 +76,11 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
|
|||
scoped_refptr<base::SingleThreadTaskRunner> GetRenderTaskRunner() override;
|
||||
scoped_refptr<base::SingleThreadTaskRunner> GetWebWorkerTaskRunner() override;
|
||||
|
||||
// ChromeMainDelegate overrides.
|
||||
ui::ResourceBundle::Delegate* GetResourceBundleDelegate() override {
|
||||
return &resource_bundle_delegate_;
|
||||
}
|
||||
|
||||
private:
|
||||
ChromeContentBrowserClientCef* content_browser_client() const;
|
||||
ChromeContentRendererClientCef* content_renderer_client() const;
|
||||
|
||||
const raw_ptr<CefMainRunnerHandler> runner_;
|
||||
const raw_ptr<CefMainRunner> runner_;
|
||||
const raw_ptr<CefSettings> settings_;
|
||||
CefRefPtr<CefApp> application_;
|
||||
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
// Copyright 2020 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright 2012 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 "cef/libcef/common/chrome/chrome_main_runner_delegate.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "cef/libcef/browser/chrome/chrome_content_browser_client_cef.h"
|
||||
#include "cef/libcef/common/app_manager.h"
|
||||
#include "cef/libcef/common/chrome/chrome_main_delegate_cef.h"
|
||||
#include "chrome/browser/browser_process_impl.h"
|
||||
#include "chrome/browser/chrome_process_singleton.h"
|
||||
#include "chrome/common/profiler/main_thread_stack_sampling_profiler.h"
|
||||
#include "components/keep_alive_registry/keep_alive_types.h"
|
||||
#include "components/keep_alive_registry/scoped_keep_alive.h"
|
||||
#include "components/metrics/persistent_system_profile.h"
|
||||
|
||||
ChromeMainRunnerDelegate::ChromeMainRunnerDelegate(
|
||||
CefMainRunnerHandler* runner,
|
||||
CefSettings* settings,
|
||||
CefRefPtr<CefApp> application)
|
||||
: runner_(runner), settings_(settings), application_(application) {}
|
||||
|
||||
ChromeMainRunnerDelegate::~ChromeMainRunnerDelegate() = default;
|
||||
|
||||
content::ContentMainDelegate*
|
||||
ChromeMainRunnerDelegate::GetContentMainDelegate() {
|
||||
if (!main_delegate_) {
|
||||
main_delegate_ = std::make_unique<ChromeMainDelegateCef>(runner_, settings_,
|
||||
application_);
|
||||
}
|
||||
return main_delegate_.get();
|
||||
}
|
||||
|
||||
void ChromeMainRunnerDelegate::BeforeMainThreadInitialize(
|
||||
const CefMainArgs& args) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
base::CommandLine::Init(0, nullptr);
|
||||
#else
|
||||
base::CommandLine::Init(args.argc, args.argv);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ChromeMainRunnerDelegate::BeforeMainThreadRun(
|
||||
bool multi_threaded_message_loop) {
|
||||
if (multi_threaded_message_loop) {
|
||||
multi_threaded_message_loop_ = true;
|
||||
|
||||
// Detach from the main thread so that these objects can be attached and
|
||||
// modified from the UI thread going forward.
|
||||
metrics::GlobalPersistentSystemProfile::GetInstance()
|
||||
->DetachFromCurrentThread();
|
||||
}
|
||||
}
|
||||
|
||||
void ChromeMainRunnerDelegate::BeforeMainMessageLoopRun(
|
||||
base::RunLoop* run_loop) {
|
||||
// May be nullptr if content::ContentMainRun exits early.
|
||||
if (!g_browser_process) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The ScopedKeepAlive instance triggers shutdown logic when released on the
|
||||
// UI thread before terminating the message loop (e.g. from CefQuitMessageLoop
|
||||
// or FinishShutdownOnUIThread when running with multi-threaded message loop).
|
||||
keep_alive_ = std::make_unique<ScopedKeepAlive>(
|
||||
KeepAliveOrigin::APP_CONTROLLER, KeepAliveRestartOption::DISABLED);
|
||||
|
||||
// The QuitClosure will be executed from BrowserProcessImpl::Unpin() via
|
||||
// KeepAliveRegistry when the last ScopedKeepAlive is released.
|
||||
// ScopedKeepAlives are also held by Browser objects.
|
||||
static_cast<BrowserProcessImpl*>(g_browser_process)
|
||||
->SetQuitClosure(run_loop->QuitClosure());
|
||||
}
|
||||
|
||||
bool ChromeMainRunnerDelegate::HandleMainMessageLoopQuit() {
|
||||
// May be nullptr if content::ContentMainRun exits early.
|
||||
if (!g_browser_process) {
|
||||
// Proceed with direct execution of the QuitClosure().
|
||||
return false;
|
||||
}
|
||||
|
||||
// May be called multiple times. See comments in RunMainMessageLoopBefore.
|
||||
keep_alive_.reset();
|
||||
|
||||
// Cancel direct execution of the QuitClosure() in
|
||||
// CefMainRunner::QuitMessageLoop. We instead wait for all Chrome browser
|
||||
// windows to exit.
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChromeMainRunnerDelegate::BeforeUIThreadInitialize() {
|
||||
sampling_profiler_ = std::make_unique<MainThreadStackSamplingProfiler>();
|
||||
}
|
||||
|
||||
void ChromeMainRunnerDelegate::BeforeUIThreadShutdown() {
|
||||
static_cast<ChromeContentBrowserClientCef*>(
|
||||
CefAppManager::Get()->GetContentClient()->browser())
|
||||
->CleanupOnUIThread();
|
||||
main_delegate_->CleanupOnUIThread();
|
||||
|
||||
sampling_profiler_.reset();
|
||||
}
|
||||
|
||||
void ChromeMainRunnerDelegate::AfterUIThreadShutdown() {
|
||||
if (multi_threaded_message_loop_) {
|
||||
// Don't wait for this to be called in ChromeMainDelegate::ProcessExiting.
|
||||
// It is safe to call multiple times.
|
||||
ChromeProcessSingleton::DeleteInstance();
|
||||
}
|
||||
}
|
||||
|
||||
void ChromeMainRunnerDelegate::BeforeExecuteProcess(const CefMainArgs& args) {
|
||||
BeforeMainThreadInitialize(args);
|
||||
}
|
||||
|
||||
void ChromeMainRunnerDelegate::AfterExecuteProcess() {
|
||||
AfterMainThreadShutdown();
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright 2020 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright 2012 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_MAIN_RUNNER_DELEGATE_CEF_
|
||||
#define CEF_LIBCEF_COMMON_CHROME_CHROME_MAIN_RUNNER_DELEGATE_CEF_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "cef/include/cef_app.h"
|
||||
#include "cef/libcef/common/main_runner_delegate.h"
|
||||
#include "cef/libcef/common/main_runner_handler.h"
|
||||
|
||||
class ChromeMainDelegateCef;
|
||||
class MainThreadStackSamplingProfiler;
|
||||
class ScopedKeepAlive;
|
||||
|
||||
class ChromeMainRunnerDelegate : public CefMainRunnerDelegate {
|
||||
public:
|
||||
// |runner| will be non-nullptr for the main process only, and will outlive
|
||||
// this object.
|
||||
ChromeMainRunnerDelegate(CefMainRunnerHandler* runner,
|
||||
CefSettings* settings,
|
||||
CefRefPtr<CefApp> application);
|
||||
|
||||
ChromeMainRunnerDelegate(const ChromeMainRunnerDelegate&) = delete;
|
||||
ChromeMainRunnerDelegate& operator=(const ChromeMainRunnerDelegate&) = delete;
|
||||
|
||||
~ChromeMainRunnerDelegate() override;
|
||||
|
||||
protected:
|
||||
// CefMainRunnerDelegate overrides.
|
||||
content::ContentMainDelegate* GetContentMainDelegate() override;
|
||||
void BeforeMainThreadInitialize(const CefMainArgs& args) override;
|
||||
void BeforeMainThreadRun(bool multi_threaded_message_loop) override;
|
||||
void BeforeMainMessageLoopRun(base::RunLoop* run_loop) override;
|
||||
bool HandleMainMessageLoopQuit() override;
|
||||
void BeforeUIThreadInitialize() override;
|
||||
void BeforeUIThreadShutdown() override;
|
||||
void AfterUIThreadShutdown() override;
|
||||
void BeforeExecuteProcess(const CefMainArgs& args) override;
|
||||
void AfterExecuteProcess() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<ChromeMainDelegateCef> main_delegate_;
|
||||
|
||||
std::unique_ptr<MainThreadStackSamplingProfiler> sampling_profiler_;
|
||||
std::unique_ptr<ScopedKeepAlive> keep_alive_;
|
||||
|
||||
const raw_ptr<CefMainRunnerHandler> runner_;
|
||||
const raw_ptr<CefSettings> settings_;
|
||||
CefRefPtr<CefApp> application_;
|
||||
|
||||
bool multi_threaded_message_loop_ = false;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_CHROME_CHROME_MAIN_RUNNER_DELEGATE_CEF_
|
|
@ -14,7 +14,6 @@
|
|||
#include "base/strings/string_util.h"
|
||||
#include "cef/include/cef_crash_util.h"
|
||||
#include "cef/libcef/common/cef_switches.h"
|
||||
#include "cef/libcef/features/runtime.h"
|
||||
#include "chrome/common/crash_keys.h"
|
||||
#include "components/crash/core/common/crash_key.h"
|
||||
#include "components/crash/core/common/crash_keys.h"
|
||||
|
@ -244,12 +243,3 @@ void CefSetCrashKeyValue(const CefString& key, const CefString& value) {
|
|||
<< " with value: " << value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// From libcef/features/runtime.h:
|
||||
namespace cef {
|
||||
|
||||
bool IsCrashReportingEnabled() {
|
||||
return crash_reporting::Enabled();
|
||||
}
|
||||
|
||||
} // namespace cef
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
// 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_MAIN_RUNNER_DELEGATE_H_
|
||||
#define CEF_LIBCEF_COMMON_MAIN_RUNNER_DELEGATE_H_
|
||||
#pragma once
|
||||
|
||||
#include "cef/include/cef_app.h"
|
||||
|
||||
namespace base {
|
||||
class RunLoop;
|
||||
}
|
||||
|
||||
namespace content {
|
||||
class ContentMainDelegate;
|
||||
}
|
||||
|
||||
class CefMainRunnerDelegate {
|
||||
public:
|
||||
virtual content::ContentMainDelegate* GetContentMainDelegate() = 0;
|
||||
|
||||
virtual void BeforeMainThreadInitialize(const CefMainArgs& args) {}
|
||||
virtual void BeforeMainThreadRun(bool multi_threaded_message_loop) {}
|
||||
virtual void BeforeMainMessageLoopRun(base::RunLoop* run_loop) {}
|
||||
virtual bool HandleMainMessageLoopQuit() { return false; }
|
||||
virtual void BeforeUIThreadInitialize() {}
|
||||
virtual void AfterUIThreadInitialize() {}
|
||||
virtual void BeforeUIThreadShutdown() {}
|
||||
virtual void AfterUIThreadShutdown() {}
|
||||
virtual void BeforeMainThreadShutdown() {}
|
||||
virtual void AfterMainThreadShutdown() {}
|
||||
virtual void BeforeExecuteProcess(const CefMainArgs& args) {}
|
||||
virtual void AfterExecuteProcess() {}
|
||||
|
||||
virtual ~CefMainRunnerDelegate() = default;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_MAIN_RUNNER_DELEGATE_H_
|
|
@ -1,24 +0,0 @@
|
|||
// 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_MAIN_RUNNER_HANDLER_H_
|
||||
#define CEF_LIBCEF_COMMON_MAIN_RUNNER_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
namespace content {
|
||||
struct MainFunctionParams;
|
||||
}
|
||||
|
||||
// Handles running of the main process.
|
||||
class CefMainRunnerHandler {
|
||||
public:
|
||||
virtual void PreBrowserMain() = 0;
|
||||
virtual int RunMainProcess(
|
||||
content::MainFunctionParams main_function_params) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~CefMainRunnerHandler() = default;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_MAIN_RUNNER_HANDLER_H_
|
|
@ -1,41 +0,0 @@
|
|||
// 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_H_
|
||||
#define CEF_LIBCEF_FEATURES_RUNTIME_H_
|
||||
#pragma once
|
||||
|
||||
#include "cef/libcef/features/features.h"
|
||||
|
||||
namespace cef {
|
||||
|
||||
#if BUILDFLAG(ENABLE_CEF)
|
||||
|
||||
inline bool IsCefBuildEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// True if running as CEF Chrome runtime.
|
||||
bool IsChromeRuntimeEnabled();
|
||||
|
||||
// True if CEF crash reporting is enabled.
|
||||
bool IsCrashReportingEnabled();
|
||||
|
||||
#else // !BUILDFLAG(ENABLE_CEF)
|
||||
|
||||
inline bool IsCefBuildEnabled() {
|
||||
return false;
|
||||
}
|
||||
inline bool IsChromeRuntimeEnabled() {
|
||||
return false;
|
||||
}
|
||||
inline bool IsCrashReportingEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // !BUILDFLAG(ENABLE_CEF)
|
||||
|
||||
} // namespace cef
|
||||
|
||||
#endif // CEF_LIBCEF_FEATURES_RUNTIME_H_
|
|
@ -1,141 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
|
||||
<!--
|
||||
about:version template page
|
||||
-->
|
||||
|
||||
<html id="t" i18n-values="dir:textdirection;">
|
||||
<head>
|
||||
<title>About Version</title>
|
||||
|
||||
<style>/* Copyright (c) 2012 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. */
|
||||
|
||||
body {
|
||||
background-color: white;
|
||||
color: black;
|
||||
font-family: Helvetica,Arial,sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#outer {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 10px;
|
||||
width: 820px;
|
||||
}
|
||||
|
||||
#inner {
|
||||
padding-top: 10px;
|
||||
width: 550px;
|
||||
}
|
||||
|
||||
.label {
|
||||
-webkit-padding-end: 5px;
|
||||
font-size: 0.9em;
|
||||
font-weight: bold;
|
||||
text-align: end;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.label:after {
|
||||
content: ':';
|
||||
}
|
||||
|
||||
.footnote {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
#logo {
|
||||
float: right;
|
||||
margin-left: 40px;
|
||||
text-align: right;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
#company {
|
||||
font-size: 0.7em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#copyright {
|
||||
font-size: 0.7em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-family: monospace;
|
||||
max-width: 430px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="outer">
|
||||
<div id="logo">
|
||||
<div id="company">Chromium Embedded Framework (CEF)</div>
|
||||
<div id="copyright">Copyright © $$YEAR$$ The Chromium Embedded Framework Authors.<br/>All rights reserved.<br/><a href="chrome://license">license</a> | <a href="chrome://credits">credits</a></div>
|
||||
</div>
|
||||
<table id="inner" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td class="label" valign="top">CEF</td>
|
||||
<td class="value">$$CEF$$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" valign="top">Chromium</td>
|
||||
<td class="value">$$CHROMIUM$$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" valign="top">OS</td>
|
||||
<td class="value">$$OS$$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" valign="top">WebKit</td>
|
||||
<td class="value">$$WEBKIT$$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" valign="top">JavaScript</td>
|
||||
<td class="value">$$JAVASCRIPT$$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" valign="top">User Agent</td>
|
||||
<td class="value">$$USERAGENT$$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" valign="top">Command Line</td>
|
||||
<td class="value">$$COMMANDLINE$$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" valign="top">Module Path</td>
|
||||
<td class="value">$$MODULEPATH$$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" valign="top">Root Cache Path <sup>[1][2]</sup></td>
|
||||
<td class="value">$$ROOTCACHEPATH$$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" valign="top">Cache Path <sup>[1]</sup></td>
|
||||
<td class="value">$$CACHEPATH$$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="footnote">
|
||||
<br>[1] In <a href="https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md" target="_new">Chromium terminology</a>,
|
||||
"Root Cache Path" (<a href="https://cef-builds.spotifycdn.com/docs/beta.html?structcef__settings__t.html#a2e2be03f34ddd93de90e1cf196757a19" target="_new">CefSettings.root_cache_path</a>)
|
||||
is the "User Data Directory" and "Cache Path" (<a href="https://cef-builds.spotifycdn.com/docs/beta.html?structcef__settings__t.html#ad1644a7eb23cad969181db010f007710" target="_new">CefSettings.cache_path</a>)
|
||||
is the "Profile Path". An empty "Cache Path" value means that the browser is using an <a href="https://support.google.com/chrome/answer/9845881" target="_new">Incognito Profile</a>.
|
||||
Even in Incognito mode, some per-installation data will still be written to the "Root Cache Path" directory.
|
||||
<br/><br/>[2] Chromium's <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/browser/process_singleton.h#35" target="_new">process singleton lock</a>
|
||||
protects against multiple app instances writing to the same "Root Cache Path" directory.
|
||||
Implement <a href="https://cef-builds.spotifycdn.com/docs/beta.html?classCefBrowserProcessHandler.html#a052a91639483467c0b546d57a05c2f06" target="_new">CefBrowserProcessHandler:: OnAlreadyRunningAppRelaunch</a>
|
||||
to handle the case of app relaunch with the same directory.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -10,7 +10,6 @@
|
|||
<release seq="1">
|
||||
<includes>
|
||||
<include name="IDR_CEF_LICENSE_TXT" file="..\..\LICENSE.txt" type="BINDATA" />
|
||||
<include name="IDR_CEF_VERSION_HTML" file="about_version.html" type="BINDATA" />
|
||||
</includes>
|
||||
</release>
|
||||
</grit>
|
||||
|
|
|
@ -332,6 +332,14 @@ patches = [
|
|||
# Fix Jumbo/component build dependency issue.
|
||||
'name': 'chrome_browser_safe_browsing',
|
||||
},
|
||||
{
|
||||
# Support loading of chrome://license via WebUI.
|
||||
'name': 'chrome_browser_webui_license',
|
||||
},
|
||||
{
|
||||
# Support customization of chrome://version WebUI.
|
||||
'name': 'chrome_browser_webui_version',
|
||||
},
|
||||
{
|
||||
# Add BrowserPluginGuest::owner_web_contents() method.
|
||||
'name': 'chrome_plugins',
|
||||
|
@ -466,15 +474,6 @@ patches = [
|
|||
# This crash was introduced by https://crrev.com/5f6212babf.
|
||||
'name': 'browser_scheduler',
|
||||
},
|
||||
{
|
||||
# Restore access to WebUIControllerFactory::UnregisterFactoryForTesting
|
||||
# which was removed in https://crrev.com/5f183d6636. We can't use
|
||||
# ScopedWebUIControllerFactoryRegistration because it pulls in GTest
|
||||
# dependencies.
|
||||
#
|
||||
# Add accessor for WebUIConfigMap::webui_controller_factory_.
|
||||
'name': 'browser_web_ui_controller_factory',
|
||||
},
|
||||
{
|
||||
# Add support for OSR rendering with Viz.
|
||||
# https://github.com/chromiumembedded/cef/issues/2575
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
diff --git content/public/browser/web_ui_controller_factory.h content/public/browser/web_ui_controller_factory.h
|
||||
index 9d9c17ffd6474..4eb79c65369af 100644
|
||||
--- content/public/browser/web_ui_controller_factory.h
|
||||
+++ content/public/browser/web_ui_controller_factory.h
|
||||
@@ -47,9 +47,6 @@ class CONTENT_EXPORT WebUIControllerFactory {
|
||||
virtual bool UseWebUIForURL(BrowserContext* browser_context,
|
||||
const GURL& url) = 0;
|
||||
|
||||
- private:
|
||||
- friend class ScopedWebUIControllerFactoryRegistration;
|
||||
-
|
||||
static void UnregisterFactoryForTesting(WebUIControllerFactory* factory);
|
||||
};
|
||||
|
||||
diff --git content/public/browser/webui_config_map.h content/public/browser/webui_config_map.h
|
||||
index e7b6a9b841abb..1c98be86c0db1 100644
|
||||
--- content/public/browser/webui_config_map.h
|
||||
+++ content/public/browser/webui_config_map.h
|
||||
@@ -68,6 +68,10 @@ class CONTENT_EXPORT WebUIConfigMap {
|
||||
std::vector<WebUIConfigInfo> GetWebUIConfigList(
|
||||
BrowserContext* browser_context);
|
||||
|
||||
+ WebUIControllerFactory* controller_factory() const {
|
||||
+ return webui_controller_factory_.get();
|
||||
+ }
|
||||
+
|
||||
private:
|
||||
void AddWebUIConfigImpl(std::unique_ptr<WebUIConfig> config);
|
||||
|
|
@ -74,7 +74,7 @@ index 02ff1e580d3a7..7f51115896049 100644
|
|||
}
|
||||
|
||||
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
|
||||
index 74460ac479210..8cf70c80a87ad 100644
|
||||
index 74460ac479210..c484be466eefb 100644
|
||||
--- chrome/browser/ui/BUILD.gn
|
||||
+++ chrome/browser/ui/BUILD.gn
|
||||
@@ -8,6 +8,7 @@ import("//build/config/compiler/compiler.gni")
|
||||
|
@ -104,7 +104,18 @@ index 74460ac479210..8cf70c80a87ad 100644
|
|||
"//chrome:resources",
|
||||
"//chrome:strings",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
@@ -3040,6 +3046,8 @@ static_library("ui") {
|
||||
@@ -759,6 +765,10 @@ static_library("ui") {
|
||||
deps += [ "//components/plus_addresses/resources:vector_icons" ]
|
||||
}
|
||||
|
||||
+ if (enable_cef) {
|
||||
+ deps += [ "//cef:cef_resources" ]
|
||||
+ }
|
||||
+
|
||||
# TODO(crbug.com/41437292): Remove this circular dependency.
|
||||
allow_circular_includes_from = [
|
||||
# TODO(crbug.com/40161499): Remove this circular dependency.
|
||||
@@ -3040,6 +3050,8 @@ static_library("ui") {
|
||||
"views/apps/app_dialog/app_local_block_dialog_view.h",
|
||||
"views/apps/app_dialog/app_pause_dialog_view.cc",
|
||||
"views/apps/app_dialog/app_pause_dialog_view.h",
|
||||
|
@ -113,7 +124,7 @@ index 74460ac479210..8cf70c80a87ad 100644
|
|||
"views/apps/app_info_dialog/arc_app_info_links_panel.cc",
|
||||
"views/apps/app_info_dialog/arc_app_info_links_panel.h",
|
||||
"views/apps/chrome_app_window_client_views_chromeos.cc",
|
||||
@@ -4249,8 +4257,6 @@ static_library("ui") {
|
||||
@@ -4249,8 +4261,6 @@ static_library("ui") {
|
||||
"autofill/payments/webauthn_dialog_model.h",
|
||||
"autofill/payments/webauthn_dialog_model_observer.h",
|
||||
"autofill/payments/webauthn_dialog_state.h",
|
||||
|
@ -122,7 +133,7 @@ index 74460ac479210..8cf70c80a87ad 100644
|
|||
"incognito_clear_browsing_data_dialog_interface.h",
|
||||
"signin/signin_modal_dialog.cc",
|
||||
"signin/signin_modal_dialog.h",
|
||||
@@ -5125,8 +5131,6 @@ static_library("ui") {
|
||||
@@ -5125,8 +5135,6 @@ static_library("ui") {
|
||||
"views/accessibility/theme_tracking_non_accessible_image_view.h",
|
||||
"views/apps/app_dialog/app_dialog_view.cc",
|
||||
"views/apps/app_dialog/app_dialog_view.h",
|
||||
|
@ -131,7 +142,7 @@ index 74460ac479210..8cf70c80a87ad 100644
|
|||
"views/apps/app_info_dialog/app_info_dialog_container.cc",
|
||||
"views/apps/app_info_dialog/app_info_dialog_container.h",
|
||||
"views/apps/app_info_dialog/app_info_dialog_views.cc",
|
||||
@@ -6908,6 +6912,7 @@ static_library("ui") {
|
||||
@@ -6908,6 +6916,7 @@ static_library("ui") {
|
||||
if (enable_printing) {
|
||||
deps += [
|
||||
"//components/printing/browser",
|
||||
|
@ -461,14 +472,14 @@ index 557abfcd71d85..fb64e93157148 100644
|
|||
case TYPE_NORMAL:
|
||||
return NormalBrowserSupportsWindowFeature(feature, check_can_support);
|
||||
diff --git chrome/browser/ui/browser.h chrome/browser/ui/browser.h
|
||||
index 69f2c9c0ff003..3cae24a0e42d2 100644
|
||||
index 69f2c9c0ff003..83d46c6326568 100644
|
||||
--- chrome/browser/ui/browser.h
|
||||
+++ chrome/browser/ui/browser.h
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "base/timer/elapsed_timer.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "cef/libcef/features/runtime.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/tab_contents/web_contents_collection.h"
|
||||
#include "chrome/browser/themes/theme_service_observer.h"
|
||||
#include "chrome/browser/ui/bookmarks/bookmark_bar.h"
|
||||
|
|
|
@ -49,14 +49,14 @@ index 2628f1751cd14..cc2c330d8db5d 100644
|
|||
base::BindOnce(&ChromeDownloadManagerDelegate::OnDownloadTargetDetermined,
|
||||
weak_ptr_factory_.GetWeakPtr(), download->GetId(),
|
||||
diff --git chrome/browser/download/chrome_download_manager_delegate.h chrome/browser/download/chrome_download_manager_delegate.h
|
||||
index af7f1d5fac12b..1cb1d01464c11 100644
|
||||
index af7f1d5fac12b..8cd591798ab61 100644
|
||||
--- chrome/browser/download/chrome_download_manager_delegate.h
|
||||
+++ chrome/browser/download/chrome_download_manager_delegate.h
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/unguessable_token.h"
|
||||
#include "build/build_config.h"
|
||||
+#include "cef/libcef/features/runtime.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/download/download_completion_blocker.h"
|
||||
#include "chrome/browser/download/download_target_determiner_delegate.h"
|
||||
#include "components/download/public/common/download_danger_type.h"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
diff --git chrome/browser/extensions/api/chrome_extensions_api_client.cc chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
||||
index 4007e26f780c3..5f92d74018f9e 100644
|
||||
index 4007e26f780c3..26d0d492cf176 100644
|
||||
--- chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
||||
+++ chrome/browser/extensions/api/chrome_extensions_api_client.cc
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "base/strings/string_util.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "cef/libcef/features/runtime.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/extensions/api/automation_internal/chrome_automation_internal_api_delegate.h"
|
||||
#include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h"
|
||||
#include "chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h"
|
||||
|
@ -21,18 +21,18 @@ index 4007e26f780c3..5f92d74018f9e 100644
|
|||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
#include "chrome/browser/printing/printing_init.h"
|
||||
#endif
|
||||
@@ -314,6 +319,11 @@ ChromeExtensionsAPIClient::CreateGuestViewManagerDelegate() const {
|
||||
@@ -314,7 +319,11 @@ ChromeExtensionsAPIClient::CreateGuestViewManagerDelegate() const {
|
||||
std::unique_ptr<MimeHandlerViewGuestDelegate>
|
||||
ChromeExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
|
||||
MimeHandlerViewGuest* guest) const {
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ if (cef::IsChromeRuntimeEnabled()) {
|
||||
+ return std::make_unique<ChromeMimeHandlerViewGuestDelegateCef>(guest);
|
||||
+ }
|
||||
+#endif
|
||||
+ return std::make_unique<ChromeMimeHandlerViewGuestDelegateCef>(guest);
|
||||
+#else
|
||||
return std::make_unique<ChromeMimeHandlerViewGuestDelegate>();
|
||||
+#endif
|
||||
}
|
||||
|
||||
WebViewGuestDelegate* ChromeExtensionsAPIClient::CreateWebViewGuestDelegate(
|
||||
diff --git chrome/browser/extensions/api/tabs/tabs_api.cc chrome/browser/extensions/api/tabs/tabs_api.cc
|
||||
index 73de5dd73a522..12005b67a6ee9 100644
|
||||
--- chrome/browser/extensions/api/tabs/tabs_api.cc
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
diff --git chrome/browser/ui/webui/about/about_ui.cc chrome/browser/ui/webui/about/about_ui.cc
|
||||
index 7d04b86885167..b89b060efc9e0 100644
|
||||
--- chrome/browser/ui/webui/about/about_ui.cc
|
||||
+++ chrome/browser/ui/webui/about/about_ui.cc
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "base/values.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/about_flags.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
@@ -91,6 +92,10 @@
|
||||
#include "chrome/common/webui_url_constants.h"
|
||||
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+#include "cef/grit/cef_resources.h"
|
||||
+#endif
|
||||
+
|
||||
using content::BrowserThread;
|
||||
|
||||
namespace {
|
||||
@@ -692,6 +697,16 @@ void AboutUIHTMLSource::StartDataRequest(
|
||||
IDS_TERMS_HTML);
|
||||
#endif
|
||||
}
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ else if (source_name_ == chrome::kChromeUILicenseHost) {
|
||||
+ response =
|
||||
+ "<html><head><title>CEF License</title></head>"
|
||||
+ "<body bgcolor=\"white\"><pre>" +
|
||||
+ ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
+ IDR_CEF_LICENSE_TXT) +
|
||||
+ "</pre></body></html>";
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
FinishDataRequest(response, std::move(callback));
|
||||
}
|
||||
diff --git chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
|
||||
index 7b61f43d8c72a..811d075966239 100644
|
||||
--- chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
|
||||
+++ chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "build/branding_buildflags.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/about_flags.h"
|
||||
#include "chrome/browser/buildflags.h"
|
||||
#include "chrome/browser/commerce/shopping_service_factory.h"
|
||||
@@ -391,6 +392,9 @@ bool IsAboutUI(const GURL& url) {
|
||||
|| url.host_piece() == chrome::kChromeUIOSCreditsHost ||
|
||||
url.host_piece() == chrome::kChromeUIBorealisCreditsHost ||
|
||||
url.host_piece() == chrome::kChromeUICrostiniCreditsHost
|
||||
+#endif
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ || url.host_piece() == chrome::kChromeUILicenseHost
|
||||
#endif
|
||||
); // NOLINT
|
||||
}
|
||||
@@ -1019,6 +1023,9 @@ ChromeWebUIControllerFactory::GetListOfAcceptableURLs() {
|
||||
GURL(chrome::kChromeUIGpuURL),
|
||||
GURL(chrome::kChromeUIHistogramsURL),
|
||||
GURL(chrome::kChromeUIInspectURL),
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ GURL(chrome::kChromeUILicenseURL),
|
||||
+#endif
|
||||
GURL(chrome::kChromeUIManagementURL),
|
||||
GURL(chrome::kChromeUINetExportURL),
|
||||
GURL(chrome::kChromeUIPrefsInternalsURL),
|
||||
diff --git chrome/common/webui_url_constants.cc chrome/common/webui_url_constants.cc
|
||||
index 4604facee295e..acd8857875d6e 100644
|
||||
--- chrome/common/webui_url_constants.cc
|
||||
+++ chrome/common/webui_url_constants.cc
|
||||
@@ -131,6 +131,10 @@ const char kChromeUILauncherInternalsHost[] = "launcher-internals";
|
||||
const char kChromeUILauncherInternalsURL[] = "chrome://launcher-internals";
|
||||
const char kChromeUILensSearchBubbleHost[] = "lens-search-bubble";
|
||||
const char kChromeUILensSearchBubbleURL[] = "chrome://lens-search-bubble/";
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+const char kChromeUILicenseHost[] = "license";
|
||||
+const char kChromeUILicenseURL[] = "chrome://license/";
|
||||
+#endif
|
||||
const char kChromeUISensorInfoHost[] = "sensor-info";
|
||||
const char kChromeUISensorInfoURL[] = "chrome://sensor-info/";
|
||||
const char kChromeUILocalStateHost[] = "local-state";
|
||||
@@ -704,6 +708,9 @@ const char* const kChromeHostURLs[] = {
|
||||
kChromeUIHumanPresenceInternalsHost,
|
||||
#endif
|
||||
kChromeUIInterstitialHost,
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ kChromeUILicenseHost,
|
||||
+#endif
|
||||
kChromeUILocalStateHost,
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
kChromeUIManagementHost,
|
||||
diff --git chrome/common/webui_url_constants.h chrome/common/webui_url_constants.h
|
||||
index b1247ef8ad3ff..a4ebfe2d585a0 100644
|
||||
--- chrome/common/webui_url_constants.h
|
||||
+++ chrome/common/webui_url_constants.h
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "build/branding_buildflags.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/common/buildflags.h"
|
||||
#include "components/lens/buildflags.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
@@ -123,6 +124,10 @@ extern const char kChromeUILauncherInternalsHost[];
|
||||
extern const char kChromeUILauncherInternalsURL[];
|
||||
extern const char kChromeUILensSearchBubbleHost[];
|
||||
extern const char kChromeUILensSearchBubbleURL[];
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+extern const char kChromeUILicenseHost[];
|
||||
+extern const char kChromeUILicenseURL[];
|
||||
+#endif
|
||||
extern const char kChromeUISensorInfoURL[];
|
||||
extern const char kChromeUISensorInfoHost[];
|
||||
extern const char kChromeUILocalStateHost[];
|
|
@ -0,0 +1,381 @@
|
|||
diff --git chrome/browser/ui/webui/version/version_handler.cc chrome/browser/ui/webui/version/version_handler.cc
|
||||
index 55541159e5fc8..8021d1d963f59 100644
|
||||
--- chrome/browser/ui/webui/version/version_handler.cc
|
||||
+++ chrome/browser/ui/webui/version/version_handler.cc
|
||||
@@ -27,12 +27,23 @@
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+#include "base/base_paths.h"
|
||||
+#include "base/path_service.h"
|
||||
+#include "chrome/common/chrome_paths.h"
|
||||
+#endif
|
||||
+
|
||||
namespace {
|
||||
|
||||
// Retrieves the executable and profile paths on the FILE thread.
|
||||
void GetFilePaths(const base::FilePath& profile_path,
|
||||
std::u16string* exec_path_out,
|
||||
- std::u16string* profile_path_out) {
|
||||
+ std::u16string* profile_path_out
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ , std::u16string* module_path_out,
|
||||
+ std::u16string* user_data_path_out
|
||||
+#endif
|
||||
+ ) {
|
||||
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
|
||||
base::BlockingType::MAY_BLOCK);
|
||||
|
||||
@@ -48,6 +59,19 @@ void GetFilePaths(const base::FilePath& profile_path,
|
||||
*profile_path_out = profile_path.LossyDisplayName();
|
||||
else
|
||||
*profile_path_out = l10n_util::GetStringUTF16(IDS_VERSION_UI_PATH_NOTFOUND);
|
||||
+
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ base::FilePath module_path;
|
||||
+ if (base::PathService::Get(base::FILE_MODULE, &module_path)) {
|
||||
+ *module_path_out = module_path.LossyDisplayName();
|
||||
+ } else {
|
||||
+ *module_path_out = l10n_util::GetStringUTF16(IDS_VERSION_UI_PATH_NOTFOUND);
|
||||
+ }
|
||||
+
|
||||
+ base::FilePath user_data_dir =
|
||||
+ base::PathService::CheckedGet(chrome::DIR_USER_DATA);
|
||||
+ *user_data_path_out = user_data_dir.LossyDisplayName();
|
||||
+#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -111,23 +135,46 @@ void VersionHandler::HandleRequestPathInfo(const base::Value::List& args) {
|
||||
// OnGotFilePaths.
|
||||
std::u16string* exec_path_buffer = new std::u16string;
|
||||
std::u16string* profile_path_buffer = new std::u16string;
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ std::u16string* module_path_buffer = new std::u16string;
|
||||
+ std::u16string* user_data_path_buffer = new std::u16string;
|
||||
+#endif
|
||||
base::ThreadPool::PostTaskAndReply(
|
||||
FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()},
|
||||
base::BindOnce(&GetFilePaths, Profile::FromWebUI(web_ui())->GetPath(),
|
||||
base::Unretained(exec_path_buffer),
|
||||
- base::Unretained(profile_path_buffer)),
|
||||
+ base::Unretained(profile_path_buffer)
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ , base::Unretained(module_path_buffer),
|
||||
+ base::Unretained(user_data_path_buffer)
|
||||
+#endif
|
||||
+ ),
|
||||
base::BindOnce(&VersionHandler::OnGotFilePaths,
|
||||
weak_ptr_factory_.GetWeakPtr(), callback_id,
|
||||
base::Owned(exec_path_buffer),
|
||||
- base::Owned(profile_path_buffer)));
|
||||
+ base::Owned(profile_path_buffer)
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ , base::Owned(module_path_buffer),
|
||||
+ base::Owned(user_data_path_buffer)
|
||||
+#endif
|
||||
+ ));
|
||||
}
|
||||
|
||||
void VersionHandler::OnGotFilePaths(std::string callback_id,
|
||||
std::u16string* executable_path_data,
|
||||
- std::u16string* profile_path_data) {
|
||||
+ std::u16string* profile_path_data
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ , std::u16string* module_path_data,
|
||||
+ std::u16string* user_data_path_data
|
||||
+#endif
|
||||
+ ) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
base::Value::Dict response;
|
||||
response.Set(version_ui::kKeyExecPath, *executable_path_data);
|
||||
response.Set(version_ui::kKeyProfilePath, *profile_path_data);
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ response.Set(version_ui::kKeyModulePath, *module_path_data);
|
||||
+ response.Set(version_ui::kKeyUserDataPath, *user_data_path_data);
|
||||
+#endif
|
||||
ResolveJavascriptCallback(base::Value(callback_id), response);
|
||||
}
|
||||
diff --git chrome/browser/ui/webui/version/version_handler.h chrome/browser/ui/webui/version/version_handler.h
|
||||
index 2f8162d7491d1..b00f0d5bf26ae 100644
|
||||
--- chrome/browser/ui/webui/version/version_handler.h
|
||||
+++ chrome/browser/ui/webui/version/version_handler.h
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/values.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "content/public/browser/web_ui_message_handler.h"
|
||||
|
||||
// Handler class for Version page operations.
|
||||
@@ -44,7 +45,12 @@ class VersionHandler : public content::WebUIMessageHandler {
|
||||
// front end.
|
||||
void OnGotFilePaths(std::string callback_id,
|
||||
std::u16string* executable_path_data,
|
||||
- std::u16string* profile_path_data);
|
||||
+ std::u16string* profile_path_data
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ , std::u16string* module_path_data,
|
||||
+ std::u16string* user_data_path_data
|
||||
+#endif
|
||||
+ );
|
||||
|
||||
// Factory for the creating refs in callbacks.
|
||||
base::WeakPtrFactory<VersionHandler> weak_ptr_factory_{this};
|
||||
diff --git chrome/browser/ui/webui/version/version_ui.cc chrome/browser/ui/webui/version/version_ui.cc
|
||||
index 6e205bf700de2..c281769b5cb5c 100644
|
||||
--- chrome/browser/ui/webui/version/version_ui.cc
|
||||
+++ chrome/browser/ui/webui/version/version_ui.cc
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "base/time/time.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/browser_process_impl.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/webui/version/version_handler.h"
|
||||
@@ -64,6 +65,10 @@
|
||||
#include "chrome/browser/ui/webui/version/version_util_win.h"
|
||||
#endif
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+#include "cef/include/cef_version.h"
|
||||
+#endif
|
||||
+
|
||||
using content::WebUIDataSource;
|
||||
|
||||
namespace {
|
||||
@@ -84,6 +89,10 @@ void CreateAndAddVersionUIDataSource(Profile* profile) {
|
||||
{version_ui::kCommandLineName, IDS_VERSION_UI_COMMAND_LINE},
|
||||
{version_ui::kExecutablePathName, IDS_VERSION_UI_EXECUTABLE_PATH},
|
||||
{version_ui::kProfilePathName, IDS_VERSION_UI_PROFILE_PATH},
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ {version_ui::kModulePathName, IDS_VERSION_UI_MODULE_PATH},
|
||||
+ {version_ui::kUserDataPathName, IDS_VERSION_UI_USER_DATA_PATH},
|
||||
+#endif
|
||||
{version_ui::kVariationsName, IDS_VERSION_UI_VARIATIONS},
|
||||
{version_ui::kVariationsCmdName, IDS_VERSION_UI_VARIATIONS_CMD},
|
||||
{version_ui::kVariationsSeedName, IDS_VERSION_UI_VARIATIONS_SEED_NAME},
|
||||
@@ -121,6 +130,10 @@ void CreateAndAddVersionUIDataSource(Profile* profile) {
|
||||
IDR_PRODUCT_LOGO_WHITE);
|
||||
#endif // BUILDFLAG(IS_ANDROID)
|
||||
html_source->SetDefaultResource(IDR_VERSION_UI_ABOUT_VERSION_HTML);
|
||||
+
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ html_source->AddString(version_ui::kCefVersion, CEF_VERSION);
|
||||
+#endif
|
||||
}
|
||||
|
||||
std::string GetProductModifier() {
|
||||
@@ -241,6 +254,10 @@ void VersionUI::AddVersionDetailStrings(content::WebUIDataSource* html_source) {
|
||||
// blank.
|
||||
html_source->AddString(version_ui::kExecutablePath, std::string());
|
||||
html_source->AddString(version_ui::kProfilePath, std::string());
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ html_source->AddString(version_ui::kModulePath, std::string());
|
||||
+ html_source->AddString(version_ui::kUserDataPath, std::string());
|
||||
+#endif
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
html_source->AddString(version_ui::kOSType, base::mac::GetOSDisplayName());
|
||||
diff --git components/version_ui/BUILD.gn components/version_ui/BUILD.gn
|
||||
index 913cf913dca7a..d79c330989149 100644
|
||||
--- components/version_ui/BUILD.gn
|
||||
+++ components/version_ui/BUILD.gn
|
||||
@@ -2,6 +2,8 @@
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
+import("//cef/libcef/features/features.gni")
|
||||
+
|
||||
static_library("version_ui") {
|
||||
sources = [
|
||||
"version_handler_helper.cc",
|
||||
@@ -17,4 +19,8 @@ static_library("version_ui") {
|
||||
"//components/variations/net",
|
||||
"//components/variations/service",
|
||||
]
|
||||
+
|
||||
+ if (enable_cef) {
|
||||
+ configs += [ "//cef/libcef/features:config" ]
|
||||
+ }
|
||||
}
|
||||
diff --git components/version_ui/resources/about_version.css components/version_ui/resources/about_version.css
|
||||
index 6b753d716b55d..58d6419be0165 100644
|
||||
--- components/version_ui/resources/about_version.css
|
||||
+++ components/version_ui/resources/about_version.css
|
||||
@@ -135,3 +135,7 @@ body {
|
||||
position: fixed;
|
||||
width: 1px;
|
||||
}
|
||||
+
|
||||
+#footnote {
|
||||
+ font-size: 0.8em;
|
||||
+}
|
||||
diff --git components/version_ui/resources/about_version.html components/version_ui/resources/about_version.html
|
||||
index 508c4ecfd790f..fed6933908951 100644
|
||||
--- components/version_ui/resources/about_version.html
|
||||
+++ components/version_ui/resources/about_version.html
|
||||
@@ -62,9 +62,21 @@ about:version template page
|
||||
</picture>
|
||||
</if>
|
||||
<div id="company">$i18n{company}</div>
|
||||
- <div id="copyright">$i18n{copyright}</div>
|
||||
+ <div id="copyright">$i18n{copyright}
|
||||
+<if expr="enable_cef">
|
||||
+ <br/><a href="chrome://license">license</a> | <a href="chrome://credits">credits</a>
|
||||
+</if>
|
||||
+ </div>
|
||||
</div>
|
||||
<table id="inner" cellpadding="0" cellspacing="0" border="0">
|
||||
+<if expr="enable_cef">
|
||||
+ <tr>
|
||||
+ <td class="label">CEF</td>
|
||||
+ <td class="version">
|
||||
+ <span>$i18n{cef_version}</span>
|
||||
+ </td>
|
||||
+ </tr>
|
||||
+</if>
|
||||
<tr><td class="label">$i18n{application_label}</td>
|
||||
<td class="version" id="version">
|
||||
<span id="copy-content">
|
||||
@@ -171,7 +183,15 @@ about:version template page
|
||||
<tr><td class="label">$i18n{executable_path_name}</td>
|
||||
<td class="version" id="executable_path">$i18n{executable_path}</td>
|
||||
</tr>
|
||||
- <tr><td class="label">$i18n{profile_path_name}</td>
|
||||
+<if expr="enable_cef">
|
||||
+ <tr><td class="label">$i18n{module_path_name}</td>
|
||||
+ <td class="version" id="module_path">$i18n{module_path}</td>
|
||||
+ </tr>
|
||||
+ <tr><td class="label">$i18n{user_data_path_name} <sup><a href="#footnote">[*]</a></sup></td>
|
||||
+ <td class="version" id="user_data_path">$i18n{user_data_path}</td>
|
||||
+ </tr>
|
||||
+</if>
|
||||
+ <tr><td class="label">$i18n{profile_path_name} <sup><a href="#footnote">[*]</a></sup></td>
|
||||
<td class="version" id="profile_path">$i18n{profile_path}</td>
|
||||
</tr>
|
||||
</if>
|
||||
@@ -198,6 +218,17 @@ about:version template page
|
||||
<td class="version" id="sanitizer">$i18n{sanitizer}</td>
|
||||
</tr>
|
||||
</table>
|
||||
+<if expr="enable_cef">
|
||||
+ <div id="footnote">
|
||||
+ <br/><a name="footnote">[*] In <a href="https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md" target="_new">Chromium terminology</a>,
|
||||
+ <a href="https://cef-builds.spotifycdn.com/docs/stable.html?structcef__settings__t.html#a2e2be03f34ddd93de90e1cf196757a19" target="_new">CefSettings.root_cache_path</a>
|
||||
+ is the "$i18n{user_data_path_name}" and <a href="https://cef-builds.spotifycdn.com/docs/stable.html?structcef__settings__t.html#ad1644a7eb23cad969181db010f007710" target="_new">CefSettings.cache_path</a>
|
||||
+ is the "$i18n{profile_path_name}". Chromium's <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/browser/process_singleton.h#35" target="_new">process singleton lock</a>
|
||||
+ protects against multiple app instances writing to the same "$i18n{user_data_path_name}" directory.
|
||||
+ Implement <a href="https://cef-builds.spotifycdn.com/docs/stable.html?classCefBrowserProcessHandler.html#a052a91639483467c0b546d57a05c2f06" target="_new">CefBrowserProcessHandler:: OnAlreadyRunningAppRelaunch</a>
|
||||
+ to handle the case of app relaunch with the same directory.
|
||||
+ </div>
|
||||
+</if>
|
||||
</div>
|
||||
|
||||
<div id="messages" role="alert" aria-live="polite" aria-relevant="additions">
|
||||
diff --git components/version_ui/resources/about_version.ts components/version_ui/resources/about_version.ts
|
||||
index fcd11ec05dc17..565657694f768 100644
|
||||
--- components/version_ui/resources/about_version.ts
|
||||
+++ components/version_ui/resources/about_version.ts
|
||||
@@ -50,9 +50,21 @@ function handleVariationInfo(
|
||||
* @param profilePath The profile path to display.
|
||||
*/
|
||||
function handlePathInfo(
|
||||
- {execPath, profilePath}: {execPath: string, profilePath: string}) {
|
||||
+ {execPath, profilePath
|
||||
+// <if expr="enable_cef">
|
||||
+ , modulePath, userDataPath
|
||||
+// </if>
|
||||
+ }: {execPath: string, profilePath: string
|
||||
+// <if expr="enable_cef">
|
||||
+ , modulePath: string, userDataPath: string
|
||||
+// </if>
|
||||
+ }) {
|
||||
getRequiredElement('executable_path').textContent = execPath;
|
||||
getRequiredElement('profile_path').textContent = profilePath;
|
||||
+// <if expr="enable_cef">
|
||||
+ getRequiredElement('module_path').textContent = modulePath;
|
||||
+ getRequiredElement('user_data_path').textContent = userDataPath;
|
||||
+// </if>
|
||||
}
|
||||
|
||||
// <if expr="chromeos_lacros or is_win">
|
||||
diff --git components/version_ui/version_ui_constants.cc components/version_ui/version_ui_constants.cc
|
||||
index f33bd808d6d56..75515ffa256b7 100644
|
||||
--- components/version_ui/version_ui_constants.cc
|
||||
+++ components/version_ui/version_ui_constants.cc
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
|
||||
namespace version_ui {
|
||||
|
||||
@@ -90,4 +91,15 @@ const char kVersion[] = "version";
|
||||
const char kVersionModifier[] = "version_modifier";
|
||||
const char kVersionProcessorVariation[] = "version_processor_variation";
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+const char kKeyModulePath[] = "modulePath";
|
||||
+const char kKeyUserDataPath[] = "userDataPath";
|
||||
+
|
||||
+const char kCefVersion[] = "cef_version";
|
||||
+const char kModulePath[] = "module_path";
|
||||
+const char kModulePathName[] = "module_path_name";
|
||||
+const char kUserDataPath[] = "user_data_path";
|
||||
+const char kUserDataPathName[] = "user_data_path_name";
|
||||
+#endif
|
||||
+
|
||||
} // namespace version_ui
|
||||
diff --git components/version_ui/version_ui_constants.h components/version_ui/version_ui_constants.h
|
||||
index 212f7e2114c75..d35549eb15310 100644
|
||||
--- components/version_ui/version_ui_constants.h
|
||||
+++ components/version_ui/version_ui_constants.h
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
|
||||
namespace version_ui {
|
||||
|
||||
@@ -92,6 +93,17 @@ extern const char kVersion[];
|
||||
extern const char kVersionModifier[];
|
||||
extern const char kVersionProcessorVariation[];
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+extern const char kKeyModulePath[];
|
||||
+extern const char kKeyUserDataPath[];
|
||||
+
|
||||
+extern const char kCefVersion[];
|
||||
+extern const char kModulePath[];
|
||||
+extern const char kModulePathName[];
|
||||
+extern const char kUserDataPath[];
|
||||
+extern const char kUserDataPathName[];
|
||||
+#endif
|
||||
+
|
||||
} // namespace version_ui
|
||||
|
||||
#endif // COMPONENTS_VERSION_UI_VERSION_UI_CONSTANTS_H_
|
||||
diff --git components/version_ui_strings.grdp components/version_ui_strings.grdp
|
||||
index 9f236e6217ee9..d2b7964c3a09f 100644
|
||||
--- components/version_ui_strings.grdp
|
||||
+++ components/version_ui_strings.grdp
|
||||
@@ -76,6 +76,14 @@
|
||||
<message name="IDS_VERSION_UI_PROFILE_PATH" desc="label for the profile path on the about:version page">
|
||||
Profile Path
|
||||
</message>
|
||||
+ <if expr="enable_cef">
|
||||
+ <message name="IDS_VERSION_UI_MODULE_PATH" desc="label for the module path on the about:version page">
|
||||
+ Module Path
|
||||
+ </message>
|
||||
+ <message name="IDS_VERSION_UI_USER_DATA_PATH" desc="label for the user data path on the about:version page">
|
||||
+ User Data Path
|
||||
+ </message>
|
||||
+ </if>
|
||||
<message name="IDS_VERSION_UI_PATH_NOTFOUND" desc="label for the non-existent path on the about:version page">
|
||||
No such file or directory
|
||||
</message>
|
|
@ -1,26 +1,32 @@
|
|||
diff --git chrome/app/chrome_main_delegate.cc chrome/app/chrome_main_delegate.cc
|
||||
index 2805028bc810c..bdf6f2fb7b3a1 100644
|
||||
index 2805028bc810c..0aef6f992262e 100644
|
||||
--- chrome/app/chrome_main_delegate.cc
|
||||
+++ chrome/app/chrome_main_delegate.cc
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "base/trace_event/trace_event_impl.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "cef/libcef/features/runtime.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/buildflags.h"
|
||||
#include "chrome/browser/chrome_content_browser_client.h"
|
||||
#include "chrome/browser/chrome_resource_bundle_helper.h"
|
||||
@@ -610,6 +611,9 @@ struct MainFunction {
|
||||
@@ -608,6 +609,7 @@ struct MainFunction {
|
||||
int (*function)(content::MainFunctionParams);
|
||||
};
|
||||
|
||||
+#if !BUILDFLAG(ENABLE_CEF)
|
||||
// Initializes the user data dir. Must be called before InitializeLocalState().
|
||||
void InitializeUserDataDir(base::CommandLine* command_line) {
|
||||
+ if (cef::IsChromeRuntimeEnabled()) {
|
||||
+ return;
|
||||
+ }
|
||||
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
// In debug builds of Lacros, we keep track of when the user data dir
|
||||
// is initialized, to ensure the cryptohome is not accessed before login
|
||||
@@ -847,6 +851,10 @@ ChromeMainDelegate::~ChromeMainDelegate() {
|
||||
@@ -691,6 +693,7 @@ void InitializeUserDataDir(base::CommandLine* command_line) {
|
||||
command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
}
|
||||
+#endif // !BUILDFLAG(ENABLE_CEF)
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
// If Lacros was prelaunched at login screen, this method blocks waiting
|
||||
@@ -847,6 +850,10 @@ ChromeMainDelegate::~ChromeMainDelegate() {
|
||||
ChromeMainDelegate::~ChromeMainDelegate() = default;
|
||||
#endif // !BUILDFLAG(IS_ANDROID)
|
||||
|
||||
|
@ -31,7 +37,7 @@ index 2805028bc810c..bdf6f2fb7b3a1 100644
|
|||
std::optional<int> ChromeMainDelegate::PostEarlyInitialization(
|
||||
InvokedIn invoked_in) {
|
||||
DUMP_WILL_BE_CHECK(base::ThreadPoolInstance::Get());
|
||||
@@ -872,7 +880,7 @@ std::optional<int> ChromeMainDelegate::PostEarlyInitialization(
|
||||
@@ -872,7 +879,7 @@ std::optional<int> ChromeMainDelegate::PostEarlyInitialization(
|
||||
// future session's metrics.
|
||||
DeferBrowserMetrics(user_data_dir);
|
||||
|
||||
|
@ -40,7 +46,7 @@ index 2805028bc810c..bdf6f2fb7b3a1 100644
|
|||
// In the case the process is not the singleton process, the uninstall tasks
|
||||
// need to be executed here. A window will be displayed asking to close all
|
||||
// running instances.
|
||||
@@ -1040,7 +1048,8 @@ std::optional<int> ChromeMainDelegate::PostEarlyInitialization(
|
||||
@@ -1040,7 +1047,8 @@ std::optional<int> ChromeMainDelegate::PostEarlyInitialization(
|
||||
|
||||
// Initializes the resource bundle and determines the locale.
|
||||
std::string actual_locale = LoadLocalState(
|
||||
|
@ -50,33 +56,56 @@ index 2805028bc810c..bdf6f2fb7b3a1 100644
|
|||
chrome_feature_list_creator->SetApplicationLocale(actual_locale);
|
||||
chrome_feature_list_creator->OverrideCachedUIStrings();
|
||||
|
||||
@@ -1059,7 +1068,8 @@ std::optional<int> ChromeMainDelegate::PostEarlyInitialization(
|
||||
@@ -1057,6 +1065,8 @@ std::optional<int> ChromeMainDelegate::PostEarlyInitialization(
|
||||
new net::NetworkChangeNotifierFactoryAndroid());
|
||||
#endif
|
||||
|
||||
+#if !BUILDFLAG(ENABLE_CEF)
|
||||
+ // Avoid CEF crash with multi-threaded-message-loop.
|
||||
if (base::FeatureList::IsEnabled(
|
||||
features::kWriteBasicSystemProfileToPersistentHistogramsFile)) {
|
||||
- bool record = true;
|
||||
+ // Avoid CEF crash with multi-threaded-message-loop.
|
||||
+ bool record = !cef::IsChromeRuntimeEnabled();
|
||||
bool record = true;
|
||||
@@ -1067,6 +1077,7 @@ std::optional<int> ChromeMainDelegate::PostEarlyInitialization(
|
||||
if (record)
|
||||
chrome_content_browser_client_->startup_data()->RecordCoreSystemProfile();
|
||||
}
|
||||
+#endif // !BUILDFLAG(ENABLE_CEF)
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
record =
|
||||
base::FeatureList::IsEnabled(chrome::android::kUmaBackgroundSessions);
|
||||
@@ -1506,6 +1516,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
UmaSessionStats::OnStartup();
|
||||
@@ -1506,6 +1517,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
std::string process_type =
|
||||
command_line.GetSwitchValueASCII(switches::kProcessType);
|
||||
|
||||
+ if (!cef::IsChromeRuntimeEnabled()) {
|
||||
+#if !BUILDFLAG(ENABLE_CEF)
|
||||
crash_reporter::InitializeCrashKeys();
|
||||
|
||||
#if BUILDFLAG(IS_POSIX)
|
||||
@@ -1516,6 +1527,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
@@ -1516,6 +1528,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
InitMacCrashReporter(command_line, process_type);
|
||||
SetUpInstallerPreferences(command_line);
|
||||
#endif
|
||||
+ } // !cef::IsChromeRuntimeEnabled()
|
||||
+#endif // !BUILDFLAG(ENABLE_CEF)
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
child_process_logging::Init();
|
||||
@@ -1696,7 +1708,8 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
@@ -1527,6 +1540,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
base::CPU cpu_info;
|
||||
#endif
|
||||
|
||||
+#if !BUILDFLAG(ENABLE_CEF)
|
||||
// Initialize the user data dir for any process type that needs it.
|
||||
bool initialize_user_data_dir = chrome::ProcessNeedsProfileDir(process_type);
|
||||
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
@@ -1538,6 +1552,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
if (initialize_user_data_dir) {
|
||||
InitializeUserDataDir(base::CommandLine::ForCurrentProcess());
|
||||
}
|
||||
+#endif // !BUILDFLAG(ENABLE_CEF)
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
// Generate shared resource file only on browser process. This is to avoid
|
||||
@@ -1696,7 +1711,8 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
#else
|
||||
const std::string loaded_locale =
|
||||
ui::ResourceBundle::InitSharedInstanceWithLocale(
|
||||
|
@ -86,39 +115,39 @@ index 2805028bc810c..bdf6f2fb7b3a1 100644
|
|||
|
||||
base::FilePath resources_pack_path;
|
||||
base::PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
|
||||
@@ -1726,6 +1739,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
@@ -1726,6 +1742,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
|
||||
}
|
||||
|
||||
+ if (!cef::IsChromeRuntimeEnabled()) {
|
||||
+#if !BUILDFLAG(ENABLE_CEF)
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
// Zygote needs to call InitCrashReporter() in RunZygote().
|
||||
if (process_type != switches::kZygoteProcess) {
|
||||
@@ -1761,6 +1775,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
@@ -1761,6 +1778,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
|
||||
// After all the platform Breakpads have been initialized, store the command
|
||||
// line for crash reporting.
|
||||
crash_keys::SetCrashKeysFromCommandLine(command_line);
|
||||
+ } // !cef::IsChromeRuntimeEnabled()
|
||||
+#endif // !BUILDFLAG(ENABLE_CEF)
|
||||
|
||||
#if BUILDFLAG(ENABLE_PDF)
|
||||
MaybePatchGdiGetFontData();
|
||||
@@ -1888,6 +1903,7 @@ void ChromeMainDelegate::ZygoteForked() {
|
||||
@@ -1888,6 +1906,7 @@ void ChromeMainDelegate::ZygoteForked() {
|
||||
SetUpProfilingShutdownHandler();
|
||||
}
|
||||
|
||||
+ if (!cef::IsChromeRuntimeEnabled()) {
|
||||
+#if !BUILDFLAG(ENABLE_CEF)
|
||||
// Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets
|
||||
// this up for the browser process in a different manner.
|
||||
const base::CommandLine* command_line =
|
||||
@@ -1900,6 +1916,7 @@ void ChromeMainDelegate::ZygoteForked() {
|
||||
@@ -1900,6 +1919,7 @@ void ChromeMainDelegate::ZygoteForked() {
|
||||
|
||||
// Reset the command line for the newly spawned process.
|
||||
crash_keys::SetCrashKeysFromCommandLine(*command_line);
|
||||
+ } // !cef::IsChromeRuntimeEnabled()
|
||||
+#endif // !BUILDFLAG(ENABLE_CEF)
|
||||
}
|
||||
|
||||
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
@@ -2002,6 +2019,7 @@ void ChromeMainDelegate::InitializeMemorySystem() {
|
||||
@@ -2002,6 +2022,7 @@ void ChromeMainDelegate::InitializeMemorySystem() {
|
||||
: memory_system::DispatcherParameters::
|
||||
AllocationTraceRecorderInclusion::kIgnore;
|
||||
|
||||
|
@ -126,7 +155,7 @@ index 2805028bc810c..bdf6f2fb7b3a1 100644
|
|||
memory_system::Initializer()
|
||||
.SetGwpAsanParameters(gwp_asan_boost_sampling, process_type)
|
||||
.SetProfilingClientParameters(chrome::GetChannel(),
|
||||
@@ -2009,5 +2027,5 @@ void ChromeMainDelegate::InitializeMemorySystem() {
|
||||
@@ -2009,5 +2030,5 @@ void ChromeMainDelegate::InitializeMemorySystem() {
|
||||
.SetDispatcherParameters(memory_system::DispatcherParameters::
|
||||
PoissonAllocationSamplerInclusion::kEnforce,
|
||||
allocation_recorder_inclusion, process_type)
|
||||
|
@ -173,15 +202,49 @@ index 3553377e96017..9f6edc70ef1d4 100644
|
|||
|
||||
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
std::unique_ptr<chromeos::LacrosService> lacros_service_;
|
||||
diff --git chrome/app_shim/BUILD.gn chrome/app_shim/BUILD.gn
|
||||
index 8bf88eee16370..4c4d31d6a5451 100644
|
||||
--- chrome/app_shim/BUILD.gn
|
||||
+++ chrome/app_shim/BUILD.gn
|
||||
@@ -24,6 +24,7 @@ source_set("app_shim") {
|
||||
deps = [
|
||||
"//base/allocator:early_zone_registration_apple",
|
||||
"//build:chromeos_buildflags",
|
||||
+ "//cef/libcef/features",
|
||||
"//chrome:strings",
|
||||
"//chrome/app:command_ids",
|
||||
"//chrome/browser/renderer_host:history_swiper",
|
||||
diff --git chrome/app_shim/chrome_main_app_mode_mac.mm chrome/app_shim/chrome_main_app_mode_mac.mm
|
||||
index ac1361bd6bc2e..a303ca169c7f7 100644
|
||||
--- chrome/app_shim/chrome_main_app_mode_mac.mm
|
||||
+++ chrome/app_shim/chrome_main_app_mode_mac.mm
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "base/task/single_thread_task_executor.h"
|
||||
#include "base/task/thread_pool/thread_pool_instance.h"
|
||||
#include "base/threading/thread.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/app/chrome_crash_reporter_client.h"
|
||||
#include "chrome/app_shim/app_shim_controller.h"
|
||||
#include "chrome/app_shim/app_shim_delegate.h"
|
||||
@@ -171,7 +172,9 @@ int APP_SHIM_ENTRY_POINT_NAME(const app_mode::ChromeAppModeInfo* info) {
|
||||
base::FilePath(info->user_data_dir).DirName().DirName().DirName();
|
||||
|
||||
// TODO(crbug.com/40807881): Specify `user_data_dir` to CrashPad.
|
||||
+#if !BUILDFLAG(ENABLE_CEF)
|
||||
ChromeCrashReporterClient::Create();
|
||||
+#endif
|
||||
crash_reporter::InitializeCrashpad(true, "app_shim");
|
||||
|
||||
base::PathService::OverrideAndCreateIfNeeded(
|
||||
diff --git chrome/browser/chrome_browser_main.cc chrome/browser/chrome_browser_main.cc
|
||||
index f90f1b8fa54d9..3dc8a9fe49363 100644
|
||||
index f90f1b8fa54d9..22fac24f015e1 100644
|
||||
--- chrome/browser/chrome_browser_main.cc
|
||||
+++ chrome/browser/chrome_browser_main.cc
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "cc/base/switches.h"
|
||||
+#include "cef/libcef/features/runtime.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/about_flags.h"
|
||||
#include "chrome/browser/active_use_util.h"
|
||||
#include "chrome/browser/after_startup_task_utils.h"
|
||||
|
@ -327,22 +390,7 @@ index f90f1b8fa54d9..3dc8a9fe49363 100644
|
|||
|
||||
// Desktop construction occurs here, (required before profile creation).
|
||||
PreProfileInit();
|
||||
@@ -1624,12 +1636,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
browser_process_->local_state());
|
||||
}
|
||||
|
||||
+#if !BUILDFLAG(ENABLE_CEF)
|
||||
// Needs to be done before PostProfileInit, since login manager on CrOS is
|
||||
// called inside PostProfileInit.
|
||||
content::WebUIControllerFactory::RegisterFactory(
|
||||
ChromeWebUIControllerFactory::GetInstance());
|
||||
RegisterChromeWebUIConfigs();
|
||||
RegisterChromeUntrustedWebUIConfigs();
|
||||
+#endif
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
page_info::SetPageInfoClient(new ChromePageInfoClient());
|
||||
@@ -1656,6 +1670,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
@@ -1656,6 +1668,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
// Call `PostProfileInit()`and set it up for profiles created later.
|
||||
profile_init_manager_ = std::make_unique<ProfileInitManager>(this, profile);
|
||||
|
||||
|
@ -350,7 +398,7 @@ index f90f1b8fa54d9..3dc8a9fe49363 100644
|
|||
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
// Execute first run specific code after the PrefService has been initialized
|
||||
// and preferences have been registered since some of the import code depends
|
||||
@@ -1695,6 +1710,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
@@ -1695,6 +1708,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
*base::CommandLine::ForCurrentProcess());
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
@ -358,7 +406,7 @@ index f90f1b8fa54d9..3dc8a9fe49363 100644
|
|||
|
||||
// Configure modules that need access to resources.
|
||||
net::NetModule::SetResourceProvider(ChromeNetResourceProvider);
|
||||
@@ -1786,6 +1802,11 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
@@ -1786,6 +1800,11 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
g_browser_process->profile_manager()->GetLastOpenedProfiles();
|
||||
}
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
|
@ -370,7 +418,7 @@ index f90f1b8fa54d9..3dc8a9fe49363 100644
|
|||
// This step is costly.
|
||||
if (browser_creator_->Start(*base::CommandLine::ForCurrentProcess(),
|
||||
base::FilePath(), profile_info,
|
||||
@@ -1818,11 +1839,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
@@ -1818,11 +1837,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
|
||||
// Create the RunLoop for MainMessageLoopRun() to use and transfer
|
||||
// ownership of the browser's lifetime to the BrowserProcess.
|
||||
|
|
|
@ -149,22 +149,25 @@ index 17c3d731e269b..e2caaf2934cdd 100644
|
|||
outputs = [
|
||||
"$root_out_dir/chrome.7z",
|
||||
diff --git tools/grit/grit_args.gni tools/grit/grit_args.gni
|
||||
index 79d613489bac2..86b82e96b7ec0 100644
|
||||
index 79d613489bac2..869b682d453ee 100644
|
||||
--- tools/grit/grit_args.gni
|
||||
+++ tools/grit/grit_args.gni
|
||||
@@ -5,6 +5,7 @@
|
||||
@@ -5,7 +5,9 @@
|
||||
import("//build/config/chrome_build.gni")
|
||||
import("//build/config/chromeos/ui_mode.gni")
|
||||
import("//build/config/devtools.gni")
|
||||
+import("//build/config/locales.gni")
|
||||
import("//build/config/ui.gni")
|
||||
+import("//cef/libcef/features/features.gni")
|
||||
|
||||
shared_intermediate_dir = rebase_path(root_gen_dir, root_build_dir)
|
||||
@@ -36,6 +37,8 @@ _grit_defines = [
|
||||
devtools_grd_path = "$shared_intermediate_dir/$devtools_grd_location"
|
||||
@@ -36,6 +38,9 @@ _grit_defines = [
|
||||
|
||||
# Mac and iOS want Title Case strings.
|
||||
"use_titlecase=${is_apple}",
|
||||
+
|
||||
+ "enable_cef=${enable_cef}",
|
||||
+ "enable_pseudolocales=${enable_pseudolocales}",
|
||||
]
|
||||
|
||||
|
|
|
@ -176,7 +176,6 @@ void RunWebUITest(const std::string& url) {
|
|||
|
||||
WEBUI_TEST(accessibility)
|
||||
WEBUI_TEST(blob_internals)
|
||||
WEBUI_TEST(extensions_support)
|
||||
WEBUI_TEST(gpu)
|
||||
WEBUI_TEST(histograms)
|
||||
WEBUI_TEST(indexeddb_internals)
|
||||
|
@ -189,7 +188,6 @@ WEBUI_TEST(system)
|
|||
WEBUI_TEST(tracing)
|
||||
WEBUI_TEST(version)
|
||||
WEBUI_TEST(webrtc_internals)
|
||||
WEBUI_TEST(webui_hosts)
|
||||
|
||||
// Test hosts with multiple URLs.
|
||||
|
||||
|
|
Loading…
Reference in New Issue