diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-22 22:38:39 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-22 22:38:39 +0000 |
commit | 585c9dd77856582dd3bbdf773ae9b63b51f8c200 (patch) | |
tree | ffcc6dbdaf73f7866558315e4ceb234d270b4667 | |
parent | 63c8cb0e1d055530f8c29250c68553175f2b1287 (diff) | |
download | chromium_src-585c9dd77856582dd3bbdf773ae9b63b51f8c200.zip chromium_src-585c9dd77856582dd3bbdf773ae9b63b51f8c200.tar.gz chromium_src-585c9dd77856582dd3bbdf773ae9b63b51f8c200.tar.bz2 |
The chrome browser target should not depend on plugins.
This in turn brings with it a dependency on webkit_glue which in turn brings in webkit.
We should only depend on plugins_common in the browser.
The pepper component updater for flash is the only component in the browser which depends
on webkit\plugins\ppapi. This is to check if the interface name passed in is supported by the browser.
I added a function IsSupportedPepperInterface to the newly added ppapi_utils.cc/.h file which lives in
webkit/common/plugins/ppapi
Added a macro LEGACY_IFACE to the newly added ppapi/thunk/interfaces_legacy.h file. This macro consolidates
the list of interfaces being checked for on the browser. It is used in plugin_module.cc and ppapi_utils.cc
BUG=237249
TBR=cpu@chromium.org, jamesr@chromium.org, raymes@chromium.org, yzshen@chromium.org
Review URL: https://codereview.chromium.org/15505004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201623 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/DEPS | 1 | ||||
-rw-r--r-- | chrome/browser/component_updater/pepper_flash_component_installer.cc | 6 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 1 | ||||
-rw-r--r-- | ppapi/thunk/interfaces_legacy.h | 51 | ||||
-rw-r--r-- | webkit/common/DEPS | 3 | ||||
-rw-r--r-- | webkit/common/plugins/ppapi/ppapi_utils.cc | 132 | ||||
-rw-r--r-- | webkit/common/plugins/ppapi/ppapi_utils.h | 20 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_module.cc | 53 | ||||
-rw-r--r-- | webkit/plugins/webkit_plugins.gypi | 2 |
9 files changed, 219 insertions, 50 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 8cd920a..b32c863 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -52,6 +52,7 @@ include_rules = [ "+webkit/appcache", "+webkit/base/origin_url_conversions.h", "+webkit/blob", + "+webkit/common/plugins", # Common plugins functionality. "+webkit/dom_storage/dom_storage_types.h", "+webkit/fileapi", "+webkit/plugins", # Defines some types that are marshalled over IPC. diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc index 2663824..98396ca 100644 --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,8 +33,8 @@ #include "content/public/browser/plugin_service.h" #include "content/public/common/pepper_plugin_info.h" #include "ppapi/c/private/ppb_pdf.h" +#include "webkit/common/plugins/ppapi/ppapi_utils.h" #include "webkit/plugins/plugin_constants.h" -#include "webkit/plugins/ppapi/plugin_module.h" #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. @@ -123,7 +123,7 @@ bool GetPepperFlashDirectory(base::FilePath* latest_dir, // Returns true if the Pepper |interface_name| is implemented by this browser. // It does not check if the interface is proxied. bool SupportsPepperInterface(const char* interface_name) { - if (webkit::ppapi::PluginModule::SupportsInterface(interface_name)) + if (webkit::ppapi::IsSupportedPepperInterface(interface_name)) return true; // The PDF interface is invisible to SupportsInterface() on the browser // process because it is provided using PpapiInterfaceFactoryManager. We need diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 85fef34..9ce7045 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2334,7 +2334,6 @@ '../ui/web_dialogs/web_dialogs.gyp:web_dialogs', '../v8/tools/gyp/v8.gyp:v8', '../webkit/support/webkit_support.gyp:glue_common', - '../webkit/support/webkit_support.gyp:plugins', '../webkit/support/webkit_support.gyp:plugins_common', '../webkit/support/webkit_support.gyp:webkit_resources', '../webkit/support/webkit_support.gyp:webkit_storage', diff --git a/ppapi/thunk/interfaces_legacy.h b/ppapi/thunk/interfaces_legacy.h new file mode 100644 index 0000000..9d03bbe --- /dev/null +++ b/ppapi/thunk/interfaces_legacy.h @@ -0,0 +1,51 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#ifndef LEGACY_IFACE +#define LEGACY_IFACE(iface_str, function_name) +#endif + +LEGACY_IFACE(PPB_AUDIO_TRUSTED_INTERFACE_0_6, + ::ppapi::thunk::GetPPB_AudioTrusted_0_6_Thunk()) +LEGACY_IFACE(PPB_BUFFER_TRUSTED_INTERFACE_0_1, + ::ppapi::thunk::GetPPB_BufferTrusted_0_1_Thunk()) +LEGACY_IFACE(PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0, + ::ppapi::thunk::GetPPB_Graphics3DTrusted_1_0_Thunk()) +LEGACY_IFACE(PPB_IMAGEDATA_TRUSTED_INTERFACE_0_4, + ::ppapi::thunk::GetPPB_ImageDataTrusted_0_4_Thunk()) +LEGACY_IFACE(PPB_INPUT_EVENT_INTERFACE_1_0, + ::ppapi::thunk::GetPPB_InputEvent_1_0_Thunk()) +LEGACY_IFACE(PPB_INSTANCE_PRIVATE_INTERFACE_0_1, + ::ppapi::thunk::GetPPB_Instance_Private_0_1_Thunk()) +LEGACY_IFACE(PPB_CORE_INTERFACE_1_0, &core_interface) +LEGACY_IFACE(PPB_GPUBLACKLIST_PRIVATE_INTERFACE, + PPB_GpuBlacklist_Private_Impl::GetInterface()) +LEGACY_IFACE(PPB_OPENGLES2_INTERFACE, + ::ppapi::PPB_OpenGLES2_Shared::GetInterface()) +LEGACY_IFACE(PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE, + ::ppapi::PPB_OpenGLES2_Shared::GetInstancedArraysInterface()) +LEGACY_IFACE(PPB_OPENGLES2_FRAMEBUFFERBLIT_INTERFACE, + ::ppapi::PPB_OpenGLES2_Shared::GetFramebufferBlitInterface()) +LEGACY_IFACE( + PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_INTERFACE, + ::ppapi::PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface()) +LEGACY_IFACE(PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE, + ::ppapi::PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface()) +LEGACY_IFACE(PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE, + ::ppapi::PPB_OpenGLES2_Shared::GetChromiumMapSubInterface()) +LEGACY_IFACE(PPB_OPENGLES2_CHROMIUMMAPSUB_DEV_INTERFACE_1_0, + ::ppapi::PPB_OpenGLES2_Shared::GetChromiumMapSubInterface()) +LEGACY_IFACE(PPB_OPENGLES2_QUERY_INTERFACE, + ::ppapi::PPB_OpenGLES2_Shared::GetQueryInterface()) +LEGACY_IFACE(PPB_PROXY_PRIVATE_INTERFACE, PPB_Proxy_Impl::GetInterface()) +LEGACY_IFACE(PPB_UMA_PRIVATE_INTERFACE, PPB_UMA_Private_Impl::GetInterface()) +LEGACY_IFACE(PPB_VAR_DEPRECATED_INTERFACE, + PPB_Var_Deprecated_Impl::GetVarDeprecatedInterface()) +LEGACY_IFACE(PPB_VAR_INTERFACE_1_0, + ::ppapi::PPB_Var_Shared::GetVarInterface1_0()) +LEGACY_IFACE(PPB_VAR_INTERFACE_1_1, + ::ppapi::PPB_Var_Shared::GetVarInterface1_1()) +LEGACY_IFACE(PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0, + ::ppapi::PPB_Var_Shared::GetVarArrayBufferInterface1_0()) + + diff --git a/webkit/common/DEPS b/webkit/common/DEPS index dea5c28..848f417 100644 --- a/webkit/common/DEPS +++ b/webkit/common/DEPS @@ -1,4 +1,7 @@ include_rules = [ + "+ppapi/c", + "+ppapi/shared_impl", + "+ppapi/thunk", "-webkit/browser", "-webkit/renderer", ] diff --git a/webkit/common/plugins/ppapi/ppapi_utils.cc b/webkit/common/plugins/ppapi/ppapi_utils.cc new file mode 100644 index 0000000..c4a65b8 --- /dev/null +++ b/webkit/common/plugins/ppapi/ppapi_utils.cc @@ -0,0 +1,132 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#include "webkit/common/plugins/ppapi/ppapi_utils.h" + +#include <cstring> + +#include "ppapi/c/dev/ppb_audio_input_dev.h" +#include "ppapi/c/dev/ppb_buffer_dev.h" +#include "ppapi/c/dev/ppb_char_set_dev.h" +#include "ppapi/c/dev/ppb_crypto_dev.h" +#include "ppapi/c/dev/ppb_cursor_control_dev.h" +#include "ppapi/c/dev/ppb_device_ref_dev.h" +#include "ppapi/c/dev/ppb_file_chooser_dev.h" +#include "ppapi/c/dev/ppb_find_dev.h" +#include "ppapi/c/dev/ppb_font_dev.h" +#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h" +#include "ppapi/c/dev/ppb_graphics_2d_dev.h" +#include "ppapi/c/dev/ppb_ime_input_event_dev.h" +#include "ppapi/c/dev/ppb_keyboard_input_event_dev.h" +#include "ppapi/c/dev/ppb_memory_dev.h" +#include "ppapi/c/dev/ppb_opengles2ext_dev.h" +#include "ppapi/c/dev/ppb_printing_dev.h" +#include "ppapi/c/dev/ppb_resource_array_dev.h" +#include "ppapi/c/dev/ppb_scrollbar_dev.h" +#include "ppapi/c/dev/ppb_testing_dev.h" +#include "ppapi/c/dev/ppb_text_input_dev.h" +#include "ppapi/c/dev/ppb_trace_event_dev.h" +#include "ppapi/c/dev/ppb_truetype_font_dev.h" +#include "ppapi/c/dev/ppb_url_util_dev.h" +#include "ppapi/c/dev/ppb_var_array_dev.h" +#include "ppapi/c/dev/ppb_var_deprecated.h" +#include "ppapi/c/dev/ppb_var_dictionary_dev.h" +#include "ppapi/c/dev/ppb_video_capture_dev.h" +#include "ppapi/c/dev/ppb_video_decoder_dev.h" +#include "ppapi/c/dev/ppb_view_dev.h" +#include "ppapi/c/dev/ppb_widget_dev.h" +#include "ppapi/c/dev/ppb_zoom_dev.h" +#include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h" +#include "ppapi/c/extensions/dev/ppb_ext_socket_dev.h" +#include "ppapi/c/ppb_audio.h" +#include "ppapi/c/ppb_audio_config.h" +#include "ppapi/c/ppb_console.h" +#include "ppapi/c/ppb_core.h" +#include "ppapi/c/ppb_file_io.h" +#include "ppapi/c/ppb_file_ref.h" +#include "ppapi/c/ppb_file_system.h" +#include "ppapi/c/ppb_fullscreen.h" +#include "ppapi/c/ppb_gamepad.h" +#include "ppapi/c/ppb_graphics_2d.h" +#include "ppapi/c/ppb_graphics_3d.h" +#include "ppapi/c/ppb_image_data.h" +#include "ppapi/c/ppb_input_event.h" +#include "ppapi/c/ppb_instance.h" +#include "ppapi/c/ppb_messaging.h" +#include "ppapi/c/ppb_mouse_cursor.h" +#include "ppapi/c/ppb_mouse_lock.h" +#include "ppapi/c/ppb_opengles2.h" +#include "ppapi/c/ppb_url_loader.h" +#include "ppapi/c/ppb_url_request_info.h" +#include "ppapi/c/ppb_url_response_info.h" +#include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_var_array_buffer.h" +#include "ppapi/c/ppb_view.h" +#include "ppapi/c/ppb_websocket.h" +#include "ppapi/c/private/ppb_content_decryptor_private.h" +#include "ppapi/c/private/ppb_ext_crx_file_system_private.h" +#include "ppapi/c/private/ppb_file_io_private.h" +#include "ppapi/c/private/ppb_file_ref_private.h" +#include "ppapi/c/private/ppb_flash.h" +#include "ppapi/c/private/ppb_flash_clipboard.h" +#include "ppapi/c/private/ppb_flash_device_id.h" +#include "ppapi/c/private/ppb_flash_file.h" +#include "ppapi/c/private/ppb_flash_font_file.h" +#include "ppapi/c/private/ppb_flash_fullscreen.h" +#include "ppapi/c/private/ppb_flash_menu.h" +#include "ppapi/c/private/ppb_flash_message_loop.h" +#include "ppapi/c/private/ppb_flash_print.h" +#include "ppapi/c/private/ppb_gpu_blacklist_private.h" +#include "ppapi/c/private/ppb_host_resolver_private.h" +#include "ppapi/c/private/ppb_network_list_private.h" +#include "ppapi/c/private/ppb_network_monitor_private.h" +#include "ppapi/c/private/ppb_pdf.h" +#include "ppapi/c/private/ppb_proxy_private.h" +#include "ppapi/c/private/ppb_talk_private.h" +#include "ppapi/c/private/ppb_tcp_server_socket_private.h" +#include "ppapi/c/private/ppb_tcp_socket_private.h" +#include "ppapi/c/private/ppb_udp_socket_private.h" +#include "ppapi/c/private/ppb_uma_private.h" +#include "ppapi/c/private/ppb_video_destination_private.h" +#include "ppapi/c/private/ppb_video_source_private.h" +#include "ppapi/c/private/ppb_x509_certificate_private.h" +#include "ppapi/c/trusted/ppb_broker_trusted.h" +#include "ppapi/c/trusted/ppb_browser_font_trusted.h" +#include "ppapi/c/trusted/ppb_char_set_trusted.h" +#include "ppapi/c/trusted/ppb_file_chooser_trusted.h" +#include "ppapi/c/trusted/ppb_file_io_trusted.h" +#include "ppapi/c/trusted/ppb_url_loader_trusted.h" +#include "ppapi/thunk/thunk.h" + +namespace webkit { +namespace ppapi { + +bool IsSupportedPepperInterface(const char* name) { + // TODO(brettw) put these in a hash map for better performance. + #define UNPROXIED_IFACE(api_name, iface_str, iface_struct) \ + if (strcmp(name, iface_str) == 0) \ + return true; + #define PROXIED_IFACE(api_name, iface_str, iface_struct) \ + UNPROXIED_IFACE(api_name, iface_str, iface_struct) + + #include "ppapi/thunk/interfaces_ppb_private.h" + #include "ppapi/thunk/interfaces_ppb_private_flash.h" + #include "ppapi/thunk/interfaces_ppb_private_no_permissions.h" + #include "ppapi/thunk/interfaces_ppb_public_dev.h" + #include "ppapi/thunk/interfaces_ppb_public_stable.h" + + #undef UNPROXIED_IFACE + #undef PROXIED_IFACE + + #define LEGACY_IFACE(iface_str, dummy) \ + if (strcmp(name, iface_str) == 0) \ + return true; + + #include "ppapi/thunk/interfaces_legacy.h" + + #undef LEGACY_IFACE + return false; +} + +} // namespace ppapi +} // namespace webkit diff --git a/webkit/common/plugins/ppapi/ppapi_utils.h b/webkit/common/plugins/ppapi/ppapi_utils.h new file mode 100644 index 0000000..849bac9 --- /dev/null +++ b/webkit/common/plugins/ppapi/ppapi_utils.h @@ -0,0 +1,20 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_COMMON_PLUGINS_PPAPI_PPAPI_UTILS_H_ +#define WEBKIT_COMMON_PLUGINS_PPAPI_PPAPI_UTILS_H_ + +namespace webkit { +namespace ppapi { + +// Returns true if the interface name passed in is supported by the +// browser. +bool IsSupportedPepperInterface(const char* name); + +} // namespace ppapi +} // namespace webkit + +#endif // WEBKIT_COMMON_PLUGINS_PPAPI_PPAPI_UTILS_H_ + + diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 75cead2..d6c4d32 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -308,52 +308,13 @@ const void* InternalGetInterface(const char* name) { #undef UNPROXIED_API #undef PROXIED_IFACE - // Please keep alphabetized by interface macro name with "special" stuff at - // the bottom. - if (strcmp(name, PPB_AUDIO_TRUSTED_INTERFACE_0_6) == 0) - return ::ppapi::thunk::GetPPB_AudioTrusted_0_6_Thunk(); - if (strcmp(name, PPB_BUFFER_TRUSTED_INTERFACE_0_1) == 0) - return ::ppapi::thunk::GetPPB_BufferTrusted_0_1_Thunk(); - if (strcmp(name, PPB_CORE_INTERFACE_1_0) == 0) - return &core_interface; - if (strcmp(name, PPB_GPUBLACKLIST_PRIVATE_INTERFACE) == 0) - return PPB_GpuBlacklist_Private_Impl::GetInterface(); - if (strcmp(name, PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_Graphics3DTrusted_1_0_Thunk(); - if (strcmp(name, PPB_IMAGEDATA_TRUSTED_INTERFACE_0_4) == 0) - return ::ppapi::thunk::GetPPB_ImageDataTrusted_0_4_Thunk(); - if (strcmp(name, PPB_INPUT_EVENT_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_InputEvent_1_0_Thunk(); - if (strcmp(name, PPB_INSTANCE_PRIVATE_INTERFACE_0_1) == 0) - return ::ppapi::thunk::GetPPB_Instance_Private_0_1_Thunk(); - if (strcmp(name, PPB_OPENGLES2_INTERFACE) == 0) - return ::ppapi::PPB_OpenGLES2_Shared::GetInterface(); - if (strcmp(name, PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE) == 0) - return ::ppapi::PPB_OpenGLES2_Shared::GetInstancedArraysInterface(); - if (strcmp(name, PPB_OPENGLES2_FRAMEBUFFERBLIT_INTERFACE) == 0) - return ::ppapi::PPB_OpenGLES2_Shared::GetFramebufferBlitInterface(); - if (strcmp(name, PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_INTERFACE) == 0) - return ::ppapi::PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface(); - if (strcmp(name, PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE) == 0) - return ::ppapi::PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface(); - if (strcmp(name, PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE) == 0) - return ::ppapi::PPB_OpenGLES2_Shared::GetChromiumMapSubInterface(); - if (strcmp(name, PPB_OPENGLES2_CHROMIUMMAPSUB_DEV_INTERFACE_1_0) == 0) - return ::ppapi::PPB_OpenGLES2_Shared::GetChromiumMapSubInterface(); - if (strcmp(name, PPB_OPENGLES2_QUERY_INTERFACE) == 0) - return ::ppapi::PPB_OpenGLES2_Shared::GetQueryInterface(); - if (strcmp(name, PPB_PROXY_PRIVATE_INTERFACE) == 0) - return PPB_Proxy_Impl::GetInterface(); - if (strcmp(name, PPB_UMA_PRIVATE_INTERFACE) == 0) - return PPB_UMA_Private_Impl::GetInterface(); - if (strcmp(name, PPB_VAR_DEPRECATED_INTERFACE) == 0) - return PPB_Var_Deprecated_Impl::GetVarDeprecatedInterface(); - if (strcmp(name, PPB_VAR_INTERFACE_1_0) == 0) - return ::ppapi::PPB_Var_Shared::GetVarInterface1_0(); - if (strcmp(name, PPB_VAR_INTERFACE_1_1) == 0) - return ::ppapi::PPB_Var_Shared::GetVarInterface1_1(); - if (strcmp(name, PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0) == 0) - return ::ppapi::PPB_Var_Shared::GetVarArrayBufferInterface1_0(); + #define LEGACY_IFACE(iface_str, function_name) \ + if (strcmp(name, iface_str) == 0) \ + return function_name; + + #include "ppapi/thunk/interfaces_legacy.h" + + #undef LEGACY_IFACE // Only support the testing interface when the command line switch is // specified. This allows us to prevent people from (ab)using this interface diff --git a/webkit/plugins/webkit_plugins.gypi b/webkit/plugins/webkit_plugins.gypi index ee3fb6c..2b5738b 100644 --- a/webkit/plugins/webkit_plugins.gypi +++ b/webkit/plugins/webkit_plugins.gypi @@ -39,6 +39,8 @@ '../plugins/npapi/plugin_list_win.cc', '../plugins/npapi/plugin_utils.cc', '../plugins/npapi/plugin_utils.h', + '../common/plugins/ppapi/ppapi_utils.cc', + '../common/plugins/ppapi/ppapi_utils.h', ], 'conditions': [ ['toolkit_uses_gtk == 1', { |