File extensions-common-assert.patch of Package nodejs-electron
From cf0e064ce3b7c6b809861a6d299165b74cce109e Mon Sep 17 00:00:00 2001
From: James Cook <jamescook@chromium.org>
Date: Thu, 22 May 2025 10:23:47 -0700
Subject: [PATCH] extensions: Clean up ENABLE_EXTENSIONS in //extensions
TestRuntimeApiDelegate can be safely added to the build now.
Also, replace ENABLE_EXTENSIONS || ENABLE_DESKTOP_ANDROID_EXTENSIONS
with ENABLE_EXTENSIONS_CORE, to be consistent with the rest of the
codebase.
Bug: 356905053
Change-Id: I616391c2843c6c5e20188803f2a51c6f83165927
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6576511
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1464202}
---
extensions/BUILD.gn | 12 ++----------
extensions/browser/extension_registry.h | 3 +--
extensions/browser/extension_system.h | 3 +--
extensions/browser/test_extensions_browser_client.cc | 12 +-----------
extensions/common/extension.h | 3 +--
5 files changed, 6 insertions(+), 27 deletions(-)
diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn
index 0ea291f16ba70b..586fd7461e4cd9 100644
--- a/extensions/BUILD.gn
+++ b/extensions/BUILD.gn
@@ -111,6 +111,8 @@ static_library("test_support") {
"browser/test_image_loader.h",
"browser/test_management_policy.cc",
"browser/test_management_policy.h",
+ "browser/test_runtime_api_delegate.cc",
+ "browser/test_runtime_api_delegate.h",
"common/extension_builder.cc",
"common/extension_builder.h",
"common/manifest_test.cc",
@@ -198,16 +200,6 @@ static_library("test_support") {
deps += [ "//components/guest_view/browser:test_support" ]
}
- # TODO(https://crbug.com/356905053): The following files don't compile cleanly
- # with desktop-android. Either make them compile, or determine they should
- # not be included and place them under a more appropriate if-block.
- if (enable_extensions) {
- sources += [
- "browser/test_runtime_api_delegate.cc",
- "browser/test_runtime_api_delegate.h",
- ]
- }
-
# Generally, //extensions should not depend on //chromeos. However, a number
# of the APIs and the extensions shell already do. We should try to avoid
# expanding these dependencies.
diff --git a/extensions/browser/extension_registry.h b/extensions/browser/extension_registry.h
index 4ed65fdce8af21..1ee1b70458a068 100644
--- a/extensions/browser/extension_registry.h
+++ b/extensions/browser/extension_registry.h
@@ -19,8 +19,7 @@
#include "extensions/common/extension_id.h"
#include "extensions/common/extension_set.h"
-static_assert(BUILDFLAG(ENABLE_EXTENSIONS) ||
- BUILDFLAG(ENABLE_DESKTOP_ANDROID_EXTENSIONS));
+static_assert(BUILDFLAG(ENABLE_EXTENSIONS_CORE));
namespace content {
class BrowserContext;
diff --git a/extensions/browser/extension_system.h b/extensions/browser/extension_system.h
index 369dad723495a4..eccf3b2d331724 100644
--- a/extensions/browser/extension_system.h
+++ b/extensions/browser/extension_system.h
@@ -17,8 +17,7 @@
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
-static_assert(BUILDFLAG(ENABLE_EXTENSIONS) ||
- BUILDFLAG(ENABLE_DESKTOP_ANDROID_EXTENSIONS));
+static_assert(BUILDFLAG(ENABLE_EXTENSIONS_CORE));
namespace base {
class OneShotEvent;
diff --git a/extensions/browser/test_extensions_browser_client.cc b/extensions/browser/test_extensions_browser_client.cc
index 88ce18dd343016..f914fae7205f88 100644
--- a/extensions/browser/test_extensions_browser_client.cc
+++ b/extensions/browser/test_extensions_browser_client.cc
@@ -10,6 +10,7 @@
#include "build/chromeos_buildflags.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/extension_host_delegate.h"
+#include "extensions/browser/test_runtime_api_delegate.h"
#include "extensions/browser/updater/null_extension_cache.h"
#include "extensions/buildflags/buildflags.h"
#include "extensions/common/extension_id.h"
@@ -17,13 +18,6 @@
#include "services/network/public/mojom/url_loader.mojom.h"
#include "ui/base/l10n/l10n_util.h"
-// TODO(https://crbug.com/356905053): The following files don't compile cleanly
-// with desktop-android. Either make them compile, or determine they should
-// not be included and place them under a more appropriate if-block.
-#if BUILDFLAG(ENABLE_EXTENSIONS)
-#include "extensions/browser/test_runtime_api_delegate.h"
-#endif
-
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/login/login_state/login_state.h"
#endif
@@ -260,11 +254,7 @@ void TestExtensionsBrowserClient::RegisterBrowserInterfaceBindersForFrame(
std::unique_ptr<RuntimeAPIDelegate>
TestExtensionsBrowserClient::CreateRuntimeAPIDelegate(
content::BrowserContext* context) const {
-#if BUILDFLAG(ENABLE_EXTENSIONS)
return std::unique_ptr<RuntimeAPIDelegate>(new TestRuntimeAPIDelegate());
-#else
- return nullptr;
-#endif
}
const ComponentExtensionResourceManager*
diff --git a/extensions/common/extension.h b/extensions/common/extension.h
index ec776e6207057b..33a196f11a519a 100644
--- a/extensions/common/extension.h
+++ b/extensions/common/extension.h
@@ -29,8 +29,7 @@
#include "url/gurl.h"
#include "url/origin.h"
-static_assert(BUILDFLAG(ENABLE_EXTENSIONS) ||
- BUILDFLAG(ENABLE_DESKTOP_ANDROID_EXTENSIONS));
+static_assert(BUILDFLAG(ENABLE_EXTENSIONS_CORE));
namespace extensions {
class HashedExtensionId;