Add GN arg to disable Alloy bootstrap (see #3681, see #3685)

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:
Marshall Greenblatt
2024-04-29 21:09:17 -04:00
parent d666ec5770
commit b5d84c254d
96 changed files with 1243 additions and 516 deletions

View File

@@ -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.