mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Set enable_alloy_bootstrap=false to build with Alloy bootstrap code removed. Extension API is documented as deprecated in comments but not compiled out with this arg.
This commit is contained in:
@@ -50,10 +50,13 @@
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/extension.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
#include "extensions/common/extension.h"
|
||||
#endif
|
||||
|
||||
using content::KeyboardEventProcessingResult;
|
||||
|
||||
namespace {
|
||||
@@ -75,7 +78,11 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
|
||||
// Expect runtime style to match.
|
||||
CHECK(platform_delegate->IsAlloyStyle());
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
const bool is_devtools_popup = !!create_params.devtools_opener;
|
||||
#else
|
||||
const bool is_devtools_popup = false;
|
||||
#endif
|
||||
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefBrowserInfoManager::GetInstance()->CreateBrowserInfo(
|
||||
@@ -92,6 +99,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
|
||||
auto request_context_impl =
|
||||
static_cast<CefRequestContextImpl*>(create_params.request_context.get());
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
CefRefPtr<CefExtension> cef_extension;
|
||||
if (create_params.extension) {
|
||||
auto cef_browser_context = request_context_impl->GetBrowserContext();
|
||||
@@ -99,24 +107,39 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
|
||||
cef_browser_context->GetExtension(create_params.extension->id());
|
||||
CHECK(cef_extension);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
auto platform_delegate_ptr = platform_delegate.get();
|
||||
#endif
|
||||
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser = CreateInternal(
|
||||
create_params.settings, create_params.client, web_contents,
|
||||
own_web_contents, info, FromBaseChecked(create_params.devtools_opener),
|
||||
is_devtools_popup, request_context_impl, std::move(platform_delegate),
|
||||
cef_extension);
|
||||
own_web_contents, info,
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
FromBaseChecked(create_params.devtools_opener),
|
||||
#else
|
||||
/*opener=*/nullptr,
|
||||
#endif
|
||||
is_devtools_popup, request_context_impl, std::move(platform_delegate)
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
,
|
||||
cef_extension
|
||||
#endif
|
||||
);
|
||||
if (!browser) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GURL url = url_util::MakeGURL(create_params.url, /*fixup=*/true);
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
if (create_params.extension) {
|
||||
platform_delegate_ptr->CreateExtensionHost(
|
||||
create_params.extension, url, create_params.extension_host_type);
|
||||
} else if (!url.is_empty()) {
|
||||
} else
|
||||
#endif
|
||||
if (!url.is_empty()) {
|
||||
content::OpenURLParams params(url, content::Referrer(),
|
||||
WindowOpenDisposition::CURRENT_TAB,
|
||||
CefFrameHostImpl::kPageTransitionExplicit,
|
||||
@@ -137,8 +160,12 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
|
||||
CefRefPtr<AlloyBrowserHostImpl> opener,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
CefRefPtr<CefExtension> extension) {
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
,
|
||||
CefRefPtr<CefExtension> extension
|
||||
#endif
|
||||
) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(web_contents);
|
||||
DCHECK(browser_info);
|
||||
@@ -169,7 +196,12 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
|
||||
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser = new AlloyBrowserHostImpl(
|
||||
settings, client, web_contents, browser_info, opener, request_context,
|
||||
std::move(platform_delegate), extension);
|
||||
std::move(platform_delegate)
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
,
|
||||
extension
|
||||
#endif
|
||||
);
|
||||
browser->InitializeBrowser();
|
||||
|
||||
if (!browser->CreateHostWindow()) {
|
||||
@@ -352,6 +384,7 @@ void AlloyBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
|
||||
}
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
CefRefPtr<CefExtension> AlloyBrowserHostImpl::GetExtension() {
|
||||
return extension_;
|
||||
}
|
||||
@@ -359,6 +392,7 @@ CefRefPtr<CefExtension> AlloyBrowserHostImpl::GetExtension() {
|
||||
bool AlloyBrowserHostImpl::IsBackgroundHost() {
|
||||
return is_background_host_;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AlloyBrowserHostImpl::CanExecuteChromeCommand(int command_id) {
|
||||
return false;
|
||||
@@ -626,11 +660,13 @@ bool AlloyBrowserHostImpl::MaybeAllowNavigation(
|
||||
return true;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
extensions::ExtensionHost* AlloyBrowserHostImpl::GetExtensionHost() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(platform_delegate_);
|
||||
return platform_delegate_->GetExtensionHost();
|
||||
}
|
||||
#endif
|
||||
|
||||
void AlloyBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
@@ -942,11 +978,13 @@ content::WebContents* AlloyBrowserHostImpl::OpenURLFromTab(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool AlloyBrowserHostImpl::ShouldAllowRendererInitiatedCrossProcessNavigation(
|
||||
bool is_main_frame_navigation) {
|
||||
return platform_delegate_->ShouldAllowRendererInitiatedCrossProcessNavigation(
|
||||
is_main_frame_navigation);
|
||||
}
|
||||
#endif
|
||||
|
||||
void AlloyBrowserHostImpl::AddNewContents(
|
||||
content::WebContents* source,
|
||||
@@ -1088,11 +1126,13 @@ bool AlloyBrowserHostImpl::HandleKeyboardEvent(
|
||||
return false;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool AlloyBrowserHostImpl::PreHandleGestureEvent(
|
||||
content::WebContents* source,
|
||||
const blink::WebGestureEvent& event) {
|
||||
return platform_delegate_->PreHandleGestureEvent(source, event);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AlloyBrowserHostImpl::CanDragEnter(content::WebContents* source,
|
||||
const content::DropData& data,
|
||||
@@ -1164,10 +1204,14 @@ void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
|
||||
// We don't officially own |new_contents| until AddNewContents() is called.
|
||||
// However, we need to install observers/delegates here.
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser =
|
||||
CreateInternal(settings, client, new_contents, /*own_web_contents=*/false,
|
||||
info, opener, /*is_devtools_popup=*/false, request_context,
|
||||
std::move(platform_delegate), /*extension=*/nullptr);
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser = CreateInternal(
|
||||
settings, client, new_contents, /*own_web_contents=*/false, info, opener,
|
||||
/*is_devtools_popup=*/false, request_context, std::move(platform_delegate)
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
,
|
||||
/*extension=*/nullptr
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::RendererUnresponsive(
|
||||
@@ -1255,10 +1299,12 @@ bool AlloyBrowserHostImpl::CheckMediaAccessPermission(
|
||||
security_origin, type);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool AlloyBrowserHostImpl::IsNeverComposited(
|
||||
content::WebContents* web_contents) {
|
||||
return platform_delegate_->IsNeverComposited(web_contents);
|
||||
}
|
||||
#endif
|
||||
|
||||
content::PictureInPictureResult AlloyBrowserHostImpl::EnterPictureInPicture(
|
||||
content::WebContents* web_contents) {
|
||||
@@ -1276,8 +1322,12 @@ void AlloyBrowserHostImpl::ExitPictureInPicture() {
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::IsBackForwardCacheSupported() {
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
return true;
|
||||
#else
|
||||
// Disabled with Alloy bootstrap due to issue #3237.
|
||||
return cef::IsChromeRuntimeEnabled();
|
||||
#endif
|
||||
}
|
||||
|
||||
content::PreloadingEligibility AlloyBrowserHostImpl::IsPrerender2Supported(
|
||||
@@ -1399,8 +1449,12 @@ AlloyBrowserHostImpl::AlloyBrowserHostImpl(
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<AlloyBrowserHostImpl> opener,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
CefRefPtr<CefExtension> extension)
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
,
|
||||
CefRefPtr<CefExtension> extension
|
||||
#endif
|
||||
)
|
||||
: CefBrowserHostBase(settings,
|
||||
client,
|
||||
std::move(platform_delegate),
|
||||
@@ -1408,8 +1462,12 @@ AlloyBrowserHostImpl::AlloyBrowserHostImpl(
|
||||
request_context),
|
||||
content::WebContentsObserver(web_contents),
|
||||
opener_(kNullWindowHandle),
|
||||
is_windowless_(platform_delegate_->IsWindowless()),
|
||||
extension_(extension) {
|
||||
is_windowless_(platform_delegate_->IsWindowless())
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
,
|
||||
extension_(extension)
|
||||
#endif
|
||||
{
|
||||
contents_delegate_->ObserveWebContents(web_contents);
|
||||
|
||||
if (opener.get() && !is_views_hosted_) {
|
||||
|
@@ -25,7 +25,10 @@
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
#include "extensions/common/mojom/view_type.mojom-forward.h"
|
||||
#endif
|
||||
|
||||
class CefAudioCapturer;
|
||||
class CefBrowserInfo;
|
||||
@@ -123,8 +126,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
void SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) override;
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
CefRefPtr<CefExtension> GetExtension() override;
|
||||
bool IsBackgroundHost() override;
|
||||
#endif
|
||||
bool CanExecuteChromeCommand(int command_id) override;
|
||||
void ExecuteChromeCommand(int command_id,
|
||||
cef_window_open_disposition_t disposition) override;
|
||||
@@ -166,8 +171,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
void UpdateDragOperation(ui::mojom::DragOperation operation,
|
||||
bool document_is_handling_drag);
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
// Accessors that must be called on the UI thread.
|
||||
extensions::ExtensionHost* GetExtensionHost() const;
|
||||
#endif
|
||||
|
||||
void OnSetFocus(cef_focus_source_t source) override;
|
||||
|
||||
@@ -187,8 +194,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
const content::OpenURLParams& params,
|
||||
base::OnceCallback<void(content::NavigationHandle&)>
|
||||
navigation_handle_callback) override;
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool ShouldAllowRendererInitiatedCrossProcessNavigation(
|
||||
bool is_main_frame_navigation) override;
|
||||
#endif
|
||||
void AddNewContents(content::WebContents* source,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
const GURL& target_url,
|
||||
@@ -219,8 +228,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
bool HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool PreHandleGestureEvent(content::WebContents* source,
|
||||
const blink::WebGestureEvent& event) override;
|
||||
#endif
|
||||
bool CanDragEnter(content::WebContents* source,
|
||||
const content::DropData& data,
|
||||
blink::DragOperationsMask operations_allowed) override;
|
||||
@@ -274,7 +285,9 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
|
||||
const url::Origin& security_origin,
|
||||
blink::mojom::MediaStreamType type) override;
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool IsNeverComposited(content::WebContents* web_contents) override;
|
||||
#endif
|
||||
content::PictureInPictureResult EnterPictureInPicture(
|
||||
content::WebContents* web_contents) override;
|
||||
void ExitPictureInPicture() override;
|
||||
@@ -309,8 +322,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
CefRefPtr<AlloyBrowserHostImpl> opener,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
CefRefPtr<CefExtension> extension);
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
,
|
||||
CefRefPtr<CefExtension> extension
|
||||
#endif
|
||||
);
|
||||
|
||||
AlloyBrowserHostImpl(
|
||||
const CefBrowserSettings& settings,
|
||||
@@ -319,8 +336,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
CefRefPtr<AlloyBrowserHostImpl> opener,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
CefRefPtr<CefExtension> extension);
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
,
|
||||
CefRefPtr<CefExtension> extension
|
||||
#endif
|
||||
);
|
||||
|
||||
// Give the platform delegate an opportunity to create the host window.
|
||||
bool CreateHostWindow();
|
||||
@@ -331,8 +352,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
CefWindowHandle opener_;
|
||||
const bool is_windowless_;
|
||||
CefWindowHandle host_window_handle_ = kNullWindowHandle;
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
CefRefPtr<CefExtension> extension_;
|
||||
bool is_background_host_ = false;
|
||||
#endif
|
||||
|
||||
// Represents the current browser destruction state. Only accessed on the UI
|
||||
// thread.
|
||||
|
@@ -6,6 +6,8 @@
|
||||
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include "cef/libcef/features/features.h"
|
||||
|
||||
class DownloadPrefs;
|
||||
|
||||
namespace content {
|
||||
|
@@ -7,37 +7,55 @@
|
||||
#include <memory>
|
||||
|
||||
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
|
||||
#include "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "libcef/browser/extensions/extension_background_host.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/extensions/extension_view_host.h"
|
||||
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/net/url_util.h"
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "chrome/browser/printing/printing_init.h"
|
||||
#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/task_manager/web_contents_tags.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "chrome/browser/ui/tab_helpers.h"
|
||||
#include "components/find_in_page/find_tab_helper.h"
|
||||
#include "components/find_in_page/find_types.h"
|
||||
#include "components/javascript_dialogs/tab_modal_dialog_manager.h"
|
||||
#include "components/performance_manager/embedder/performance_manager_registry.h"
|
||||
#include "components/permissions/permission_request_manager.h"
|
||||
#include "components/zoom/zoom_controller.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "extensions/browser/process_manager.h"
|
||||
#include "pdf/pdf_features.h"
|
||||
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
#include "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h"
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
|
||||
#include "chrome/browser/printing/printing_init.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "components/javascript_dialogs/tab_modal_dialog_manager.h"
|
||||
#include "components/permissions/permission_request_manager.h"
|
||||
#include "components/zoom/zoom_controller.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
|
||||
namespace {
|
||||
|
||||
const char kAttachedHelpersUserDataKey[] = "CefAttachedHelpers";
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
const extensions::Extension* GetExtensionForUrl(
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& url) {
|
||||
auto* registry = extensions::ExtensionRegistry::Get(browser_context);
|
||||
if (!registry) {
|
||||
return nullptr;
|
||||
}
|
||||
std::string extension_id = url.host();
|
||||
return registry->enabled_extensions().GetByID(extension_id);
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserPlatformDelegateAlloy::CefBrowserPlatformDelegateAlloy()
|
||||
@@ -58,13 +76,13 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
|
||||
CHECK(browser_context);
|
||||
|
||||
scoped_refptr<content::SiteInstance> site_instance;
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
if (extensions::ExtensionsEnabled() && !create_params.url.empty()) {
|
||||
GURL gurl = url_util::MakeGURL(create_params.url, /*fixup=*/true);
|
||||
if (!create_params.extension) {
|
||||
// We might be loading an extension app view where the extension URL is
|
||||
// provided by the client.
|
||||
create_params.extension =
|
||||
extensions::GetExtensionForUrl(browser_context, gurl);
|
||||
create_params.extension = GetExtensionForUrl(browser_context, gurl);
|
||||
}
|
||||
if (create_params.extension) {
|
||||
if (create_params.extension_host_type ==
|
||||
@@ -85,6 +103,7 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
|
||||
DCHECK(site_instance);
|
||||
}
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
|
||||
content::WebContents::CreateParams wc_create_params(browser_context,
|
||||
site_instance);
|
||||
@@ -138,13 +157,16 @@ void CefBrowserPlatformDelegateAlloy::AddNewContents(
|
||||
return;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
if (extension_host_) {
|
||||
extension_host_->AddNewContents(source, std::move(new_contents), target_url,
|
||||
disposition, window_features, user_gesture,
|
||||
was_blocked);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool CefBrowserPlatformDelegateAlloy::
|
||||
ShouldAllowRendererInitiatedCrossProcessNavigation(
|
||||
bool is_main_frame_navigation) {
|
||||
@@ -154,6 +176,7 @@ bool CefBrowserPlatformDelegateAlloy::
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::RenderViewReady() {
|
||||
ConfigureAutoResize();
|
||||
@@ -179,6 +202,7 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
|
||||
std::make_unique<AlloyWebContentsDialogHelper>(web_contents_, this);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
||||
const extensions::Extension* extension,
|
||||
const GURL& url,
|
||||
@@ -219,11 +243,14 @@ extensions::ExtensionHost* CefBrowserPlatformDelegateAlloy::GetExtensionHost()
|
||||
const {
|
||||
return extension_host_;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::BrowserDestroyed(
|
||||
CefBrowserHostBase* browser) {
|
||||
if (primary_) {
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
DestroyExtensionHost();
|
||||
#endif
|
||||
owned_web_contents_.reset();
|
||||
}
|
||||
|
||||
@@ -265,6 +292,7 @@ void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool CefBrowserPlatformDelegateAlloy::PreHandleGestureEvent(
|
||||
content::WebContents* source,
|
||||
const blink::WebGestureEvent& event) {
|
||||
@@ -281,6 +309,7 @@ bool CefBrowserPlatformDelegateAlloy::IsNeverComposited(
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::SetAutoResizeEnabled(
|
||||
bool enabled,
|
||||
@@ -377,6 +406,7 @@ void CefBrowserPlatformDelegateAlloy::SetOwnedWebContents(
|
||||
owned_web_contents_.reset(owned_contents);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
void CefBrowserPlatformDelegateAlloy::DestroyExtensionHost() {
|
||||
if (!extension_host_) {
|
||||
return;
|
||||
@@ -402,6 +432,7 @@ void CefBrowserPlatformDelegateAlloy::OnExtensionHostDeleted() {
|
||||
DCHECK(extension_host_);
|
||||
extension_host_ = nullptr;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::AttachHelpers(
|
||||
content::WebContents* web_contents) {
|
||||
@@ -416,6 +447,7 @@ void CefBrowserPlatformDelegateAlloy::AttachHelpers(
|
||||
web_contents->SetUserData(&kAttachedHelpersUserDataKey,
|
||||
std::make_unique<base::SupportsUserData::Data>());
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
// Create all the helpers.
|
||||
if (cef::IsAlloyRuntimeEnabled()) {
|
||||
find_in_page::FindTabHelper::CreateForWebContents(web_contents);
|
||||
@@ -427,7 +459,9 @@ void CefBrowserPlatformDelegateAlloy::AttachHelpers(
|
||||
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
|
||||
web_contents, CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop(
|
||||
web_contents));
|
||||
} else {
|
||||
} else
|
||||
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
{
|
||||
if (IsWindowless()) {
|
||||
// Logic from ChromeContentBrowserClientCef::GetWebContentsViewDelegate
|
||||
// which is not called for windowless browsers. Needs to be done before
|
||||
|
@@ -33,14 +33,18 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||
const blink::mojom::WindowFeatures& window_features,
|
||||
bool user_gesture,
|
||||
bool* was_blocked) override;
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool ShouldAllowRendererInitiatedCrossProcessNavigation(
|
||||
bool is_main_frame_navigation) override;
|
||||
#endif
|
||||
void RenderViewReady() override;
|
||||
void BrowserCreated(CefBrowserHostBase* browser) override;
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
void CreateExtensionHost(const extensions::Extension* extension,
|
||||
const GURL& url,
|
||||
extensions::mojom::ViewType host_type) override;
|
||||
extensions::ExtensionHost* GetExtensionHost() const override;
|
||||
#endif
|
||||
void BrowserDestroyed(CefBrowserHostBase* browser) override;
|
||||
web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
|
||||
const override;
|
||||
@@ -48,9 +52,11 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
#endif
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
bool PreHandleGestureEvent(content::WebContents* source,
|
||||
const blink::WebGestureEvent& event) override;
|
||||
bool IsNeverComposited(content::WebContents* web_contents) override;
|
||||
#endif
|
||||
bool IsAlloyStyle() const override { return true; }
|
||||
void SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
@@ -83,8 +89,10 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||
private:
|
||||
void SetOwnedWebContents(content::WebContents* owned_contents);
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
void DestroyExtensionHost();
|
||||
void OnExtensionHostDeleted();
|
||||
#endif
|
||||
|
||||
void ConfigureAutoResize();
|
||||
|
||||
@@ -105,9 +113,11 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||
// matches, the find selection rectangle, etc.
|
||||
find_in_page::FindNotificationDetails last_search_result_;
|
||||
|
||||
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
||||
// Used when the browser is hosting an extension.
|
||||
extensions::ExtensionHost* extension_host_ = nullptr;
|
||||
bool is_background_host_ = false;
|
||||
#endif
|
||||
|
||||
// Used with auto-resize.
|
||||
bool auto_resize_enabled_ = false;
|
||||
|
Reference in New Issue
Block a user