diff options
author | thestig <thestig@chromium.org> | 2014-10-31 17:51:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-01 00:52:23 +0000 |
commit | da556afcb3defaa2c929797dbe09711d04279b79 (patch) | |
tree | dfcd57b8007b3674df0481e1169562d4348fccfa /extensions | |
parent | 8c848c3f4b03bceab3e847f833afd0d6bd9dd4f5 (diff) | |
download | chromium_src-da556afcb3defaa2c929797dbe09711d04279b79.zip chromium_src-da556afcb3defaa2c929797dbe09711d04279b79.tar.gz chromium_src-da556afcb3defaa2c929797dbe09711d04279b79.tar.bz2 |
Cleanup: Remove most enable_extensions logic in extensions code.
They are no longer needed since nearly no extensions code gets built when extensions are disabled.
Review URL: https://codereview.chromium.org/672403002
Cr-Commit-Position: refs/heads/master@{#302369}
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/BUILD.gn | 8 | ||||
-rw-r--r-- | extensions/browser/api/api_registration.gyp | 12 | ||||
-rw-r--r-- | extensions/common/api/BUILD.gn | 17 | ||||
-rw-r--r-- | extensions/common/api/schemas.gni | 4 | ||||
-rw-r--r-- | extensions/common/api/schemas.gypi | 20 | ||||
-rw-r--r-- | extensions/common/common_manifest_handlers.cc | 2 | ||||
-rw-r--r-- | extensions/common/permissions/usb_device_permission.cc | 9 | ||||
-rw-r--r-- | extensions/common/permissions/usb_device_permission_unittest.cc | 8 | ||||
-rw-r--r-- | extensions/extensions.gyp | 50 | ||||
-rw-r--r-- | extensions/extensions_resources.gyp | 10 | ||||
-rw-r--r-- | extensions/renderer/BUILD.gn | 4 | ||||
-rw-r--r-- | extensions/renderer/dispatcher.cc | 19 | ||||
-rw-r--r-- | extensions/renderer/dom_activity_logger.cc | 2 | ||||
-rw-r--r-- | extensions/renderer/messaging_bindings.cc | 9 | ||||
-rw-r--r-- | extensions/shell/BUILD.gn | 2 | ||||
-rw-r--r-- | extensions/shell/browser/shell_browser_main_parts.cc | 9 | ||||
-rw-r--r-- | extensions/strings/BUILD.gn | 2 |
17 files changed, 46 insertions, 141 deletions
diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index 1c9602e..b44ac89 100644 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn @@ -5,6 +5,8 @@ import("//tools/grit/grit_rule.gni") import("//tools/grit/repack.gni") +assert(enable_extensions) + # GYP version: extensions/extensions_resources.gyp:extensions_resources group("extensions_resources") { deps = [ @@ -48,15 +50,11 @@ grit("extensions_renderer_resources") { ] grit_flags = [ "-E", "mojom_root=" + rebase_path(root_gen_dir) ] - # TODO(GYP,cjhopman): GYP has this dependency guarded by enable_extensions==1, - # but I don't know how that possibly works. deps = [ "//device/serial:serial_mojo", ] } -if (enable_extensions) { - source_set("test_support") { testonly = true sources = [ @@ -277,5 +275,3 @@ test("extensions_unittests") { } } } - -} diff --git a/extensions/browser/api/api_registration.gyp b/extensions/browser/api/api_registration.gyp index 1571d68..92670e5 100644 --- a/extensions/browser/api/api_registration.gyp +++ b/extensions/browser/api/api_registration.gyp @@ -15,16 +15,10 @@ '../../common/api/schemas.gypi', ], 'dependencies': [ + '<(DEPTH)/device/serial/serial.gyp:device_serial_mojo', + '<(DEPTH)/extensions/common/api/api.gyp:cast_channel_proto', '<(DEPTH)/extensions/common/api/api.gyp:extensions_api', - ], - 'conditions': [ - ['enable_extensions==1', { - 'dependencies': [ - '<(DEPTH)/device/serial/serial.gyp:device_serial_mojo', - '<(DEPTH)/extensions/common/api/api.gyp:cast_channel_proto', - '<(DEPTH)/skia/skia.gyp:skia', - ], - }], + '<(DEPTH)/skia/skia.gyp:skia', ], }, ], diff --git a/extensions/common/api/BUILD.gn b/extensions/common/api/BUILD.gn index e8b4ac5..33126e6 100644 --- a/extensions/common/api/BUILD.gn +++ b/extensions/common/api/BUILD.gn @@ -2,9 +2,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/features.gni") import("//build/json_schema_api.gni") import("schemas.gni") +assert(enable_extensions) + # GYP version: extensions/common/api/api.gyp:extensions_api json_schema_api("api") { schemas = true @@ -16,12 +19,10 @@ json_schema_api("api_registration") { impl_dir = "//extensions/browser/api" bundle_registration = true - deps = [ ":api" ] - if (!is_android) { - deps += [ - "//device/serial", - "//extensions/common/api/cast_channel:cast_channel_proto", - "//skia", - ] - } + deps = [ + ":api", + "//device/serial", + "//extensions/common/api/cast_channel:cast_channel_proto", + "//skia", + ] } diff --git a/extensions/common/api/schemas.gni b/extensions/common/api/schemas.gni index d30a2cc..5c87167 100644 --- a/extensions/common/api/schemas.gni +++ b/extensions/common/api/schemas.gni @@ -8,8 +8,8 @@ gypi_values = exec_script( "scope", [ "schemas.gypi" ]) -sources = gypi_values.main_schema_files +sources = gypi_values.schema_files -uncompiled_sources = gypi_values.main_non_compiled_schema_files +uncompiled_sources = gypi_values.non_compiled_schema_files root_namespace = "extensions::core_api::%(namespace)s" diff --git a/extensions/common/api/schemas.gypi b/extensions/common/api/schemas.gypi index 36715aa..c3cac8c 100644 --- a/extensions/common/api/schemas.gypi +++ b/extensions/common/api/schemas.gypi @@ -8,7 +8,7 @@ ], 'variables': { 'chromium_code': 1, - 'main_schema_files': [ + 'schema_files': [ 'app_current_window_internal.idl', 'app_runtime.idl', 'app_view_guest_internal.json', @@ -47,26 +47,8 @@ 'web_view_internal.json', ], 'non_compiled_schema_files': [ - ], - 'main_non_compiled_schema_files': [ 'web_request_internal.json', ], - # TODO(thestig) Do not include this file in non-extensions builds. - # Then the conditional and else block can go away. - # Do the same for extensions/common/api/schemas.gni. - 'conditions': [ - ['enable_extensions==1', { - 'non_compiled_schema_files': [ - '<@(main_non_compiled_schema_files)', - ], - 'schema_files': [ - '<@(main_schema_files)', - ], - }, { - 'schema_files': [ - ], - }], - ], 'cc_dir': 'extensions/common/api', 'root_namespace': 'extensions::core_api::%(namespace)s', 'impl_dir_': 'extensions/browser/api', diff --git a/extensions/common/common_manifest_handlers.cc b/extensions/common/common_manifest_handlers.cc index 94c24ce..83ac8cc 100644 --- a/extensions/common/common_manifest_handlers.cc +++ b/extensions/common/common_manifest_handlers.cc @@ -27,7 +27,6 @@ namespace extensions { void RegisterCommonManifestHandlers() { DCHECK(!ManifestHandler::IsRegistrationFinalized()); -#if defined(ENABLE_EXTENSIONS) (new BackgroundManifestHandler)->Register(); (new BluetoothManifestHandler)->Register(); (new CSPHandler(false))->Register(); @@ -48,7 +47,6 @@ void RegisterCommonManifestHandlers() { (new SocketsManifestHandler)->Register(); (new WebAccessibleResourcesHandler)->Register(); (new WebviewHandler)->Register(); -#endif // defined(ENABLE_EXTENSIONS) } } // namespace extensions diff --git a/extensions/common/permissions/usb_device_permission.cc b/extensions/common/permissions/usb_device_permission.cc index cd035d4..c482e86 100644 --- a/extensions/common/permissions/usb_device_permission.cc +++ b/extensions/common/permissions/usb_device_permission.cc @@ -10,14 +10,11 @@ #include "base/logging.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" +#include "device/usb/usb_ids.h" #include "extensions/common/permissions/permissions_info.h" #include "grit/extensions_strings.h" #include "ui/base/l10n/l10n_util.h" -#if defined(ENABLE_EXTENSIONS) -#include "device/usb/usb_ids.h" -#endif - namespace extensions { UsbDevicePermission::UsbDevicePermission( @@ -33,7 +30,6 @@ PermissionMessages UsbDevicePermission::GetMessages() const { DCHECK(HasMessages()); PermissionMessages result; -#if defined(ENABLE_EXTENSIONS) // //device/usb/usb.gyp:device_usb is not available when extensions are // disabled. for (std::set<UsbDevicePermissionData>::const_iterator i = @@ -64,9 +60,6 @@ PermissionMessages UsbDevicePermission::GetMessages() const { IDS_EXTENSION_PROMPT_WARNING_USB_DEVICE_MISSING_VENDOR))); } } -#else - NOTREACHED(); -#endif // defined(ENABLE_EXTENSIONS) return result; } diff --git a/extensions/common/permissions/usb_device_permission_unittest.cc b/extensions/common/permissions/usb_device_permission_unittest.cc index ee92932..25d3137 100644 --- a/extensions/common/permissions/usb_device_permission_unittest.cc +++ b/extensions/common/permissions/usb_device_permission_unittest.cc @@ -27,13 +27,7 @@ TEST(USBDevicePermissionTest, PermissionDataOrder) { UsbDevicePermissionData(0x02ad, 0x138c, 0)); } -#if defined(ENABLE_EXTENSIONS) -#define MAYBE_PermissionMessage PermissionMessage -#else -#define MAYBE_PermissionMessage DISABLED_PermissionMessage -#endif // defined(ENABLE_EXTENSIONS) - -TEST(USBDevicePermissionTest, MAYBE_PermissionMessage) { +TEST(USBDevicePermissionTest, PermissionMessage) { const char* const kMessages[] = { "Access the USB device PVR Mass Storage from HUMAX Co., Ltd.", "Access the USB device from HUMAX Co., Ltd.", diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index 46a2b69..4bff304 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -47,6 +47,10 @@ '../components/components.gyp:url_matcher', '../content/content.gyp:content_common', '../crypto/crypto.gyp:crypto', + '../device/bluetooth/bluetooth.gyp:device_bluetooth', + # For Mojo generated headers for generated_api.cc. + '../device/serial/serial.gyp:device_serial_mojo', + '../device/usb/usb.gyp:device_usb', '../ipc/ipc.gyp:ipc', '../net/net.gyp:net', '../third_party/re2/re2.gyp:re2', @@ -55,6 +59,7 @@ '../ui/gfx/ipc/gfx_ipc.gyp:gfx_ipc', '../url/url.gyp:url_lib', '../third_party/libxml/libxml.gyp:libxml', + 'common/api/api.gyp:extensions_api', 'extensions_resources.gyp:extensions_resources', 'extensions_strings.gyp:extensions_strings', 'extensions_common_constants', @@ -258,36 +263,6 @@ # Disable c4267 warnings until we fix size_t to int truncations. 'msvs_disabled_warnings': [ 4267, ], 'conditions': [ - ['enable_extensions==1', { - 'dependencies': [ - 'common/api/api.gyp:extensions_api', - '../device/bluetooth/bluetooth.gyp:device_bluetooth', - # For Mojo generated headers for generated_api.cc. - '../device/serial/serial.gyp:device_serial_mojo', - '../device/usb/usb.gyp:device_usb', - ], - }, { # enable_extensions == 0 - 'sources!': [ - 'common/api/bluetooth/bluetooth_manifest_data.cc', - 'common/api/bluetooth/bluetooth_manifest_data.h', - 'common/api/bluetooth/bluetooth_manifest_handler.cc', - 'common/api/bluetooth/bluetooth_manifest_handler.h', - 'common/api/bluetooth/bluetooth_manifest_permission.cc', - 'common/api/bluetooth/bluetooth_manifest_permission.h', - 'common/api/messaging/message.h', - 'common/api/sockets/sockets_manifest_data.cc', - 'common/api/sockets/sockets_manifest_data.h', - 'common/api/sockets/sockets_manifest_handler.cc', - 'common/api/sockets/sockets_manifest_handler.h', - 'common/api/sockets/sockets_manifest_permission.cc', - 'common/api/sockets/sockets_manifest_permission.h', - 'common/extension_api.cc', - 'common/manifest_handlers/externally_connectable.cc', - 'common/manifest_handlers/externally_connectable.h', - 'common/manifest_handlers/options_page_info.cc', - 'common/manifest_handlers/options_page_info.h', - ], - }], ['disable_nacl==0', { # NaClModulesHandler does not use any code in NaCl, so no dependency # on nacl_common. @@ -787,19 +762,12 @@ 'browser/warning_set.h', ], 'conditions': [ - ['enable_extensions==0', { - # Exclude all API implementations and the ExtensionsApiClient - # interface. Moving an API from src/chrome to src/extensions implies - # it can be cleanly disabled with enable_extensions==0. - # TODO: Eventually the entire extensions module should not be built - # when enable_extensions==0. - 'sources/': [ - ['exclude', '^browser/'], - ], + # This condition exists only because the extensions_common_constants + # target is always built and thus this file gets evaluated by GYP. + # This does not need to be replicated into extensions/browser/BUILD.gn. + ['OS == "ios" or OS == "android"', { 'dependencies!': [ '../components/components.gyp:storage_monitor', - '../device/bluetooth/bluetooth.gyp:device_bluetooth', - '../device/serial/serial.gyp:device_serial', ], }], ['use_openssl==1', { diff --git a/extensions/extensions_resources.gyp b/extensions/extensions_resources.gyp index 53c44dc..ed81dee 100644 --- a/extensions/extensions_resources.gyp +++ b/extensions/extensions_resources.gyp @@ -10,6 +10,9 @@ 'variables': { 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/extensions', }, + 'dependencies': [ + '../device/serial/serial.gyp:device_serial_mojo', + ], 'actions': [ { 'action_name': 'generate_extensions_resources', @@ -37,13 +40,6 @@ }, ], 'includes': [ '../build/grit_target.gypi' ], - 'conditions': [ - ['enable_extensions==1', { - 'dependencies': [ - '../device/serial/serial.gyp:device_serial_mojo', - ], - }], - ], } ] } diff --git a/extensions/renderer/BUILD.gn b/extensions/renderer/BUILD.gn index ded00cf..703ad5f 100644 --- a/extensions/renderer/BUILD.gn +++ b/extensions/renderer/BUILD.gn @@ -2,6 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/features.gni") + +assert(enable_extensions) + # GYP version: extensions/extensions.gyp:extensions_renderer source_set("renderer") { sources = [ diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index f594b19..1de7dcf 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc @@ -189,7 +189,7 @@ Dispatcher::Dispatcher(DispatcherDelegate* delegate) webrequest_used_(false) { const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); is_extension_process_ = - command_line.HasSwitch(extensions::switches::kExtensionProcess) || + command_line.HasSwitch(switches::kExtensionProcess) || command_line.HasSwitch(::switches::kSingleProcess); if (is_extension_process_) { @@ -260,10 +260,6 @@ void Dispatcher::DidCreateScriptContext( const v8::Handle<v8::Context>& v8_context, int extension_group, int world_id) { -#if !defined(ENABLE_EXTENSIONS) - return; -#endif - const Extension* extension = GetExtensionFromFrameAndWorld(frame, world_id, false); const Extension* effective_extension = @@ -326,7 +322,7 @@ void Dispatcher::DidCreateScriptContext( if (context->GetAvailability("appViewEmbedderInternal").is_available()) { module_system->Require("appView"); - } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { + } else if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { module_system->Require("denyAppView"); } @@ -340,7 +336,7 @@ void Dispatcher::DidCreateScriptContext( .is_available()) { module_system->Require("webViewExperimental"); } - } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { + } else if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { module_system->Require("denyWebView"); } @@ -393,10 +389,6 @@ void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) { frame->document().insertStyleSheet(WebString::fromUTF8(stylesheet)); } - // This preprocessor directive is because this file is still built in Android - // builds, but OptionsPageInfo is not. For Android builds, exclude this block - // of code to prevent link errors. -#if defined(ENABLE_EXTENSIONS) // If this is an extension options page, and the extension has opted into // using Chrome styles, then insert the Chrome extension stylesheet. if (extension && extension->is_extension() && @@ -407,7 +399,6 @@ void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) { .GetRawDataResource(IDR_EXTENSION_CSS) .as_string())); } -#endif content_watcher_->DidCreateDocumentElement(frame); } @@ -830,8 +821,8 @@ void Dispatcher::OnActivateExtension(const std::string& extension_id) { RenderThread::Get()->ScheduleIdleHandler(kInitialExtensionIdleHandlerDelayMs); if (is_webkit_initialized_) { - extensions::DOMActivityLogger::AttachToWorld( - extensions::DOMActivityLogger::kMainWorldId, extension_id); + DOMActivityLogger::AttachToWorld( + DOMActivityLogger::kMainWorldId, extension_id); InitOriginPermissions(extension); } diff --git a/extensions/renderer/dom_activity_logger.cc b/extensions/renderer/dom_activity_logger.cc index 98408ee..213e147 100644 --- a/extensions/renderer/dom_activity_logger.cc +++ b/extensions/renderer/dom_activity_logger.cc @@ -47,7 +47,6 @@ DOMActivityLogger::~DOMActivityLogger() {} void DOMActivityLogger::AttachToWorld(int world_id, const std::string& extension_id) { -#if defined(ENABLE_EXTENSIONS) // If there is no logger registered for world_id, construct a new logger // and register it with world_id. if (!blink::hasDOMActivityLogger(world_id, @@ -57,7 +56,6 @@ void DOMActivityLogger::AttachToWorld(int world_id, WebString::fromUTF8(extension_id), logger); } -#endif } void DOMActivityLogger::logGetter(const WebString& api_name, diff --git a/extensions/renderer/messaging_bindings.cc b/extensions/renderer/messaging_bindings.cc index 7902cc0..cbb9ec2 100644 --- a/extensions/renderer/messaging_bindings.cc +++ b/extensions/renderer/messaging_bindings.cc @@ -18,6 +18,7 @@ #include "content/public/renderer/v8_value_converter.h" #include "extensions/common/api/messaging/message.h" #include "extensions/common/extension_messages.h" +#include "extensions/common/manifest_handlers/externally_connectable.h" #include "extensions/renderer/dispatcher.h" #include "extensions/renderer/event_bindings.h" #include "extensions/renderer/object_backed_native_handler.h" @@ -30,12 +31,6 @@ #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" #include "v8/include/v8.h" -// TODO(thestig): Remove #ifdef from this file when extensions are no longer -// used on mobile. -#if defined(ENABLE_EXTENSIONS) -#include "extensions/common/manifest_handlers/externally_connectable.h" -#endif - // Message passing API example (in a content script): // var extension = // new chrome.Extension('00123456789abcdef0123456789abcdef0123456'); @@ -266,7 +261,6 @@ void DispatchOnConnectToScriptContext( if (!source_tab->empty() && !extension->is_platform_app()) tab = converter->ToV8Value(source_tab, script_context->v8_context()); -#if defined(ENABLE_EXTENSIONS) ExternallyConnectableInfo* externally_connectable = ExternallyConnectableInfo::Get(extension); if (externally_connectable && @@ -276,7 +270,6 @@ void DispatchOnConnectToScriptContext( v8::String::kNormalString, tls_channel_id.size()); } -#endif } v8::Handle<v8::Value> arguments[] = { diff --git a/extensions/shell/BUILD.gn b/extensions/shell/BUILD.gn index 3810f66..b667ba1 100644 --- a/extensions/shell/BUILD.gn +++ b/extensions/shell/BUILD.gn @@ -4,6 +4,8 @@ import("//tools/grit/grit_rule.gni") +assert(enable_extensions) + grit("resources") { source = "app_shell_resources.grd" outputs = [ diff --git a/extensions/shell/browser/shell_browser_main_parts.cc b/extensions/shell/browser/shell_browser_main_parts.cc index e9708f1..3387311 100644 --- a/extensions/shell/browser/shell_browser_main_parts.cc +++ b/extensions/shell/browser/shell_browser_main_parts.cc @@ -8,6 +8,7 @@ #include "base/run_loop.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/omaha_query_params/omaha_query_params.h" +#include "components/storage_monitor/storage_monitor.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/context_factory.h" #include "content/public/common/result_codes.h" @@ -34,10 +35,6 @@ #include "ui/base/ime/input_method_initializer.h" #include "ui/base/resource/resource_bundle.h" -#if !defined(OS_ANDROID) && !defined(OS_IOS) -#include "components/storage_monitor/storage_monitor.h" -#endif - #if defined(OS_CHROMEOS) #include "chromeos/audio/cras_audio_handler.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -120,9 +117,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { aura::Env::GetInstance()->set_context_factory(content::GetContextFactory()); -#if !defined(OS_ANDROID) && !defined(OS_IOS) storage_monitor::StorageMonitor::Create(); -#endif desktop_controller_.reset(browser_main_delegate_->CreateDesktopController()); @@ -215,9 +210,7 @@ void ShellBrowserMainParts::PostMainMessageLoopRun() { desktop_controller_.reset(); -#if !defined(OS_ANDROID) && !defined(OS_IOS) storage_monitor::StorageMonitor::Destroy(); -#endif } void ShellBrowserMainParts::PostDestroyThreads() { diff --git a/extensions/strings/BUILD.gn b/extensions/strings/BUILD.gn index 56005dc..bd9833b 100644 --- a/extensions/strings/BUILD.gn +++ b/extensions/strings/BUILD.gn @@ -4,6 +4,8 @@ import("//tools/grit/grit_rule.gni") +assert(enable_extensions) + # GYP version: extensions/extensions_strings.gyp:extensions_strings grit("strings") { # This target is in this directory since it matches the output grit path for |