Commit a52fbd25 authored by thestig's avatar thestig Committed by Commit bot

Cleanup: Remove most enable_extensions logic in chrome/ extensions code.

They are no longer needed since nearly no extensions code gets built when extensions are disabled.

Review URL: https://codereview.chromium.org/680213003

Cr-Commit-Position: refs/heads/master@{#302244}
parent 21637e9a
...@@ -6,6 +6,8 @@ import("//build/config/crypto.gni") ...@@ -6,6 +6,8 @@ import("//build/config/crypto.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
assert(enable_extensions)
gypi_values = exec_script( gypi_values = exec_script(
"//build/gypi_to_gn.py", "//build/gypi_to_gn.py",
[ rebase_path("../../chrome_browser_extensions.gypi") ], [ rebase_path("../../chrome_browser_extensions.gypi") ],
......
...@@ -20,16 +20,12 @@ ...@@ -20,16 +20,12 @@
# include generated headers from these targets. # include generated headers from these targets.
# TODO(brettw) this should be made unnecessary if possible. # TODO(brettw) this should be made unnecessary if possible.
'<(DEPTH)/components/components.gyp:component_metrics_proto', '<(DEPTH)/components/components.gyp:component_metrics_proto',
'<(DEPTH)/components/components.gyp:copresence_proto',
'<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/sync/sync.gyp:sync', '<(DEPTH)/sync/sync.gyp:sync',
'<(DEPTH)/ui/accessibility/accessibility.gyp:ax_gen', '<(DEPTH)/ui/accessibility/accessibility.gyp:ax_gen',
], ],
'conditions': [ 'conditions': [
['OS != "ios" and OS != "android"', {
'dependencies': [
'<(DEPTH)/components/components.gyp:copresence_proto',
],
}],
['chromeos==1', { ['chromeos==1', {
'dependencies': [ 'dependencies': [
'<(DEPTH)/chrome/chrome.gyp:drive_proto', '<(DEPTH)/chrome/chrome.gyp:drive_proto',
......
...@@ -1482,7 +1482,6 @@ void ExtensionSettingsHandler::GetAppWindowPagesForExtensionProfile( ...@@ -1482,7 +1482,6 @@ void ExtensionSettingsHandler::GetAppWindowPagesForExtensionProfile(
ExtensionUninstallDialog* ExtensionUninstallDialog*
ExtensionSettingsHandler::GetExtensionUninstallDialog() { ExtensionSettingsHandler::GetExtensionUninstallDialog() {
#if !defined(OS_ANDROID)
if (!extension_uninstall_dialog_.get()) { if (!extension_uninstall_dialog_.get()) {
Browser* browser = chrome::FindBrowserWithWebContents( Browser* browser = chrome::FindBrowserWithWebContents(
web_ui()->GetWebContents()); web_ui()->GetWebContents());
...@@ -1492,9 +1491,6 @@ ExtensionSettingsHandler::GetExtensionUninstallDialog() { ...@@ -1492,9 +1491,6 @@ ExtensionSettingsHandler::GetExtensionUninstallDialog() {
this)); this));
} }
return extension_uninstall_dialog_.get(); return extension_uninstall_dialog_.get();
#else
return NULL;
#endif // !defined(OS_ANDROID)
} }
void ExtensionSettingsHandler::OnReinstallComplete( void ExtensionSettingsHandler::OnReinstallComplete(
......
...@@ -104,7 +104,6 @@ static_library("common") { ...@@ -104,7 +104,6 @@ static_library("common") {
gypi_values.chrome_common_extensions_sources, gypi_values.chrome_common_extensions_sources,
".", "//chrome") ".", "//chrome")
deps += [ deps += [
"//device/bluetooth", # TODO(thestig) Still needed? Not in gyp version.
"//device/usb", "//device/usb",
"//chrome/common/extensions/api", "//chrome/common/extensions/api",
"//extensions/common", "//extensions/common",
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include "chrome/common/benchmarking_messages.h" #include "chrome/common/benchmarking_messages.h"
#include "chrome/common/cast_messages.h" #include "chrome/common/cast_messages.h"
#include "chrome/common/chrome_utility_messages.h" #include "chrome/common/chrome_utility_messages.h"
// TODO(thestig) move this inside defined(ENABLE_EXTENSIONS)
#include "chrome/common/extensions/chrome_extension_messages.h"
#include "chrome/common/mac/app_shim_messages.h" #include "chrome/common/mac/app_shim_messages.h"
#include "chrome/common/prefetch_messages.h" #include "chrome/common/prefetch_messages.h"
#include "chrome/common/prerender_messages.h" #include "chrome/common/prerender_messages.h"
...@@ -16,6 +14,7 @@ ...@@ -16,6 +14,7 @@
#include "chrome/common/tts_messages.h" #include "chrome/common/tts_messages.h"
#if defined(ENABLE_EXTENSIONS) #if defined(ENABLE_EXTENSIONS)
#include "chrome/common/extensions/chrome_extension_messages.h"
#include "chrome/common/extensions/chrome_utility_extensions_messages.h" #include "chrome/common/extensions/chrome_utility_extensions_messages.h"
#endif #endif
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import("//build/json_schema_api.gni") import("//build/json_schema_api.gni")
import("schemas.gni") import("schemas.gni")
assert(enable_extensions)
# GYP version: chrome/common/extensions/api/api.gyp:chrome_api # GYP version: chrome/common/extensions/api/api.gyp:chrome_api
json_schema_api("api") { json_schema_api("api") {
schemas = true schemas = true
...@@ -23,14 +25,12 @@ json_schema_api("api_registration") { ...@@ -23,14 +25,12 @@ json_schema_api("api_registration") {
# include generated headers from these targets. # include generated headers from these targets.
# TODO(brettw) this should be made unnecessary if possible. # TODO(brettw) this should be made unnecessary if possible.
":api", ":api",
"//components/copresence/proto",
"//components/metrics/proto", "//components/metrics/proto",
"//skia", "//skia",
"//sync", "//sync",
"//ui/accessibility:ax_gen", "//ui/accessibility:ax_gen",
] ]
if (!is_ios && !is_android) {
deps += ["//components/copresence/proto"]
}
if (is_chromeos) { if (is_chromeos) {
# deps += [ "<(DEPTH)/chrome/chrome.gyp:drive_proto" ] TODO(GYP) # deps += [ "<(DEPTH)/chrome/chrome.gyp:drive_proto" ] TODO(GYP)
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
assert(enable_extensions)
gypi_values = exec_script( gypi_values = exec_script(
"//build/gypi_to_gn.py", "//build/gypi_to_gn.py",
[ rebase_path("schemas.gypi") ], [ rebase_path("schemas.gypi") ],
......
...@@ -132,14 +132,6 @@ ...@@ -132,14 +132,6 @@
'cast_streaming_udp_transport.idl', 'cast_streaming_udp_transport.idl',
], ],
'chromium_code': 1,
# Disable schema compiler to generate model extension API code.
# Only register the extension functions in extension system.
'conditions': [
# TODO(thestig): Remove this file from non-extensions build so the
# conditional and else branch goes away.
# Do the same for chrome/common/extensions/api/schemas.gni.
['enable_extensions==1', {
'non_compiled_schema_files': [ 'non_compiled_schema_files': [
'<@(main_non_compiled_schema_files)', '<@(main_non_compiled_schema_files)',
], ],
...@@ -152,14 +144,11 @@ ...@@ -152,14 +144,11 @@
'schema_include_rules': [ 'schema_include_rules': [
'<@(main_schema_include_rules)', '<@(main_schema_include_rules)',
], ],
}, { # enable_extensions==0
'non_compiled_schema_files': [ 'chromium_code': 1,
], # Disable schema compiler to generate model extension API code.
'schema_dependencies': [ # Only register the extension functions in extension system.
], 'conditions': [
'schema_files': [
],
}],
['chromeos==1', { ['chromeos==1', {
'schema_files': [ 'schema_files': [
'<@(chromeos_schema_files)', '<@(chromeos_schema_files)',
...@@ -172,7 +161,7 @@ ...@@ -172,7 +161,7 @@
}], }],
], ],
}], }],
['enable_extensions==1 and enable_webrtc==1', { ['enable_webrtc==1', {
'schema_files': [ 'schema_files': [
'<@(webrtc_schema_files)', '<@(webrtc_schema_files)',
], ],
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h" #include "chrome/common/chrome_version_info.h"
#include "chrome/common/extensions/api/generated_schemas.h"
#include "chrome/common/extensions/chrome_manifest_handlers.h" #include "chrome/common/extensions/chrome_manifest_handlers.h"
#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/features/chrome_channel_feature_filter.h" #include "chrome/common/extensions/features/chrome_channel_feature_filter.h"
...@@ -15,8 +16,10 @@ ...@@ -15,8 +16,10 @@
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
#include "chrome/grit/common_resources.h" #include "chrome/grit/common_resources.h"
#include "chrome/grit/extensions_api_resources.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "extensions/common/api/generated_schemas.h"
#include "extensions/common/common_manifest_handlers.h" #include "extensions/common/common_manifest_handlers.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/extension_api.h" #include "extensions/common/extension_api.h"
...@@ -39,14 +42,6 @@ ...@@ -39,14 +42,6 @@
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h" #include "url/gurl.h"
// TODO(thestig): Remove these #defines. This file should not be built when
// extensions are disabled.
#if defined(ENABLE_EXTENSIONS)
#include "chrome/common/extensions/api/generated_schemas.h"
#include "chrome/grit/extensions_api_resources.h"
#include "extensions/common/api/generated_schemas.h"
#endif
namespace extensions { namespace extensions {
namespace { namespace {
...@@ -85,9 +80,7 @@ void ChromeExtensionsClient::Initialize() { ...@@ -85,9 +80,7 @@ void ChromeExtensionsClient::Initialize() {
// thread runs in-process. // thread runs in-process.
if (!ManifestHandler::IsRegistrationFinalized()) { if (!ManifestHandler::IsRegistrationFinalized()) {
RegisterCommonManifestHandlers(); RegisterCommonManifestHandlers();
#if defined(ENABLE_EXTENSIONS)
RegisterChromeManifestHandlers(); RegisterChromeManifestHandlers();
#endif
ManifestHandler::FinalizeRegistration(); ManifestHandler::FinalizeRegistration();
} }
...@@ -234,31 +227,22 @@ bool ChromeExtensionsClient::IsScriptableURL( ...@@ -234,31 +227,22 @@ bool ChromeExtensionsClient::IsScriptableURL(
bool ChromeExtensionsClient::IsAPISchemaGenerated( bool ChromeExtensionsClient::IsAPISchemaGenerated(
const std::string& name) const { const std::string& name) const {
#if defined(ENABLE_EXTENSIONS)
// Test from most common to least common. // Test from most common to least common.
return api::GeneratedSchemas::IsGenerated(name) || return api::GeneratedSchemas::IsGenerated(name) ||
core_api::GeneratedSchemas::IsGenerated(name); core_api::GeneratedSchemas::IsGenerated(name);
#else
return false;
#endif
} }
base::StringPiece ChromeExtensionsClient::GetAPISchema( base::StringPiece ChromeExtensionsClient::GetAPISchema(
const std::string& name) const { const std::string& name) const {
#if defined(ENABLE_EXTENSIONS)
// Test from most common to least common. // Test from most common to least common.
if (api::GeneratedSchemas::IsGenerated(name)) if (api::GeneratedSchemas::IsGenerated(name))
return api::GeneratedSchemas::Get(name); return api::GeneratedSchemas::Get(name);
return core_api::GeneratedSchemas::Get(name); return core_api::GeneratedSchemas::Get(name);
#else
return base::StringPiece();
#endif
} }
void ChromeExtensionsClient::RegisterAPISchemaResources( void ChromeExtensionsClient::RegisterAPISchemaResources(
ExtensionAPI* api) const { ExtensionAPI* api) const {
#if defined(ENABLE_EXTENSIONS)
api->RegisterSchemaResource("accessibilityPrivate", api->RegisterSchemaResource("accessibilityPrivate",
IDR_EXTENSION_API_JSON_ACCESSIBILITYPRIVATE); IDR_EXTENSION_API_JSON_ACCESSIBILITYPRIVATE);
api->RegisterSchemaResource("app", IDR_EXTENSION_API_JSON_APP); api->RegisterSchemaResource("app", IDR_EXTENSION_API_JSON_APP);
...@@ -283,7 +267,6 @@ void ChromeExtensionsClient::RegisterAPISchemaResources( ...@@ -283,7 +267,6 @@ void ChromeExtensionsClient::RegisterAPISchemaResources(
api->RegisterSchemaResource("types.private", api->RegisterSchemaResource("types.private",
IDR_EXTENSION_API_JSON_TYPES_PRIVATE); IDR_EXTENSION_API_JSON_TYPES_PRIVATE);
api->RegisterSchemaResource("webstore", IDR_EXTENSION_API_JSON_WEBSTORE); api->RegisterSchemaResource("webstore", IDR_EXTENSION_API_JSON_WEBSTORE);
#endif // defined(ENABLE_EXTENSIONS)
} }
bool ChromeExtensionsClient::ShouldSuppressFatalErrors() const { bool ChromeExtensionsClient::ShouldSuppressFatalErrors() const {
......
...@@ -37,7 +37,6 @@ namespace extensions { ...@@ -37,7 +37,6 @@ namespace extensions {
void RegisterChromeManifestHandlers() { void RegisterChromeManifestHandlers() {
DCHECK(!ManifestHandler::IsRegistrationFinalized()); DCHECK(!ManifestHandler::IsRegistrationFinalized());
#if defined(ENABLE_EXTENSIONS)
(new AboutPageHandler)->Register(); (new AboutPageHandler)->Register();
(new AppIsolationHandler)->Register(); (new AppIsolationHandler)->Register();
(new AppLaunchManifestHandler)->Register(); (new AppLaunchManifestHandler)->Register();
...@@ -69,7 +68,6 @@ void RegisterChromeManifestHandlers() { ...@@ -69,7 +68,6 @@ void RegisterChromeManifestHandlers() {
(new UpdateURLHandler)->Register(); (new UpdateURLHandler)->Register();
(new UrlHandlersParser)->Register(); (new UrlHandlersParser)->Register();
(new URLOverridesHandler)->Register(); (new URLOverridesHandler)->Register();
#endif
} }
} // namespace extensions } // namespace extensions
...@@ -66,12 +66,10 @@ IPC_STRUCT_TRAITS_BEGIN(picasa::FolderINIContents) ...@@ -66,12 +66,10 @@ IPC_STRUCT_TRAITS_BEGIN(picasa::FolderINIContents)
IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_END()
#endif // defined(OS_WIN) || defined(OS_MACOSX) #endif // defined(OS_WIN) || defined(OS_MACOSX)
#if !defined(OS_ANDROID) && !defined(OS_IOS)
IPC_STRUCT_TRAITS_BEGIN(metadata::AttachedImage) IPC_STRUCT_TRAITS_BEGIN(metadata::AttachedImage)
IPC_STRUCT_TRAITS_MEMBER(type) IPC_STRUCT_TRAITS_MEMBER(type)
IPC_STRUCT_TRAITS_MEMBER(data) IPC_STRUCT_TRAITS_MEMBER(data)
IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_END()
#endif // !defined(OS_ANDROID) && !defined(OS_IOS)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Utility process messages: // Utility process messages:
...@@ -130,7 +128,6 @@ IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_IndexPicasaAlbumsContents, ...@@ -130,7 +128,6 @@ IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_IndexPicasaAlbumsContents,
std::vector<picasa::FolderINIContents> /* folders_inis */) std::vector<picasa::FolderINIContents> /* folders_inis */)
#endif // defined(OS_WIN) || defined(OS_MACOSX) #endif // defined(OS_WIN) || defined(OS_MACOSX)
#if !defined(OS_ANDROID) && !defined(OS_IOS)
// Tell the utility process to attempt to validate the passed media file. The // Tell the utility process to attempt to validate the passed media file. The
// file will undergo basic sanity checks and will be decoded for up to // file will undergo basic sanity checks and will be decoded for up to
// |milliseconds_of_decoding| wall clock time. It is still not safe to decode // |milliseconds_of_decoding| wall clock time. It is still not safe to decode
...@@ -147,7 +144,6 @@ IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_ParseMediaMetadata, ...@@ -147,7 +144,6 @@ IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_ParseMediaMetadata,
IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RequestBlobBytes_Finished, IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RequestBlobBytes_Finished,
int64 /* request_id */, int64 /* request_id */,
std::string /* bytes */) std::string /* bytes */)
#endif // !defined(OS_ANDROID) && !defined(OS_IOS)
// Requests that the utility process write the contents of the source file to // Requests that the utility process write the contents of the source file to
// the removable drive listed in the target file. The target will be restricted // the removable drive listed in the target file. The target will be restricted
...@@ -243,7 +239,6 @@ IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished, ...@@ -243,7 +239,6 @@ IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished,
picasa::AlbumImagesMap /* albums_images */) picasa::AlbumImagesMap /* albums_images */)
#endif // defined(OS_WIN) || defined(OS_MACOSX) #endif // defined(OS_WIN) || defined(OS_MACOSX)
#if !defined(OS_ANDROID) && !defined(OS_IOS)
// Reply after checking the passed media file. A true result indicates that // Reply after checking the passed media file. A true result indicates that
// the file appears to be a well formed media file. // the file appears to be a well formed media file.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_CheckMediaFile_Finished, IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_CheckMediaFile_Finished,
...@@ -259,7 +254,6 @@ IPC_MESSAGE_CONTROL3(ChromeUtilityHostMsg_RequestBlobBytes, ...@@ -259,7 +254,6 @@ IPC_MESSAGE_CONTROL3(ChromeUtilityHostMsg_RequestBlobBytes,
int64 /* request_id */, int64 /* request_id */,
int64 /* start_byte */, int64 /* start_byte */,
int64 /* length */) int64 /* length */)
#endif // !defined(OS_ANDROID) && !defined(OS_IOS)
// Reply when a write or verify operation succeeds. // Reply when a write or verify operation succeeds.
IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ImageWriter_Succeeded) IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ImageWriter_Succeeded)
......
...@@ -95,9 +95,6 @@ void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers( ...@@ -95,9 +95,6 @@ void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers(
extensions::Dispatcher* dispatcher, extensions::Dispatcher* dispatcher,
extensions::ModuleSystem* module_system, extensions::ModuleSystem* module_system,
extensions::ScriptContext* context) { extensions::ScriptContext* context) {
#if !defined(ENABLE_EXTENSIONS)
return;
#endif
module_system->RegisterNativeHandler( module_system->RegisterNativeHandler(
"app", "app",
scoped_ptr<NativeHandler>( scoped_ptr<NativeHandler>(
......
...@@ -25,12 +25,8 @@ ExtensionFrameHelper::~ExtensionFrameHelper() { ...@@ -25,12 +25,8 @@ ExtensionFrameHelper::~ExtensionFrameHelper() {
void ExtensionFrameHelper::WillReleaseScriptContext( void ExtensionFrameHelper::WillReleaseScriptContext(
v8::Handle<v8::Context> context, v8::Handle<v8::Context> context,
int world_id) { int world_id) {
// TODO(thestig): Remove scaffolding once this file no longer builds with
// extensions disabled.
#if defined(ENABLE_EXTENSIONS)
extension_dispatcher_->WillReleaseScriptContext( extension_dispatcher_->WillReleaseScriptContext(
render_frame()->GetWebFrame(), context, world_id); render_frame()->GetWebFrame(), context, world_id);
#endif
} }
bool ExtensionFrameHelper::OnMessageReceived(const IPC::Message& message) { bool ExtensionFrameHelper::OnMessageReceived(const IPC::Message& message) {
......
...@@ -39,22 +39,18 @@ bool RendererPermissionsPolicyDelegate::CanExecuteScriptOnPage( ...@@ -39,22 +39,18 @@ bool RendererPermissionsPolicyDelegate::CanExecuteScriptOnPage(
return true; return true;
} }
CommandLine* command_line = CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(::switches::kSigninProcess)) { if (command_line->HasSwitch(::switches::kSigninProcess)) {
if (error) if (error)
*error = errors::kCannotScriptSigninPage; *error = errors::kCannotScriptSigninPage;
return false; return false;
} }
// TODO(thestig): Remove scaffolding once this file no longer builds with if (dispatcher_->IsExtensionActive(kWebStoreAppId)) {
// extensions disabled.
#if defined(ENABLE_EXTENSIONS)
if (dispatcher_->IsExtensionActive(extensions::kWebStoreAppId)) {
if (error) if (error)
*error = errors::kCannotScriptGallery; *error = errors::kCannotScriptGallery;
return false; return false;
} }
#endif
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment