diff options
38 files changed, 2 insertions, 2954 deletions
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h index 0f28684..ddeafba 100644 --- a/content/renderer/render_view.h +++ b/content/renderer/render_view.h @@ -71,7 +71,6 @@ class RenderViewVisitor; class RenderWidgetFullscreenPepper; class SkBitmap; class SpeechInputDispatcher; -class WebPluginDelegatePepper; class WebPluginDelegateProxy; class WebUIBindings; struct ContextMenuMediaParams; diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index b1d76cb..2f22324 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -137,8 +137,6 @@ '../plugins/npapi/gtk_plugin_container.h', '../plugins/npapi/gtk_plugin_container_manager.cc', '../plugins/npapi/gtk_plugin_container_manager.h', - '../plugins/npapi/npapi_extension_thunk.cc', - '../plugins/npapi/npapi_extension_thunk.h', '../plugins/npapi/plugin_constants_win.cc', '../plugins/npapi/plugin_constants_win.h', '../plugins/npapi/plugin_group.cc', @@ -172,26 +170,15 @@ '../plugins/npapi/quickdraw_drawing_manager_mac.h', '../plugins/npapi/webplugin.cc', '../plugins/npapi/webplugin.h', - '../plugins/npapi/webplugin_2d_device_delegate.cc', - '../plugins/npapi/webplugin_2d_device_delegate.h', - '../plugins/npapi/webplugin_3d_device_delegate.cc', - '../plugins/npapi/webplugin_3d_device_delegate.h', '../plugins/npapi/webplugin_accelerated_surface_mac.h', - '../plugins/npapi/webplugin_audio_device_delegate.cc', - '../plugins/npapi/webplugin_audio_device_delegate.h', - '../plugins/npapi/webplugin_delegate.cc', '../plugins/npapi/webplugin_delegate.h', '../plugins/npapi/webplugin_delegate_impl.cc', '../plugins/npapi/webplugin_delegate_impl.h', '../plugins/npapi/webplugin_delegate_impl_gtk.cc', '../plugins/npapi/webplugin_delegate_impl_mac.mm', '../plugins/npapi/webplugin_delegate_impl_win.cc', - '../plugins/npapi/webplugin_file_delegate.cc', - '../plugins/npapi/webplugin_file_delegate.h', '../plugins/npapi/webplugin_impl.cc', '../plugins/npapi/webplugin_impl.h', - '../plugins/npapi/webplugin_print_delegate.cc', - '../plugins/npapi/webplugin_print_delegate.h', '../plugins/npapi/webview_plugin.cc', '../plugins/npapi/webview_plugin.h', '../plugins/plugin_switches.cc', diff --git a/webkit/plugins/npapi/npapi_extension_thunk.cc b/webkit/plugins/npapi/npapi_extension_thunk.cc deleted file mode 100644 index ff3e59a..0000000 --- a/webkit/plugins/npapi/npapi_extension_thunk.cc +++ /dev/null @@ -1,553 +0,0 @@ -// Copyright (c) 2010 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/plugins/npapi/npapi_extension_thunk.h" - -#include "base/logging.h" -#include "base/string_util.h" -#include "base/utf_string_conversions.h" -#include "third_party/npapi/bindings/npapi_extensions.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/webplugin.h" -#include "webkit/plugins/npapi/webplugin_delegate.h" -#include "webkit/glue/webkit_glue.h" - -namespace webkit { -namespace npapi { - -// FindInstance() -// Finds a PluginInstance from an NPP. -// The caller must take a reference if needed. -static PluginInstance* FindInstance(NPP id) { - if (id == NULL) { - NOTREACHED(); - return NULL; - } - return static_cast<PluginInstance*>(id->ndata); -} - -// 2D device API --------------------------------------------------------------- - -static NPError Device2DQueryCapability(NPP id, int32_t capability, - int32_t* value) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - plugin->webplugin()->delegate()->Device2DQueryCapability(capability, value); - return NPERR_NO_ERROR; - } else { - return NPERR_GENERIC_ERROR; - } -} - -static NPError Device2DQueryConfig(NPP id, - const NPDeviceConfig* request, - NPDeviceConfig* obtain) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device2DQueryConfig( - static_cast<const NPDeviceContext2DConfig*>(request), - static_cast<NPDeviceContext2DConfig*>(obtain)); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device2DInitializeContext(NPP id, - const NPDeviceConfig* config, - NPDeviceContext* context) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device2DInitializeContext( - static_cast<const NPDeviceContext2DConfig*>(config), - static_cast<NPDeviceContext2D*>(context)); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device2DSetStateContext(NPP id, - NPDeviceContext* context, - int32_t state, - intptr_t value) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device2DSetStateContext( - static_cast<NPDeviceContext2D*>(context), state, value); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device2DGetStateContext(NPP id, - NPDeviceContext* context, - int32_t state, - intptr_t* value) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device2DGetStateContext( - static_cast<NPDeviceContext2D*>(context), state, value); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device2DFlushContext(NPP id, - NPDeviceContext* context, - NPDeviceFlushContextCallbackPtr callback, - void* user_data) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - NPError err = plugin->webplugin()->delegate()->Device2DFlushContext( - id, static_cast<NPDeviceContext2D*>(context), callback, user_data); - - // Invoke the callback to inform the caller the work was done. - // TODO(brettw) this is probably not how we want this to work, this should - // happen when the frame is painted so the plugin knows when it can draw - // the next frame. - if (callback != NULL) - (*callback)(id, context, err, user_data); - - // Return any errors. - return err; - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device2DDestroyContext(NPP id, - NPDeviceContext* context) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device2DDestroyContext( - static_cast<NPDeviceContext2D*>(context)); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device2DCreateBuffer(NPP id, - NPDeviceContext* context, - size_t size, - int32_t* buffer_id) { - return NPERR_GENERIC_ERROR; -} - -static NPError Device2DDestroyBuffer(NPP id, - NPDeviceContext* context, - int32_t buffer_id) { - return NPERR_GENERIC_ERROR; -} - -static NPError Device2DMapBuffer(NPP id, - NPDeviceContext* context, - int32_t buffer_id, - NPDeviceBuffer* buffer) { - return NPERR_GENERIC_ERROR; -} - -// 3D device API --------------------------------------------------------------- - -static NPError Device3DQueryCapability(NPP id, int32_t capability, - int32_t* value) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - plugin->webplugin()->delegate()->Device3DQueryCapability(capability, value); - return NPERR_NO_ERROR; - } else { - return NPERR_GENERIC_ERROR; - } -} - -static NPError Device3DQueryConfig(NPP id, - const NPDeviceConfig* request, - NPDeviceConfig* obtain) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DQueryConfig( - static_cast<const NPDeviceContext3DConfig*>(request), - static_cast<NPDeviceContext3DConfig*>(obtain)); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DInitializeContext(NPP id, - const NPDeviceConfig* config, - NPDeviceContext* context) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DInitializeContext( - static_cast<const NPDeviceContext3DConfig*>(config), - static_cast<NPDeviceContext3D*>(context)); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DSetStateContext(NPP id, - NPDeviceContext* context, - int32_t state, - intptr_t value) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DSetStateContext( - static_cast<NPDeviceContext3D*>(context), state, value); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DGetStateContext(NPP id, - NPDeviceContext* context, - int32_t state, - intptr_t* value) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DGetStateContext( - static_cast<NPDeviceContext3D*>(context), state, value); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DFlushContext(NPP id, - NPDeviceContext* context, - NPDeviceFlushContextCallbackPtr callback, - void* user_data) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DFlushContext( - id, static_cast<NPDeviceContext3D*>(context), callback, user_data); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DDestroyContext(NPP id, - NPDeviceContext* context) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DDestroyContext( - static_cast<NPDeviceContext3D*>(context)); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DCreateBuffer(NPP id, - NPDeviceContext* context, - size_t size, - int32_t* buffer_id) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DCreateBuffer( - static_cast<NPDeviceContext3D*>(context), size, buffer_id); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DDestroyBuffer(NPP id, - NPDeviceContext* context, - int32_t buffer_id) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DDestroyBuffer( - static_cast<NPDeviceContext3D*>(context), buffer_id); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DMapBuffer(NPP id, - NPDeviceContext* context, - int32_t buffer_id, - NPDeviceBuffer* buffer) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DMapBuffer( - static_cast<NPDeviceContext3D*>(context), buffer_id, buffer); - } - return NPERR_GENERIC_ERROR; -} - -// Experimental 3D device API -------------------------------------------------- - -static NPError Device3DGetNumConfigs(NPP id, int32_t* num_configs) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DGetNumConfigs(num_configs); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DGetConfigAttribs(NPP id, - int32_t config, - int32_t* attrib_list) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DGetConfigAttribs( - config, - attrib_list); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DCreateContext(NPP id, - int32_t config, - const int32_t* attrib_list, - NPDeviceContext** context) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DCreateContext( - config, - attrib_list, - reinterpret_cast<NPDeviceContext3D**>(context)); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DSynchronizeContext( - NPP id, - NPDeviceContext* context, - NPDeviceSynchronizationMode mode, - const int32_t* input_attrib_list, - int32_t* output_attrib_list, - NPDeviceSynchronizeContextCallbackPtr callback, - void* callback_data) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DSynchronizeContext( - id, - static_cast<NPDeviceContext3D*>(context), - mode, - input_attrib_list, - output_attrib_list, - callback, - callback_data); - } - return NPERR_GENERIC_ERROR; -} - -static NPError Device3DRegisterCallback( - NPP id, - NPDeviceContext* context, - int32_t callback_type, - NPDeviceGenericCallbackPtr callback, - void* callback_data) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->Device3DRegisterCallback( - id, - static_cast<NPDeviceContext3D*>(context), - callback_type, - callback, - callback_data); - } - return NPERR_GENERIC_ERROR; -} - -// Audio device API ------------------------------------------------------------ - -static NPError DeviceAudioQueryCapability(NPP id, int32_t capability, - int32_t* value) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - plugin->webplugin()->delegate()->DeviceAudioQueryCapability(capability, - value); - return NPERR_NO_ERROR; - } else { - return NPERR_GENERIC_ERROR; - } -} - -static NPError DeviceAudioQueryConfig(NPP id, - const NPDeviceConfig* request, - NPDeviceConfig* obtain) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->DeviceAudioQueryConfig( - static_cast<const NPDeviceContextAudioConfig*>(request), - static_cast<NPDeviceContextAudioConfig*>(obtain)); - } - return NPERR_GENERIC_ERROR; -} - -static NPError DeviceAudioInitializeContext(NPP id, - const NPDeviceConfig* config, - NPDeviceContext* context) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->DeviceAudioInitializeContext( - static_cast<const NPDeviceContextAudioConfig*>(config), - static_cast<NPDeviceContextAudio*>(context)); - } - return NPERR_GENERIC_ERROR; -} - -static NPError DeviceAudioSetStateContext(NPP id, - NPDeviceContext* context, - int32_t state, - intptr_t value) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - return plugin->webplugin()->delegate()->DeviceAudioSetStateContext( - static_cast<NPDeviceContextAudio*>(context), state, value); - } - return NPERR_GENERIC_ERROR; -} - -static NPError DeviceAudioGetStateContext(NPP id, - NPDeviceContext* context, - int32_t state, - intptr_t* value) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - return plugin->webplugin()->delegate()->DeviceAudioGetStateContext( - static_cast<NPDeviceContextAudio*>(context), state, value); -} - -static NPError DeviceAudioFlushContext(NPP id, - NPDeviceContext* context, - NPDeviceFlushContextCallbackPtr callback, - void* user_data) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - return plugin->webplugin()->delegate()->DeviceAudioFlushContext( - id, static_cast<NPDeviceContextAudio*>(context), callback, user_data); -} - -static NPError DeviceAudioDestroyContext(NPP id, - NPDeviceContext* context) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - return plugin->webplugin()->delegate()->DeviceAudioDestroyContext( - static_cast<NPDeviceContextAudio*>(context)); -} -// ----------------------------------------------------------------------------- - -static NPDevice* AcquireDevice(NPP id, NPDeviceID device_id) { - static NPDevice device_2d = { - Device2DQueryCapability, - Device2DQueryConfig, - Device2DInitializeContext, - Device2DSetStateContext, - Device2DGetStateContext, - Device2DFlushContext, - Device2DDestroyContext, - Device2DCreateBuffer, - Device2DDestroyBuffer, - Device2DMapBuffer, - NULL, - NULL, - NULL, - NULL, - NULL, - }; - static NPDevice device_3d = { - Device3DQueryCapability, - Device3DQueryConfig, - Device3DInitializeContext, - Device3DSetStateContext, - Device3DGetStateContext, - Device3DFlushContext, - Device3DDestroyContext, - Device3DCreateBuffer, - Device3DDestroyBuffer, - Device3DMapBuffer, - Device3DGetNumConfigs, - Device3DGetConfigAttribs, - Device3DCreateContext, - Device3DRegisterCallback, - Device3DSynchronizeContext, - }; - static NPDevice device_audio = { - DeviceAudioQueryCapability, - DeviceAudioQueryConfig, - DeviceAudioInitializeContext, - DeviceAudioSetStateContext, - DeviceAudioGetStateContext, - DeviceAudioFlushContext, - DeviceAudioDestroyContext, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }; - - switch (device_id) { - case NPPepper2DDevice: - return const_cast<NPDevice*>(&device_2d); - case NPPepper3DDevice: - return const_cast<NPDevice*>(&device_3d); - case NPPepperAudioDevice: - return const_cast<NPDevice*>(&device_audio); - default: - return NULL; - } -} - -static NPError ChooseFile(NPP id, - const char* mime_types, - NPChooseFileMode mode, - NPChooseFileCallback callback, - void* user_data) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (!plugin) - return NPERR_GENERIC_ERROR; - - if (!plugin->webplugin()->delegate()->ChooseFile(mime_types, - static_cast<int>(mode), - callback, user_data)) - return NPERR_GENERIC_ERROR; - - return NPERR_NO_ERROR; -} - -static void NumberOfFindResultsChanged(NPP id, int total, bool final_result) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) { - plugin->webplugin()->delegate()->NumberOfFindResultsChanged( - total, final_result); - } -} - -static void SelectedFindResultChanged(NPP id, int index) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (plugin) - plugin->webplugin()->delegate()->SelectedFindResultChanged(index); -} - -static NPWidgetExtensions* GetWidgetExtensions(NPP id) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (!plugin) - return NULL; - - return plugin->webplugin()->delegate()->GetWidgetExtensions(); -} - -static NPError NPSetCursor(NPP id, NPCursorType type) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (!plugin) - return NPERR_GENERIC_ERROR; - - return plugin->webplugin()->delegate()->SetCursor(type) ? - NPERR_NO_ERROR : NPERR_GENERIC_ERROR; -} - -static NPFontExtensions* GetFontExtensions(NPP id) { - scoped_refptr<PluginInstance> plugin(FindInstance(id)); - if (!plugin) - return NULL; - - return plugin->webplugin()->delegate()->GetFontExtensions(); -} - -NPError GetPepperExtensionsFunctions(void* value) { - static const NPNExtensions kExtensions = { - &AcquireDevice, - &NumberOfFindResultsChanged, - &SelectedFindResultChanged, - &ChooseFile, - &GetWidgetExtensions, - &NPSetCursor, - &GetFontExtensions, - }; - - // Return a pointer to the canonical function table. - NPNExtensions* extensions = const_cast<NPNExtensions*>(&kExtensions); - NPNExtensions** exts = reinterpret_cast<NPNExtensions**>(value); - *exts = extensions; - return NPERR_NO_ERROR; -} - -} // namespace npapi -} // namespace webkit diff --git a/webkit/plugins/npapi/npapi_extension_thunk.h b/webkit/plugins/npapi/npapi_extension_thunk.h deleted file mode 100644 index 683e07e..0000000 --- a/webkit/plugins/npapi/npapi_extension_thunk.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2009 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_PLUGINS_NPAPI_NPAPI_EXTENSION_THUNK_H_ -#define WEBKIT_PLUGINS_NPAPI_NPAPI_EXTENSION_THUNK_H_ - -#include "third_party/npapi/bindings/npapi_extensions.h" - -// This file implements forwarding for the NPAPI "Pepper" extensions through to -// the WebPluginDelegate associated with the plugin. - -namespace webkit { -namespace npapi { - -// Implements NPN_GetValue for the case of NPNVPepperExtensions. The function -// pointers in the returned structure implement all the extensions. -NPError GetPepperExtensionsFunctions(void* value); - -} // namespace npapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_NPAPI_NPAPI_EXTENSION_THUNK_H_ - - diff --git a/webkit/plugins/npapi/plugin_host.cc b/webkit/plugins/npapi/plugin_host.cc index b679d3a..7c41c1b 100644 --- a/webkit/plugins/npapi/plugin_host.cc +++ b/webkit/plugins/npapi/plugin_host.cc @@ -13,7 +13,6 @@ #include "base/utf_string_conversions.h" #include "build/build_config.h" #include "net/base/net_util.h" -#include "third_party/npapi/bindings/npapi_extensions.h" #include "third_party/npapi/bindings/npruntime.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" @@ -21,7 +20,6 @@ #include "ui/gfx/gl/gl_surface.h" #include "webkit/glue/webkit_glue.h" #include "webkit/plugins/npapi/default_plugin_shared.h" -#include "webkit/plugins/npapi/npapi_extension_thunk.h" #include "webkit/plugins/npapi/plugin_instance.h" #include "webkit/plugins/npapi/plugin_lib.h" #include "webkit/plugins/npapi/plugin_list.h" @@ -873,13 +871,6 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { break; } #endif // OS_MACOSX - case NPNVPepperExtensions: - // Available for any plugin that attempts to get it. - // If the plugin is not started in a Pepper implementation, it - // will likely fail when it tries to use any of the functions - // attached to the extension vector. - rv = webkit::npapi::GetPepperExtensionsFunctions(value); - break; default: DVLOG(1) << "NPN_GetValue(" << variable << ") is not implemented yet."; break; diff --git a/webkit/plugins/npapi/webplugin.cc b/webkit/plugins/npapi/webplugin.cc index bf0d65b..cb944ec 100644 --- a/webkit/plugins/npapi/webplugin.cc +++ b/webkit/plugins/npapi/webplugin.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -31,9 +31,5 @@ WebPluginAcceleratedSurface* WebPlugin::GetAcceleratedSurface() { } #endif -WebPluginDelegate* WebPlugin::delegate() { - return NULL; -} - } // namespace npapi } // namespace webkit diff --git a/webkit/plugins/npapi/webplugin.h b/webkit/plugins/npapi/webplugin.h index 986d828..a7c3110 100644 --- a/webkit/plugins/npapi/webplugin.h +++ b/webkit/plugins/npapi/webplugin.h @@ -164,11 +164,6 @@ class WebPlugin { virtual WebPluginAcceleratedSurface* GetAcceleratedSurface(); #endif - // Gets the WebPluginDelegate that implements the interface. - // This API is only for use with Pepper, and is only overridden - // by in-renderer implementations. - virtual WebPluginDelegate* delegate(); - // Handles NPN_URLRedirectResponse calls issued by plugins in response to // HTTP URL redirect notifications. virtual void URLRedirectResponse(bool allow, int resource_id) = 0; diff --git a/webkit/plugins/npapi/webplugin_2d_device_delegate.cc b/webkit/plugins/npapi/webplugin_2d_device_delegate.cc deleted file mode 100644 index d5a709e..0000000 --- a/webkit/plugins/npapi/webplugin_2d_device_delegate.cc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2010 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/plugins/npapi/webplugin_2d_device_delegate.h" - -namespace webkit { -namespace npapi { - -NPError WebPlugin2DDeviceDelegate::Device2DQueryCapability(int32 capability, - int32* value) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin2DDeviceDelegate::Device2DQueryConfig( - const NPDeviceContext2DConfig* request, - NPDeviceContext2DConfig* obtain) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin2DDeviceDelegate::Device2DInitializeContext( - const NPDeviceContext2DConfig* config, - NPDeviceContext2D* context) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin2DDeviceDelegate::Device2DSetStateContext( - NPDeviceContext2D* context, - int32 state, - intptr_t value) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin2DDeviceDelegate::Device2DGetStateContext( - NPDeviceContext2D* context, - int32 state, - intptr_t* value) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin2DDeviceDelegate::Device2DFlushContext( - NPP id, - NPDeviceContext2D* context, - NPDeviceFlushContextCallbackPtr callback, - void* user_data) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin2DDeviceDelegate::Device2DDestroyContext( - NPDeviceContext2D* context) { - return NPERR_GENERIC_ERROR; -} - -} // namespace npapi -} // namespace webkit diff --git a/webkit/plugins/npapi/webplugin_2d_device_delegate.h b/webkit/plugins/npapi/webplugin_2d_device_delegate.h deleted file mode 100644 index 094ddc5..0000000 --- a/webkit/plugins/npapi/webplugin_2d_device_delegate.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2009 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_PLUGINS_NPAPI_WEBPLUGIN_2D_DEVICE_DELEGATE_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_2D_DEVICE_DELEGATE_H_ - -#include "base/basictypes.h" -#include "third_party/npapi/bindings/npapi_extensions.h" - -namespace webkit { -namespace npapi { - -// Interface for the NPAPI 2D device extension. This class implements "NOP" -// versions of all these functions so it can be used seamlessly by the -// "regular" plugin delegate while being overridden by the "pepper" one. -class WebPlugin2DDeviceDelegate { - public: - virtual NPError Device2DQueryCapability(int32 capability, int32* value); - virtual NPError Device2DQueryConfig(const NPDeviceContext2DConfig* request, - NPDeviceContext2DConfig* obtain); - virtual NPError Device2DInitializeContext( - const NPDeviceContext2DConfig* config, - NPDeviceContext2D* context); - virtual NPError Device2DSetStateContext(NPDeviceContext2D* context, - int32 state, - intptr_t value); - virtual NPError Device2DGetStateContext(NPDeviceContext2D* context, - int32 state, - intptr_t* value); - virtual NPError Device2DFlushContext(NPP id, - NPDeviceContext2D* context, - NPDeviceFlushContextCallbackPtr callback, - void* user_data); - virtual NPError Device2DDestroyContext(NPDeviceContext2D* context); - - protected: - WebPlugin2DDeviceDelegate() {} - virtual ~WebPlugin2DDeviceDelegate() {} -}; - -} // namespace npapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_2D_DEVICE_DELEGATE_H_ diff --git a/webkit/plugins/npapi/webplugin_3d_device_delegate.cc b/webkit/plugins/npapi/webplugin_3d_device_delegate.cc deleted file mode 100644 index fc3a4fd..0000000 --- a/webkit/plugins/npapi/webplugin_3d_device_delegate.cc +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2010 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/plugins/npapi/webplugin_3d_device_delegate.h" - -namespace webkit { -namespace npapi { - -NPError WebPlugin3DDeviceDelegate::Device3DQueryCapability(int32 capability, - int32* value) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DQueryConfig( - const NPDeviceContext3DConfig* request, - NPDeviceContext3DConfig* obtain) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DInitializeContext( - const NPDeviceContext3DConfig* config, - NPDeviceContext3D* context) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DSetStateContext( - NPDeviceContext3D* context, - int32 state, - intptr_t value) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DGetStateContext( - NPDeviceContext3D* context, - int32 state, - intptr_t* value) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DFlushContext( - NPP id, - NPDeviceContext3D* context, - NPDeviceFlushContextCallbackPtr callback, - void* user_data) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DDestroyContext( - NPDeviceContext3D* context) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DCreateBuffer( - NPDeviceContext3D* context, - size_t size, - int32* id) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DDestroyBuffer( - NPDeviceContext3D* context, - int32 id) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DMapBuffer(NPDeviceContext3D* context, - int32 id, - NPDeviceBuffer* buffer) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DGetNumConfigs(int32* num_configs) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DGetConfigAttribs( - int32 config, - int32* attrib_list) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DCreateContext( - int32 config, - const int32* attrib_list, - NPDeviceContext3D** context) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DRegisterCallback( - NPP id, - NPDeviceContext3D* context, - int32 callback_type, - NPDeviceGenericCallbackPtr callback, - void* callback_data) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPlugin3DDeviceDelegate::Device3DSynchronizeContext( - NPP id, - NPDeviceContext3D* context, - NPDeviceSynchronizationMode mode, - const int32* input_attrib_list, - int32* output_attrib_list, - NPDeviceSynchronizeContextCallbackPtr callback, - void* callback_data) { - return NPERR_GENERIC_ERROR; -} - -} // namespace npapi -} // namespace webkit - diff --git a/webkit/plugins/npapi/webplugin_3d_device_delegate.h b/webkit/plugins/npapi/webplugin_3d_device_delegate.h deleted file mode 100644 index c9f5614..0000000 --- a/webkit/plugins/npapi/webplugin_3d_device_delegate.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2009 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_PLUGINS_NPAPI_WEBPLUGIN_3D_DEVICE_DELEGATE_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_3D_DEVICE_DELEGATE_H_ - -#include "base/basictypes.h" -#include "third_party/npapi/bindings/npapi_extensions.h" - -namespace webkit { -namespace npapi { - -// Interface for the NPAPI 3D device extension. This class implements "NOP" -// versions of all these functions so it can be used seamlessly by the -// "regular" plugin delegate while being overridden by the "pepper" one. -class WebPlugin3DDeviceDelegate { - public: - virtual NPError Device3DQueryCapability(int32 capability, int32* value); - virtual NPError Device3DQueryConfig(const NPDeviceContext3DConfig* request, - NPDeviceContext3DConfig* obtain); - virtual NPError Device3DInitializeContext( - const NPDeviceContext3DConfig* config, - NPDeviceContext3D* context); - virtual NPError Device3DSetStateContext(NPDeviceContext3D* context, - int32 state, - intptr_t value); - virtual NPError Device3DGetStateContext(NPDeviceContext3D* context, - int32 state, - intptr_t* value); - virtual NPError Device3DFlushContext(NPP id, - NPDeviceContext3D* context, - NPDeviceFlushContextCallbackPtr callback, - void* user_data); - virtual NPError Device3DDestroyContext(NPDeviceContext3D* context); - virtual NPError Device3DCreateBuffer(NPDeviceContext3D* context, - size_t size, - int32* id); - virtual NPError Device3DDestroyBuffer(NPDeviceContext3D* context, - int32 id); - virtual NPError Device3DMapBuffer(NPDeviceContext3D* context, - int32 id, - NPDeviceBuffer* buffer); - virtual NPError Device3DGetNumConfigs(int32* num_configs); - virtual NPError Device3DGetConfigAttribs(int32 config, - int32* attrib_list); - virtual NPError Device3DCreateContext(int32 config, - const int32* attrib_list, - NPDeviceContext3D** context); - virtual NPError Device3DRegisterCallback( - NPP id, - NPDeviceContext3D* context, - int32 callback_type, - NPDeviceGenericCallbackPtr callback, - void* callback_data); - virtual NPError Device3DSynchronizeContext( - NPP id, - NPDeviceContext3D* context, - NPDeviceSynchronizationMode mode, - const int32* input_attrib_list, - int32* output_attrib_list, - NPDeviceSynchronizeContextCallbackPtr callback, - void* callback_data); - - protected: - WebPlugin3DDeviceDelegate() {} - virtual ~WebPlugin3DDeviceDelegate() {} -}; - -} // namespace npapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_3D_DEVICE_DELEGATE_H_ diff --git a/webkit/plugins/npapi/webplugin_audio_device_delegate.cc b/webkit/plugins/npapi/webplugin_audio_device_delegate.cc deleted file mode 100644 index 0e463c5..0000000 --- a/webkit/plugins/npapi/webplugin_audio_device_delegate.cc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2010 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/plugins/npapi/webplugin_audio_device_delegate.h" - -namespace webkit { -namespace npapi { - -NPError WebPluginAudioDeviceDelegate::DeviceAudioQueryCapability( - int32 capability, int32* value) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPluginAudioDeviceDelegate::DeviceAudioQueryConfig( - const NPDeviceContextAudioConfig* request, - NPDeviceContextAudioConfig* obtain) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPluginAudioDeviceDelegate::DeviceAudioInitializeContext( - const NPDeviceContextAudioConfig* config, - NPDeviceContextAudio* context) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPluginAudioDeviceDelegate::DeviceAudioSetStateContext( - NPDeviceContextAudio* context, - int32 state, intptr_t value) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPluginAudioDeviceDelegate::DeviceAudioGetStateContext( - NPDeviceContextAudio* context, - int32 state, intptr_t* value) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPluginAudioDeviceDelegate::DeviceAudioFlushContext( - NPP id, NPDeviceContextAudio* context, - NPDeviceFlushContextCallbackPtr callback, void* user_data) { - return NPERR_GENERIC_ERROR; -} - -NPError WebPluginAudioDeviceDelegate::DeviceAudioDestroyContext( - NPDeviceContextAudio* context) { - return NPERR_GENERIC_ERROR; -} - -} // namespace npapi -} // namespace webkit diff --git a/webkit/plugins/npapi/webplugin_audio_device_delegate.h b/webkit/plugins/npapi/webplugin_audio_device_delegate.h deleted file mode 100644 index c95d206..0000000 --- a/webkit/plugins/npapi/webplugin_audio_device_delegate.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2009 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_PLUGINS_NPAPI_WEBPLUGIN_AUDIO_DEVICE_DELEGATE_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_AUDIO_DEVICE_DELEGATE_H_ - -#include "base/basictypes.h" -#include "third_party/npapi/bindings/npapi_extensions.h" - -namespace webkit { -namespace npapi { - -// Interface for the NPAPI audio device extension. This class implements "NOP" -// versions of all these functions so it can be used seamlessly by the -// "regular" plugin delegate while being overridden by the "pepper" one. -class WebPluginAudioDeviceDelegate { - public: - virtual NPError DeviceAudioQueryCapability(int32 capability, int32* value); - virtual NPError DeviceAudioQueryConfig( - const NPDeviceContextAudioConfig* request, - NPDeviceContextAudioConfig* obtain); - virtual NPError DeviceAudioInitializeContext( - const NPDeviceContextAudioConfig* config, - NPDeviceContextAudio* context); - virtual NPError DeviceAudioSetStateContext(NPDeviceContextAudio* context, - int32 state, intptr_t value); - virtual NPError DeviceAudioGetStateContext(NPDeviceContextAudio* context, - int32 state, intptr_t* value); - virtual NPError DeviceAudioFlushContext( - NPP id, NPDeviceContextAudio* context, - NPDeviceFlushContextCallbackPtr callback, void* user_data); - virtual NPError DeviceAudioDestroyContext(NPDeviceContextAudio* context); - - protected: - WebPluginAudioDeviceDelegate() {} - virtual ~WebPluginAudioDeviceDelegate() {} -}; - -} // namespace npapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_AUDIO_DEVICE_DELEGATE_H_ - diff --git a/webkit/plugins/npapi/webplugin_delegate.cc b/webkit/plugins/npapi/webplugin_delegate.cc deleted file mode 100644 index f8ea1cb..0000000 --- a/webkit/plugins/npapi/webplugin_delegate.cc +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2010 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/plugins/npapi/webplugin_delegate.h" - -namespace webkit { -namespace npapi { - -bool WebPluginDelegate::StartFind(const string16& search_text, - bool case_sensitive, - int identifier) { - return false; -} - -NPWidgetExtensions* WebPluginDelegate::GetWidgetExtensions() { - return NULL; -} - -bool WebPluginDelegate::SetCursor(NPCursorType type) { - return false; -} - -NPFontExtensions* WebPluginDelegate::GetFontExtensions() { - return NULL; -} - -bool WebPluginDelegate::HasSelection() const { - return false; -} - -string16 WebPluginDelegate::GetSelectionAsText() const { - return string16(); -} - -string16 WebPluginDelegate::GetSelectionAsMarkup() const { - return string16(); -} - -} // namespace npapi -} // namespace webkit diff --git a/webkit/plugins/npapi/webplugin_delegate.h b/webkit/plugins/npapi/webplugin_delegate.h index 2a89f01..d2c9428 100644 --- a/webkit/plugins/npapi/webplugin_delegate.h +++ b/webkit/plugins/npapi/webplugin_delegate.h @@ -11,14 +11,8 @@ #include "base/string16.h" #include "build/build_config.h" #include "third_party/npapi/bindings/npapi.h" -#include "third_party/npapi/bindings/npapi_extensions.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" #include "ui/gfx/native_widget_types.h" -#include "webkit/plugins/npapi/webplugin_2d_device_delegate.h" -#include "webkit/plugins/npapi/webplugin_3d_device_delegate.h" -#include "webkit/plugins/npapi/webplugin_audio_device_delegate.h" -#include "webkit/plugins/npapi/webplugin_file_delegate.h" -#include "webkit/plugins/npapi/webplugin_print_delegate.h" class FilePath; class GURL; @@ -40,11 +34,7 @@ class WebPlugin; class WebPluginResourceClient; // This is the interface that a plugin implementation needs to provide. -class WebPluginDelegate : public WebPlugin2DDeviceDelegate, - public WebPlugin3DDeviceDelegate, - public WebPluginAudioDeviceDelegate, - public WebPluginPrintDelegate, - public WebPluginFileDelegate { +class WebPluginDelegate { public: virtual ~WebPluginDelegate() {} @@ -141,26 +131,6 @@ class WebPluginDelegate : public WebPlugin2DDeviceDelegate, // has become seekable. virtual WebPluginResourceClient* CreateSeekableResourceClient( unsigned long resource_id, int range_request_id) = 0; - - // See WebPluginContainerImpl's description of the interface. - virtual bool StartFind(const string16& search_text, - bool case_sensitive, - int identifier); - virtual void SelectFindResult(bool forward) {} - virtual void StopFind() {} - virtual void NumberOfFindResultsChanged(int total, bool final_result) {} - virtual void SelectedFindResultChanged(int index) {} - virtual NPWidgetExtensions* GetWidgetExtensions(); - virtual bool SetCursor(NPCursorType type); - virtual NPFontExtensions* GetFontExtensions(); - - // Used for zooming of full page plugins. 0 means reset, while -1 means zoom - // out and +1 means zoom in. - virtual void SetZoomFactor(float scale, bool text_only) {} - // Gets the selected text, if any. - virtual bool HasSelection() const; - virtual string16 GetSelectionAsText() const; - virtual string16 GetSelectionAsMarkup() const; }; } // namespace npapi diff --git a/webkit/plugins/npapi/webplugin_file_delegate.cc b/webkit/plugins/npapi/webplugin_file_delegate.cc deleted file mode 100644 index e110a6b..0000000 --- a/webkit/plugins/npapi/webplugin_file_delegate.cc +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2010 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/plugins/npapi/webplugin_file_delegate.h" - -namespace webkit { -namespace npapi { - -bool WebPluginFileDelegate::ChooseFile(const char* mime_types, - int mode, - NPChooseFileCallback callback, - void* user_data) { - return false; -} - -} // namespace npapi -} // namespace webkit - diff --git a/webkit/plugins/npapi/webplugin_file_delegate.h b/webkit/plugins/npapi/webplugin_file_delegate.h deleted file mode 100644 index 15822af..0000000 --- a/webkit/plugins/npapi/webplugin_file_delegate.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2010 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_PLUGINS_NPAPI_WEBPLUGIN_FILE_DELEGATE_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_FILE_DELEGATE_H_ - -#include "base/basictypes.h" -#include "third_party/npapi/bindings/npapi_extensions.h" - -namespace webkit { -namespace npapi { - -// Interface for the NPAPI file extensions. This class implements "NOP" -// versions of all these functions so it can be used seamlessly by the -// "regular" plugin delegate while being overridden by the "pepper" one. -class WebPluginFileDelegate { - public: - // See NPChooseFilePtr in npapi_extensions.h. Returns true on success, on - // cancel, returns true but *filename will be filled with an empty FilePath - // and *handle will be 0. - virtual bool ChooseFile(const char* mime_types, - int mode, - NPChooseFileCallback callback, - void* user_data); - - protected: - WebPluginFileDelegate() {} - virtual ~WebPluginFileDelegate() {} -}; - -} // namespace npapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_FILE_DELEGATE_H_ diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc index 01bc20e..8ca2b7e 100644 --- a/webkit/plugins/npapi/webplugin_impl.cc +++ b/webkit/plugins/npapi/webplugin_impl.cc @@ -454,79 +454,6 @@ void WebPluginImpl::didFailLoadingFrameRequest( url, reason, reinterpret_cast<intptr_t>(notify_data)); } -bool WebPluginImpl::supportsPaginatedPrint() { - if (!delegate_) - return false; - return delegate_->PrintSupportsPrintExtension(); -} - -int WebPluginImpl::printBegin(const WebRect& printable_area, int printer_dpi) { - if (!delegate_) - return 0; - - if (!supportsPaginatedPrint()) - return 0; - - return delegate_->PrintBegin(printable_area, printer_dpi); -} - -bool WebPluginImpl::printPage(int page_number, WebCanvas* canvas) { - if (!delegate_) - return false; - - return delegate_->PrintPage(page_number, canvas); -} - -void WebPluginImpl::printEnd() { - if (delegate_) - delegate_->PrintEnd(); -} - -bool WebPluginImpl::hasSelection() const { - if (!delegate_) - return false; - - return delegate_->HasSelection(); -} - -WebKit::WebString WebPluginImpl::selectionAsText() const { - if (!delegate_) - return WebString(); - - return delegate_->GetSelectionAsText(); -} - -WebKit::WebString WebPluginImpl::selectionAsMarkup() const { - if (!delegate_) - return WebString(); - - return delegate_->GetSelectionAsMarkup(); -} - -void WebPluginImpl::setZoomFactor(float scale, bool text_only) { - if (delegate_) - delegate_->SetZoomFactor(scale, text_only); -} - -bool WebPluginImpl::startFind(const WebKit::WebString& search_text, - bool case_sensitive, - int identifier) { - if (!delegate_) - return false; - return delegate_->StartFind(search_text, case_sensitive, identifier); -} - -void WebPluginImpl::selectFindResult(bool forward) { - if (delegate_) - delegate_->SelectFindResult(forward); -} - -void WebPluginImpl::stopFind() { - if (delegate_) - delegate_->StopFind(); -} - - // ----------------------------------------------------------------------------- WebPluginImpl::WebPluginImpl( diff --git a/webkit/plugins/npapi/webplugin_impl.h b/webkit/plugins/npapi/webplugin_impl.h index 9eaf10c..6963e42 100644 --- a/webkit/plugins/npapi/webplugin_impl.h +++ b/webkit/plugins/npapi/webplugin_impl.h @@ -91,20 +91,6 @@ class WebPluginImpl : public WebPlugin, virtual void didFailLoadingFrameRequest( const WebKit::WebURL& url, void* notify_data, const WebKit::WebURLError& error); - virtual bool supportsPaginatedPrint(); - virtual int printBegin(const WebKit::WebRect& printable_area, - int printer_dpi); - virtual bool printPage(int page_number, WebKit::WebCanvas* canvas); - virtual void printEnd(); - virtual bool hasSelection() const; - virtual WebKit::WebString selectionAsText() const; - virtual WebKit::WebString selectionAsMarkup() const; - virtual void setZoomFactor(float scale, bool text_only); - virtual bool startFind(const WebKit::WebString& search_text, - bool case_sensitive, - int identifier); - virtual void selectFindResult(bool forward); - virtual void stopFind(); // WebPlugin implementation: virtual void SetWindow(gfx::PluginWindowHandle window); diff --git a/webkit/plugins/npapi/webplugin_print_delegate.cc b/webkit/plugins/npapi/webplugin_print_delegate.cc deleted file mode 100644 index a90170b..0000000 --- a/webkit/plugins/npapi/webplugin_print_delegate.cc +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2010 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/plugins/npapi/webplugin_print_delegate.h" - -namespace webkit { -namespace npapi { - -bool WebPluginPrintDelegate::PrintSupportsPrintExtension() { - return false; -} - -int WebPluginPrintDelegate::PrintBegin(const gfx::Rect& printable_area, - int printer_dpi) { - return 0; -} - -bool WebPluginPrintDelegate::PrintPage(int page_number, - WebKit::WebCanvas* canvas) { - return false; -} - -void WebPluginPrintDelegate::PrintEnd() { -} - -} // namespace npapi -} // namespace webkit diff --git a/webkit/plugins/npapi/webplugin_print_delegate.h b/webkit/plugins/npapi/webplugin_print_delegate.h deleted file mode 100644 index c84975e..0000000 --- a/webkit/plugins/npapi/webplugin_print_delegate.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2010 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_PLUGINS_NPAPI_WEBPLUGIN_PRINT_DELEGATE_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_PRINT_DELEGATE_H_ - -#include "base/basictypes.h" -#include "third_party/npapi/bindings/npapi_extensions.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" - -namespace gfx { -class Rect; -} - -namespace webkit { -namespace npapi { - -// Interface for the NPAPI print extension. This class implements "NOP" -// versions of all these functions so it can be used seamlessly by the -// "regular" plugin delegate while being overridden by the "pepper" one. -class WebPluginPrintDelegate { - public: - // If a plugin supports print extensions, then it gets to participate fully - // in the browser's print workflow by specifying the number of pages to be - // printed and providing a print output for specified pages. - virtual bool PrintSupportsPrintExtension(); - - // Note: printable_area is in points (a point is 1/72 of an inch). - virtual int PrintBegin(const gfx::Rect& printable_area, int printer_dpi); - - virtual bool PrintPage(int page_number, WebKit::WebCanvas* canvas); - - virtual void PrintEnd(); - - protected: - WebPluginPrintDelegate() {} - virtual ~WebPluginPrintDelegate() {} -}; - -} // namespace npapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_PRINT_DELEGATE_H_ - diff --git a/webkit/tools/pepper_test_plugin/DEPS b/webkit/tools/pepper_test_plugin/DEPS deleted file mode 100644 index f31c40db..0000000 --- a/webkit/tools/pepper_test_plugin/DEPS +++ /dev/null @@ -1,4 +0,0 @@ -include_rules = [ - "+gpu/pgl", - "+third_party/gles2_book", -] diff --git a/webkit/tools/pepper_test_plugin/Info.plist b/webkit/tools/pepper_test_plugin/Info.plist deleted file mode 100644 index 2f215ef..0000000 --- a/webkit/tools/pepper_test_plugin/Info.plist +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>${EXECUTABLE_NAME}</string> - <key>CFBundleGetInfoString</key> - <string>Copyright 2010 Google, Inc.</string> - <key>CFBundleIdentifier</key> - <string>com.google.testpepperplugin</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>${PRODUCT_NAME}</string> - <key>CFBundlePackageType</key> - <string>BRPL</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>1.0</string> - <key>CFPlugInDynamicRegisterFunction</key> - <string></string> - <key>CFPlugInDynamicRegistration</key> - <string>NO</string> - <key>WebPluginDescription</key> - <string>Simple Pepper plug-in that handles tests</string> - <key>WebPluginMIMETypes</key> - <dict> - <key>pepper-application/x-pepper-test-plugin</key> - <dict> - <key>WebPluginExtensions</key> - <array> - <string>testpepper</string> - </array> - <key>WebPluginTypeDescription</key> - <string>Test Pepper API</string> - </dict> - </dict> - <key>WebPluginName</key> - <string>Pepper Test PlugIn</string> -</dict> -</plist> diff --git a/webkit/tools/pepper_test_plugin/OWNERS b/webkit/tools/pepper_test_plugin/OWNERS deleted file mode 100644 index 06fefbf..0000000 --- a/webkit/tools/pepper_test_plugin/OWNERS +++ /dev/null @@ -1 +0,0 @@ -brettw@chromium.org diff --git a/webkit/tools/pepper_test_plugin/README b/webkit/tools/pepper_test_plugin/README deleted file mode 100644 index 6184b5e..0000000 --- a/webkit/tools/pepper_test_plugin/README +++ /dev/null @@ -1,40 +0,0 @@ -This is a test plugin for manual testing of the Pepper plugin API. See - https://wiki.mozilla.org/Plugins:PlatformIndependentNPAPI - -Open the Chrome all.sln solution and rebuild the pepper_test_plugin and -chrome projects. - -To load this plugin in Chrome, use the command line flags: - --no-sandbox - --internal-pepper - --load-plugin=<<<YOUR CHECKOUT ROOT>>\src\webkit\tools\pepper_test_plugin\Debug\pepper_test_plugin.dll - -A simple way to launch Chrome with these command line flags is to run the -generated pepper_test_plugin project. - -Note that pepper_test_plugin is not dependent on the chrome project so you -need to remember to build Chrome separately if necessary. - -- Mac Instructions - -In the pepper_test_plugin.xcodeproj that gets generated in this dir by GYP: - -[There isn't a way to add an Xcode Custom Executable via GYP, so you have to do -this by hand each time the .xcoeproj is generated. Sorry.] - -Right (ctrl)-click 'Executables', then "Add -> New Custom Executable..." -Call the Executable "Chromium" -Set the Executable Path to ${BUILT_PRODUCTS_DIR}/Chromium.app/Contents/MacOS/Chromium -When the Info panel comes up, add these arguments using the '+' button: - --no-sandbox - --internal-pepper - file://${SRCROOT}/test_page.html - # Add this if you want Chromium to pause before loading a render view. - --renderer-startup-dialog - # Add this to run Chromium as a single process. - --single-process - -Before you run the executable, copy the plugin into ~/Library/Internet Plug-Ins. -You might have to create the directory first. - -Once all this is set up, you can use "Build and run" (or cmd-r) in Xcode to -run the pepper plugin test. diff --git a/webkit/tools/pepper_test_plugin/demo_3d.cc b/webkit/tools/pepper_test_plugin/demo_3d.cc deleted file mode 100644 index 2ffb757..0000000 --- a/webkit/tools/pepper_test_plugin/demo_3d.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2010 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/tools/pepper_test_plugin/demo_3d.h" - -#if !defined(INDEPENDENT_PLUGIN) -namespace pepper { -Demo3D::Demo3D() { - esInitContext(&context_); - memset(&user_data_, 0, sizeof(HTUserData)); - context_.userData = &user_data_; -} - -Demo3D::~Demo3D() { -} - -void Demo3D::SetWindowSize(int width, int height) { - context_.width = width; - context_.height = height; -} - -bool Demo3D::InitGL() { - return htInit(&context_); -} - -void Demo3D::ReleaseGL() { - htShutDown(&context_); -} - -void Demo3D::Draw() { - htDraw(&context_); -} -} // namespace pepper -#endif // INDEPENDENT_PLUGIN diff --git a/webkit/tools/pepper_test_plugin/demo_3d.h b/webkit/tools/pepper_test_plugin/demo_3d.h deleted file mode 100644 index b10533d..0000000 --- a/webkit/tools/pepper_test_plugin/demo_3d.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2010 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_TOOLS_PEPPER_TEST_PLUGIN_DEMO_3D_H_ -#define WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_DEMO_3D_H_ - -#if !defined(INDEPENDENT_PLUGIN) -#include "base/basictypes.h" -#include "third_party/gles2_book/Chapter_2/Hello_Triangle/Hello_Triangle.h" - -namespace pepper { -class Demo3D { - public: - Demo3D(); - virtual ~Demo3D(); - - // Sets the size of the window on which this demo object will render. - void SetWindowSize(int width, int height); - - // Initializes the OpenGL state required by this demo. - // When this function is called, it is assumed that a rendering context has - // already been created and made current. - bool InitGL(); - - // Release the OpenGL resources acquired by this demo. - // When this function is called, it is assumed that the rendering context - // used to initialize the demo is current. - void ReleaseGL(); - - // Performs OpenGL rendering. - // When this function is called, it is assumed that the rendering context - // has been made current. - void Draw(); - - private: - ESContext context_; - HTUserData user_data_; - - DISALLOW_COPY_AND_ASSIGN(Demo3D); -}; -} // namespace pepper -#endif // INDEPENDENT_PLUGIN -#endif // WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_DEMO_3D_H_ diff --git a/webkit/tools/pepper_test_plugin/event_handler.cc b/webkit/tools/pepper_test_plugin/event_handler.cc deleted file mode 100644 index 0562536..0000000 --- a/webkit/tools/pepper_test_plugin/event_handler.cc +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "webkit/tools/pepper_test_plugin/event_handler.h" - -#include <stdio.h> -#include <sstream> - -#include "webkit/tools/pepper_test_plugin/plugin_object.h" - -EventHandler* event_handler = NULL; - -// EventHandler ---------------------------------------------------------------- - -EventHandler::EventHandler(NPP npp) - : npp_(npp), - text_box_(NULL) { -} - -EventHandler::~EventHandler() { -} - -void EventHandler::addText(const char* cstr) { - NPVariant variant; - // Create a a string variant to be set for the innerText. - MakeNPVariant(cstr, &variant); - // Report the string to the div. - NPVariant result; - browser->invokeDefault(npp_, text_box_, &variant, 1, &result); - // Release the variant. - browser->releasevariantvalue(&variant); - browser->releasevariantvalue(&result); -} - -std::string EventHandler::EventName(double timestamp, int32 type) { -#if !defined(OS_LINUX) - std::stringstream strstr; - strstr.setf(std::ios::fixed, std::ios::floatfield); - strstr << timestamp << ": "; - std::string str(strstr.str()); -#else - std::string str; -#endif - switch (type) { - case NPEventType_MouseDown: - return str + "MouseDown"; - case NPEventType_MouseUp: - return str + "MouseUp"; - case NPEventType_MouseMove: - return str + "MouseMove"; - case NPEventType_MouseEnter: - return str + "MouseEnter"; - case NPEventType_MouseLeave: - return str + "MouseLeave"; - case NPEventType_MouseWheel: - return str + "MouseWheel"; - case NPEventType_RawKeyDown: - return str + "RawKeyDown"; - case NPEventType_KeyDown: - return str + "KeyDown"; - case NPEventType_KeyUp: - return str + "KeyUp"; - case NPEventType_Char: - return str + "Char"; - case NPEventType_Minimize: - return str + "Minimize"; - case NPEventType_Focus: - return str + "Focus"; - case NPEventType_Device: - return str + "Device"; - case NPEventType_Undefined: - default: - return str + "Undefined"; - } -} - -int EventHandler::handle(void* event) { - NPPepperEvent* npevent = reinterpret_cast<NPPepperEvent*>(event); - std::stringstream str; - str << EventName(npevent->timeStampSeconds, npevent->type); - switch (npevent->type) { - case NPEventType_MouseDown: - case NPEventType_MouseUp: - case NPEventType_MouseMove: - case NPEventType_MouseEnter: - case NPEventType_MouseLeave: - str << ": mod " << npevent->u.mouse.modifier - << ", but: " << npevent->u.mouse.button - << ", x: " << npevent->u.mouse.x - << ", y: " << npevent->u.mouse.y - << ", click: " << npevent->u.mouse.clickCount; - break; - case NPEventType_MouseWheel: - str << ": mod " << npevent->u.wheel.modifier - << ", dx: " << npevent->u.wheel.deltaX - << ", dy: " << npevent->u.wheel.deltaY - << ", wtx: " << npevent->u.wheel.wheelTicksX - << ", wty: " << npevent->u.wheel.wheelTicksY - << ", sbp:" << npevent->u.wheel.scrollByPage; - break; - case NPEventType_RawKeyDown: - case NPEventType_KeyDown: - case NPEventType_KeyUp: - str << ": mod " << npevent->u.key.modifier - << ", key: " << npevent->u.key.normalizedKeyCode; - break; - case NPEventType_Char: - str << ": mod " << npevent->u.character.modifier << ", text: "; - size_t i; - for (i = 0; i < arraysize(npevent->u.character.text); ++i) { - str << npevent->u.character.text[i] << ' '; - } - str << ", unmod: "; - for (i = 0; i < arraysize(npevent->u.character.unmodifiedText); ++i) { - str << npevent->u.character.unmodifiedText[i] << ' '; - } - break; - case NPEventType_Minimize: - case NPEventType_Focus: - case NPEventType_Device: - break; - case NPEventType_Undefined: - default: - break; - } - addText(str.str().c_str()); - return 0; -} - -bool EventHandler::set_text_box(NPObject* text_box_object) { - text_box_ = text_box_object; - // Keep a reference to the text box update object. - browser->retainobject(text_box_object); - // Announce that we are alive. - addText("Set the callback for text\n"); - return true; -} - -char* EventHandler::string_duplicate(const char* cstr, size_t* len) { - *len = strlen(cstr); - char* str = reinterpret_cast<char*>(browser->memalloc(*len + 1)); - if (NULL == str) { - *len = 0; - return NULL; - } - strcpy(str, cstr); - return str; -} - -void EventHandler::MakeNPVariant(const char* cstr, NPVariant* var) { - if (NULL == cstr) { - STRINGN_TO_NPVARIANT(NULL, 0, *var); - return; - } - size_t len; - char* name = string_duplicate(cstr, &len); - if (NULL == name) { - STRINGN_TO_NPVARIANT(NULL, 0, *var); - return; - } - STRINGN_TO_NPVARIANT(name, len, *var); -} diff --git a/webkit/tools/pepper_test_plugin/event_handler.h b/webkit/tools/pepper_test_plugin/event_handler.h deleted file mode 100644 index bf3d607..0000000 --- a/webkit/tools/pepper_test_plugin/event_handler.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_EVENT_HANDLER_H_ -#define WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_EVENT_HANDLER_H_ - -#include <string> -#include "base/basictypes.h" -#include "third_party/npapi/bindings/nphostapi.h" - -class EventHandler { - public: - explicit EventHandler(NPP npp); - ~EventHandler(); - int handle(void* event); - bool set_text_box(NPObject* text_box_object); - - private: - void addText(const char* cstr); - static char* string_duplicate(const char* cstr, size_t* len); - static void MakeNPVariant(const char* cstr, NPVariant* var); - std::string EventName(double timestamp, int32 type); - - NPP npp_; - NPObject* text_box_; - - DISALLOW_COPY_AND_ASSIGN(EventHandler); -}; - -extern EventHandler* event_handler; - -#endif // WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_EVENT_HANDLER_H_ diff --git a/webkit/tools/pepper_test_plugin/main.cc b/webkit/tools/pepper_test_plugin/main.cc deleted file mode 100644 index e194d4c..0000000 --- a/webkit/tools/pepper_test_plugin/main.cc +++ /dev/null @@ -1,294 +0,0 @@ -/* - IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in - consideration of your agreement to the following terms, and your use, installation, - modification or redistribution of this Apple software constitutes acceptance of these - terms. If you do not agree with these terms, please do not use, install, modify or - redistribute this Apple software. - - In consideration of your agreement to abide by the following terms, and subject to these - terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in - this original Apple software (the "Apple Software"), to use, reproduce, modify and - redistribute the Apple Software, with or without modifications, in source and/or binary - forms; provided that if you redistribute the Apple Software in its entirety and without - modifications, you must retain this notice and the following text and disclaimers in all - such redistributions of the Apple Software. Neither the name, trademarks, service marks - or logos of Apple Computer, Inc. may be used to endorse or promote products derived from - the Apple Software without specific prior written permission from Apple. Except as expressly - stated in this notice, no other rights or licenses, express or implied, are granted by Apple - herein, including but not limited to any patent rights that may be infringed by your - derivative works or by other works in which the Apple Software may be incorporated. - - The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, - EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS - USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - - IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, - REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND - WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR - OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <stdlib.h> -#include <stdio.h> - -#include "gpu/pgl/pgl.h" - -#if defined(INDEPENDENT_PLUGIN) -#include <iostream> -#define LOG(x) std::cerr -#else -#include "base/logging.h" -#include "base/string_util.h" -#endif -#include "base/stringprintf.h" -#include "third_party/npapi/bindings/nphostapi.h" -#include "webkit/tools/pepper_test_plugin/plugin_object.h" -#include "webkit/tools/pepper_test_plugin/event_handler.h" - -#if __GNUC__ >= 4 -#define EXPORT __attribute__ ((visibility("default"))) -#elif defined(_MSC_VER) -#define EXPORT __declspec(dllexport) -#endif - -namespace { - -void Log(NPP instance, const char* format, ...) { - va_list args; - va_start(args, format); - std::string message("PLUGIN: "); -#if defined(INDEPENDENT_PLUGIN) - char msgbuf[100]; - vsnprintf(msgbuf, sizeof(msgbuf), format, args); -#else - base::StringAppendV(&message, format, args); -#endif - va_end(args); - - NPObject* window_object = 0; - NPError error = browser->getvalue(instance, NPNVWindowNPObject, - &window_object); - if (error != NPERR_NO_ERROR) { - LOG(ERROR) << "Failed to retrieve window object while logging: " - << message; - return; - } - - NPVariant console_variant; - if (!browser->getproperty(instance, window_object, - browser->getstringidentifier("console"), - &console_variant)) { - LOG(ERROR) << "Failed to retrieve console object while logging: " - << message; - browser->releaseobject(window_object); - return; - } - - NPObject* console_object = NPVARIANT_TO_OBJECT(console_variant); - - NPVariant message_variant; - STRINGZ_TO_NPVARIANT(message.c_str(), message_variant); - - NPVariant result; - if (!browser->invoke(instance, console_object, - browser->getstringidentifier("log"), - &message_variant, 1, &result)) { - fprintf(stderr, "Failed to invoke console.log while logging: %s\n", - message.c_str()); - browser->releaseobject(console_object); - browser->releaseobject(window_object); - return; - } - - browser->releasevariantvalue(&result); - browser->releaseobject(console_object); - browser->releaseobject(window_object); -} - -} // namespace - -// Plugin entry points -extern "C" { - -EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs -#if defined(OS_POSIX) && !defined(OS_MACOSX) - , NPPluginFuncs* plugin_funcs -#endif - ); -EXPORT NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* plugin_funcs); - -EXPORT void API_CALL NP_Shutdown() { -#if !defined(INDEPENDENT_PLUGIN) - pglTerminate(); -#endif -} - -#if defined(OS_POSIX) && !defined(OS_MACOSX) -EXPORT NPError API_CALL NP_GetValue(NPP instance, - NPPVariable variable, - void* value); -EXPORT const char* API_CALL NP_GetMIMEDescription(); -#endif - -} // extern "C" - -// Plugin entry points -EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs -#if defined(OS_POSIX) && !defined(OS_MACOSX) - , NPPluginFuncs* plugin_funcs -#endif - ) { - browser = browser_funcs; -#if !defined(INDEPENDENT_PLUGIN) - pglInitialize(); -#endif -#if defined(OS_POSIX) && !defined(OS_MACOSX) - return NP_GetEntryPoints(plugin_funcs); -#else - return NPERR_NO_ERROR; -#endif -} - -// Entrypoints ----------------------------------------------------------------- - -NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) { - plugin_funcs->version = 11; - plugin_funcs->size = sizeof(plugin_funcs); - plugin_funcs->newp = NPP_New; - plugin_funcs->destroy = NPP_Destroy; - plugin_funcs->setwindow = NPP_SetWindow; - plugin_funcs->newstream = NPP_NewStream; - plugin_funcs->destroystream = NPP_DestroyStream; - plugin_funcs->asfile = NPP_StreamAsFile; - plugin_funcs->writeready = NPP_WriteReady; - plugin_funcs->write = (NPP_WriteProcPtr)NPP_Write; - plugin_funcs->print = NPP_Print; - plugin_funcs->event = NPP_HandleEvent; - plugin_funcs->urlnotify = NPP_URLNotify; - plugin_funcs->getvalue = NPP_GetValue; - plugin_funcs->setvalue = NPP_SetValue; - - return NPERR_NO_ERROR; -} - -NPError NPP_New(NPMIMEType pluginType, - NPP instance, - uint16 mode, - int16 argc, char* argn[], char* argv[], - NPSavedData* saved) { - if (browser->version >= 14) { - PluginObject* obj = reinterpret_cast<PluginObject*>( - browser->createobject(instance, PluginObject::GetPluginClass())); - instance->pdata = obj; - event_handler = new EventHandler(instance); - - obj->New(pluginType, argc, argn, argv); - } - - return NPERR_NO_ERROR; -} - -NPError NPP_Destroy(NPP instance, NPSavedData** save) { - PluginObject* obj = static_cast<PluginObject*>(instance->pdata); - if (obj) - browser->releaseobject(obj->header()); - - fflush(stdout); - return NPERR_NO_ERROR; -} - -NPError NPP_SetWindow(NPP instance, NPWindow* window) { - PluginObject* obj = static_cast<PluginObject*>(instance->pdata); - if (obj) - obj->SetWindow(*window); - return NPERR_NO_ERROR; -} - -NPError NPP_NewStream(NPP instance, - NPMIMEType type, - NPStream* stream, - NPBool seekable, - uint16* stype) { - *stype = NP_ASFILEONLY; - return NPERR_NO_ERROR; -} - -NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason) { - return NPERR_NO_ERROR; -} - -void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname) { -} - -int32 NPP_Write(NPP instance, - NPStream* stream, - int32 offset, - int32 len, - void* buffer) { - return 0; -} - -int32 NPP_WriteReady(NPP instance, NPStream* stream) { - return 0; -} - -void NPP_Print(NPP instance, NPPrint* platformPrint) { -} - -int16 NPP_HandleEvent(NPP instance, void* event) { - return event_handler->handle(event); -} - -void NPP_URLNotify(NPP instance, const char* url, NPReason reason, - void* notify_data) { - PluginObject* obj = static_cast<PluginObject*>(instance->pdata); -} - -NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value) { - NPError err = NPERR_NO_ERROR; - - switch (variable) { -#if defined(OS_POSIX) && !defined(OS_MACOSX) - case NPPVpluginNameString: - *((const char**)value) = "Pepper Test PlugIn"; - break; - case NPPVpluginDescriptionString: - *((const char**)value) = "Simple Pepper plug-in for manual testing."; - break; - case NPPVpluginNeedsXEmbed: - *((NPBool*)value) = TRUE; - break; -#endif - case NPPVpluginScriptableNPObject: { - void** v = (void**)value; - PluginObject* obj = static_cast<PluginObject*>(instance->pdata); - // Return value is expected to be retained - browser->retainobject((NPObject*)obj); - *v = obj; - break; - } - default: - fprintf(stderr, "Unhandled variable to NPP_GetValue\n"); - err = NPERR_GENERIC_ERROR; - break; - } - - return err; -} - -NPError NPP_SetValue(NPP instance, NPNVariable variable, void* value) { - return NPERR_GENERIC_ERROR; -} - -#if defined(OS_POSIX) && !defined(OS_MACOSX) -NPError API_CALL NP_GetValue(NPP instance, NPPVariable variable, void* value) { - return NPP_GetValue(instance, variable, value); -} - -const char* API_CALL NP_GetMIMEDescription() { - return "pepper-application/x-pepper-test-plugin::Pepper Test"; -} -#endif diff --git a/webkit/tools/pepper_test_plugin/pepper_test_plugin.def b/webkit/tools/pepper_test_plugin/pepper_test_plugin.def deleted file mode 100644 index b15dbdc..0000000 --- a/webkit/tools/pepper_test_plugin/pepper_test_plugin.def +++ /dev/null @@ -1,6 +0,0 @@ -LIBRARY pepper_test_plugin - -EXPORTS - NP_GetEntryPoints @1 - NP_Initialize @2 - NP_Shutdown @3 diff --git a/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp b/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp deleted file mode 100644 index ff8f3cb..0000000 --- a/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (c) 2010 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. - - -{ - 'targets': [ - { - 'target_name': 'pepper_test_plugin', - 'dependencies': [ - '../../../third_party/npapi/npapi.gyp:npapi', - ], - 'include_dirs': [ - '../../..', # Root of Chrome Checkout - ], - 'xcode_settings': { - 'INFOPLIST_FILE': 'Info.plist', - }, - 'sources': [ - 'demo_3d.cc', - 'demo_3d.h', - 'event_handler.cc', - 'event_handler.h', - 'main.cc', - 'plugin_object.cc', - 'plugin_object.h', - 'test_object.cc', - 'test_object.h', - ], - 'conditions': [ - ['OS=="win"', { - 'product_name': 'pepper_test_plugin', - 'type': 'shared_library', - 'sources': [ - 'pepper_test_plugin.def', - 'pepper_test_plugin.rc', - ], - 'run_as': { - 'action': [ - '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)chrome<(EXECUTABLE_SUFFIX)', - '--no-sandbox', - '--internal-pepper', - '--enable-gpu-plugin', - '--load-plugin=$(TargetPath)', - 'file://$(ProjectDir)test_page.html', - ], - }, - }], - ['os_posix == 1 and OS != "mac"', { - 'type': 'shared_library', - 'cflags': ['-fvisibility=hidden'], - }], - ['os_posix == 1 and OS != "mac" and (target_arch == "x64" or target_arch == "arm") and linux_fpic != 1', { - 'product_name': 'pepper_test_plugin', - # Shared libraries need -fPIC on x86-64 - 'cflags': ['-fPIC'], - 'defines': ['INDEPENDENT_PLUGIN'], - }, { - # Dependencies for all other OS/CPU combinations except those above - 'dependencies': [ - '../../../base/base.gyp:base', - '../../../skia/skia.gyp:skia', - '../../../gpu/gpu.gyp:pgl', - '../../../third_party/gles2_book/gles2_book.gyp:hello_triangle', - ], - }], - ['OS=="mac"', { - 'type': 'loadable_module', - 'mac_bundle': 1, - 'product_name': 'PepperTestPlugin', - 'product_extension': 'plugin', - 'sources+': [ - 'Info.plist' - ], - }], - ], - # See README for instructions on how to run and debug on the Mac. - #'conditions' : [ - # ['OS=="mac"', { - # 'target_name' : 'Chromium', - # 'type' : 'executable', - # 'xcode_settings' : { - # 'ARGUMENTS' : '--renderer-startup-dialog --internal-pepper --no-sandbox file://${SRCROOT}/test_page.html' - # }, - # }], - #], - }, - ], -} diff --git a/webkit/tools/pepper_test_plugin/pepper_test_plugin.rc b/webkit/tools/pepper_test_plugin/pepper_test_plugin.rc deleted file mode 100644 index 0faaafa..0000000 --- a/webkit/tools/pepper_test_plugin/pepper_test_plugin.rc +++ /dev/null @@ -1,30 +0,0 @@ -1 VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
- FILEFLAGSMASK 0x17L
- FILEFLAGS 0x0L
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Google"
- VALUE "FileDescription", "Pepper Test Plugin"
- VALUE "FileVersion", "1, 0, 0, 1"
- VALUE "InternalName", "pepper_test_plugin"
- VALUE "LegalCopyright", "Copyright (C) 2009"
- VALUE "OriginalFilename", "pepper_test_plugin.dll"
- VALUE "ProductName", "Pepper Test Plugin"
- VALUE "ProductVersion", "1, 0, 0, 1"
- VALUE "MIMEType", "pepper-application/x-pepper-test-plugin"
- VALUE "FileExtents", "ptp"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
diff --git a/webkit/tools/pepper_test_plugin/plugin_object.cc b/webkit/tools/pepper_test_plugin/plugin_object.cc deleted file mode 100644 index b66a2af..0000000 --- a/webkit/tools/pepper_test_plugin/plugin_object.cc +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "webkit/tools/pepper_test_plugin/plugin_object.h" - -#include <stdio.h> -#include <cmath> -#include <limits> -#include <string> - -#if defined(INDEPENDENT_PLUGIN) -#define CHECK(x) -#else -#include "base/logging.h" -#include "build/build_config.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "third_party/skia/include/core/SkCanvas.h" -#include "third_party/skia/include/effects/SkGradientShader.h" -#endif -#include "webkit/tools/pepper_test_plugin/event_handler.h" -#include "webkit/tools/pepper_test_plugin/test_object.h" - -NPNetscapeFuncs* browser; - -namespace { - -// Properties ------------------------------------------------------------------ - -enum { - ID_PROPERTY_PROPERTY = 0, - ID_PROPERTY_TEST_OBJECT, - NUM_PROPERTY_IDENTIFIERS -}; - -static NPIdentifier plugin_property_identifiers[NUM_PROPERTY_IDENTIFIERS]; -static const NPUTF8* - plugin_property_identifier_names[NUM_PROPERTY_IDENTIFIERS] = { - "property", - "testObject", -}; - -// Methods --------------------------------------------------------------------- - -enum { - ID_TEST_GET_PROPERTY = 0, - ID_SET_TEXT_BOX, - NUM_METHOD_IDENTIFIERS -}; - -static NPIdentifier plugin_method_identifiers[NUM_METHOD_IDENTIFIERS]; -static const NPUTF8* plugin_method_identifier_names[NUM_METHOD_IDENTIFIERS] = { - "testGetProperty", - "setTextBox", -}; - -void EnsureIdentifiersInitialized() { - static bool identifiers_initialized = false; - if (identifiers_initialized) - return; - - browser->getstringidentifiers(plugin_property_identifier_names, - NUM_PROPERTY_IDENTIFIERS, - plugin_property_identifiers); - browser->getstringidentifiers(plugin_method_identifier_names, - NUM_METHOD_IDENTIFIERS, - plugin_method_identifiers); - identifiers_initialized = true; -} - -// Helper functions ------------------------------------------------------------ - -std::string CreateStringFromNPVariant(const NPVariant& variant) { - return std::string(NPVARIANT_TO_STRING(variant).UTF8Characters, - NPVARIANT_TO_STRING(variant).UTF8Length); -} - -bool TestGetProperty(PluginObject* obj, - const NPVariant* args, uint32 arg_count, - NPVariant* result) { - if (arg_count == 0) - return false; - - NPObject *object; - browser->getvalue(obj->npp(), NPNVWindowNPObject, &object); - - for (uint32 i = 0; i < arg_count; i++) { - CHECK(NPVARIANT_IS_STRING(args[i])); - std::string property_string = CreateStringFromNPVariant(args[i]); - NPIdentifier property_identifier = - browser->getstringidentifier(property_string.c_str()); - - NPVariant variant; - bool retval = browser->getproperty(obj->npp(), object, property_identifier, - &variant); - browser->releaseobject(object); - - if (!retval) - break; - - if (i + 1 < arg_count) { - CHECK(NPVARIANT_IS_OBJECT(variant)); - object = NPVARIANT_TO_OBJECT(variant); - } else { - *result = variant; - return true; - } - } - - VOID_TO_NPVARIANT(*result); - return false; -} - -// Plugin class functions ------------------------------------------------------ - -NPObject* PluginAllocate(NPP npp, NPClass* the_class) { - EnsureIdentifiersInitialized(); - PluginObject* newInstance = new PluginObject(npp); - return reinterpret_cast<NPObject*>(newInstance); -} - -void PluginDeallocate(NPObject* header) { - PluginObject* plugin = reinterpret_cast<PluginObject*>(header); - delete plugin; -} - -void PluginInvalidate(NPObject* obj) { -} - -bool PluginHasMethod(NPObject* obj, NPIdentifier name) { - for (int i = 0; i < NUM_METHOD_IDENTIFIERS; i++) { - if (name == plugin_method_identifiers[i]) - return true; - } - return false; -} - -bool PluginInvoke(NPObject* header, - NPIdentifier name, - const NPVariant* args, uint32 arg_count, - NPVariant* result) { - PluginObject* plugin = reinterpret_cast<PluginObject*>(header); - if (name == plugin_method_identifiers[ID_TEST_GET_PROPERTY]) { - return TestGetProperty(plugin, args, arg_count, result); - } else if (name == plugin_method_identifiers[ID_SET_TEXT_BOX]) { - if (1 == arg_count && NPVARIANT_IS_OBJECT(args[0])) { - return event_handler->set_text_box(NPVARIANT_TO_OBJECT(args[0])); - } - } - - return false; -} - -bool PluginInvokeDefault(NPObject* obj, - const NPVariant* args, uint32 arg_count, - NPVariant* result) { - INT32_TO_NPVARIANT(1, *result); - return true; -} - -bool PluginHasProperty(NPObject* obj, NPIdentifier name) { - for (int i = 0; i < NUM_PROPERTY_IDENTIFIERS; i++) { - if (name == plugin_property_identifiers[i]) - return true; - } - return false; -} - -bool PluginGetProperty(NPObject* obj, - NPIdentifier name, - NPVariant* result) { - PluginObject* plugin = reinterpret_cast<PluginObject*>(obj); - return false; -} - -bool PluginSetProperty(NPObject* obj, - NPIdentifier name, - const NPVariant* variant) { - PluginObject* plugin = reinterpret_cast<PluginObject*>(obj); - return false; -} - -NPClass plugin_class = { - NP_CLASS_STRUCT_VERSION, - PluginAllocate, - PluginDeallocate, - PluginInvalidate, - PluginHasMethod, - PluginInvoke, - PluginInvokeDefault, - PluginHasProperty, - PluginGetProperty, - PluginSetProperty, -}; - -// Bitmap painting ------------------------------------------------------------- - -#if defined(INDEPENDENT_PLUGIN) -void DrawSampleBitmap(void *region, int width, int height) { - int32 *bitmap = reinterpret_cast<int32 *>(region); - - for (int h = 0; h < height; ++h) { - uint8 opacity = (h * 0xff) / height; - for (int w = 0; w < width; ++w) { - // kudos to apatrick for noticing we're using premultiplied alpha - uint8 greenness = (w * opacity) / width; - *bitmap++ = (opacity << 24) | (greenness << 8); - } - } -} -#else -void DrawSampleBitmap(void *region, int width, int height) { - SkBitmap bitmap; - bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); - bitmap.setPixels(region); - - SkCanvas canvas(bitmap); - SkRect rect; - rect.set(SkIntToScalar(0), SkIntToScalar(0), - SkIntToScalar(width), SkIntToScalar(height)); - SkPath path; - path.addOval(rect); - - // Create a gradient shader going from opaque green to transparent. - SkPaint paint; - paint.setAntiAlias(true); - - SkColor grad_colors[2]; - grad_colors[0] = SkColorSetARGB(0xFF, 0x00, 0xFF, 0x00); - grad_colors[1] = SkColorSetARGB(0x00, 0x00, 0xFF, 0x00); - SkPoint grad_points[2]; - grad_points[0].set(SkIntToScalar(0), SkIntToScalar(0)); - grad_points[1].set(SkIntToScalar(0), SkIntToScalar(height)); - SkSafeUnref(paint.setShader(SkGradientShader::CreateLinear( - grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode))); - - canvas.drawPath(path, paint); -} -#endif -void FlushCallback(NPP instance, NPDeviceContext* context, - NPError err, void* user_data) { -} - -NPExtensions* extensions = NULL; - - -// Sine wave similar to one from simple_sources.cc -// F is the desired frequency (e.g. 200), T is sample type (e.g. int16) -template <int F, typename T> void SineWaveCallback( - NPDeviceContextAudio *context) { - - const size_t n_samples = context->config.sampleFrameCount; - const size_t n_channels = context->config.outputChannelMap; - const double th = 2 * 3.141592653589 * F / context->config.sampleRate; - // store time value to avoid clicks on buffer boundries - intptr_t t = (intptr_t)context->config.userData; - - T* buf = reinterpret_cast<T*>(context->outBuffer); - for (size_t sample = 0; sample < n_samples; ++sample) { - T value = static_cast<T>(sin(th * t++) * std::numeric_limits<T>::max()); - for (size_t channel = 0; channel < n_channels; ++channel) { - *buf++ = value; - } - } - context->config.userData = reinterpret_cast<void *>(t); -} - -const int32 kCommandBufferSize = 1024 * 1024; - -} // namespace - - -// PluginObject ---------------------------------------------------------------- - -PluginObject::PluginObject(NPP npp) - : npp_(npp), - test_object_(browser->createobject(npp, GetTestClass())), - device2d_(NULL), - device3d_(NULL), -#if !defined(INDEPENDENT_PLUGIN) - pgl_context_(NULL), -#endif - deviceaudio_(NULL) { - memset(&context_audio_, 0, sizeof(context_audio_)); -} - -PluginObject::~PluginObject() { -#if !defined(INDEPENDENT_PLUGIN) - if (pgl_context_) - Destroy3D(); -#endif - - // TODO(kbr): add audio portion of test -#if !defined(OS_MACOSX) - deviceaudio_->destroyContext(npp_, &context_audio_); -#endif - // FIXME(brettw) destroy the context. - browser->releaseobject(test_object_); -} - -// static -NPClass* PluginObject::GetPluginClass() { - return &plugin_class; -} - -namespace { -void Draw3DCallback(NPP npp, NPDeviceContext3D* /* context */) { - static_cast<PluginObject*>(npp->pdata)->Draw3D(); -} -} - -void PluginObject::New(NPMIMEType pluginType, - int16 argc, - char* argn[], - char* argv[]) { - // Default to 2D rendering. - dimensions_ = 2; - - for (int i = 0; i < argc; ++i) { - if (strcmp(argn[i], "dimensions") == 0) - dimensions_ = atoi(argv[i]); - } - - if (!extensions) { - browser->getvalue(npp_, NPNVPepperExtensions, - reinterpret_cast<void*>(&extensions)); - CHECK(extensions); - } - device2d_ = extensions->acquireDevice(npp_, NPPepper2DDevice); - CHECK(device2d_); - - device3d_ = extensions->acquireDevice(npp_, NPPepper3DDevice); - CHECK(device3d_); - - // TODO(kbr): add audio portion of test -#if !defined(OS_MACOSX) - deviceaudio_ = extensions->acquireDevice(npp_, NPPepperAudioDevice); - CHECK(deviceaudio_); -#endif -} - -void PluginObject::SetWindow(const NPWindow& window) { - width_ = window.width; - height_ = window.height; - - if (dimensions_ == 2) { - NPDeviceContext2DConfig config; - NPDeviceContext2D context; - device2d_->initializeContext(npp_, &config, &context); - - DrawSampleBitmap(context.region, width_, height_); - - // TODO(brettw) figure out why this cast is necessary, the functions seem to - // match. Could be a calling convention mismatch? - NPDeviceFlushContextCallbackPtr callback = - reinterpret_cast<NPDeviceFlushContextCallbackPtr>(&FlushCallback); - device2d_->flushContext(npp_, &context, callback, NULL); - } else { -#if !defined(INDEPENDENT_PLUGIN) - if (!pgl_context_) - Initialize3D(); - demo_3d_.SetWindowSize(width_, height_); -#endif - } - - // TODO(kbr): put back in audio portion of test -#if !defined(OS_MACOSX) - // testing any field would do - if (!context_audio_.config.callback) { - NPDeviceContextAudioConfig cfg; - cfg.sampleRate = 44100; - cfg.sampleType = NPAudioSampleTypeInt16; - cfg.outputChannelMap = NPAudioChannelStereo; - cfg.inputChannelMap = NPAudioChannelNone; - cfg.sampleFrameCount = 2048; - cfg.startThread = 1; // Start a thread for the audio producer. - cfg.flags = 0; - cfg.callback = &SineWaveCallback<200, int16>; - deviceaudio_->initializeContext(npp_, &cfg, &context_audio_); - } -#endif -} - -void PluginObject::Initialize3D() { -#if !defined(INDEPENDENT_PLUGIN) - DCHECK(!pgl_context_); - - // Initialize a 3D context. - NPDeviceContext3DConfig config; - config.commandBufferSize = kCommandBufferSize; - device3d_->initializeContext(npp_, &config, &context3d_); - context3d_.repaintCallback = Draw3DCallback; - - // Create a PGL context. - pgl_context_ = pglCreateContext(npp_, device3d_, &context3d_); - - // Initialize the demo GL state. - pglMakeCurrent(pgl_context_); - demo_3d_.SetWindowSize(width_, height_); - CHECK(demo_3d_.InitGL()); - - pglMakeCurrent(PGL_NO_CONTEXT); -#endif // INDEPENDENT_PLUGIN -} - -void PluginObject::Destroy3D() { -#if !defined(INDEPENDENT_PLUGIN) - DCHECK(pgl_context_); - - demo_3d_.ReleaseGL(); - - // Destroy the PGL context. - pglDestroyContext(pgl_context_); - pgl_context_ = NULL; - - // Destroy the Device3D context. - device3d_->destroyContext(npp_, &context3d_); -#endif // INDEPENDENT_PLUGIN -} - -namespace { -void AsyncFlushCallback(NPP npp, - NPDeviceContext* context, - NPError error, - void* user_data) { -} -} - -void PluginObject::Draw3D() { -#if !defined(INDEPENDENT_PLUGIN) - if (!pglMakeCurrent(pgl_context_) && pglGetError() == PGL_CONTEXT_LOST) { - Destroy3D(); - Initialize3D(); - pglMakeCurrent(pgl_context_); - } - - demo_3d_.Draw(); - pglSwapBuffers(); - pglMakeCurrent(PGL_NO_CONTEXT); - - // Async flushes just to see them working. - context3d_.waitForProgress = true; - device3d_->flushContext(npp_, - &context3d_, - AsyncFlushCallback, - reinterpret_cast<void*>(0x3D1)); - context3d_.waitForProgress = false; - device3d_->flushContext(npp_, - &context3d_, - AsyncFlushCallback, - reinterpret_cast<void*>(0x3D2)); -#endif // INDEPENDENT_PLUGIN -} diff --git a/webkit/tools/pepper_test_plugin/plugin_object.h b/webkit/tools/pepper_test_plugin/plugin_object.h deleted file mode 100644 index e6d9fb9..0000000 --- a/webkit/tools/pepper_test_plugin/plugin_object.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_PLUGIN_OBJECT_H_ -#define WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_PLUGIN_OBJECT_H_ - -#include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" -#include "third_party/npapi/bindings/nphostapi.h" -#if !defined(INDEPENDENT_PLUGIN) -#include "gpu/pgl/pgl.h" -#include "webkit/tools/pepper_test_plugin/demo_3d.h" -#endif - -extern NPNetscapeFuncs* browser; - -class PluginObject { - public: - explicit PluginObject(NPP npp); - ~PluginObject(); - - static NPClass* GetPluginClass(); - - NPObject* header() { return &header_; } - NPP npp() const { return npp_; } - - void New(NPMIMEType pluginType, int16 argc, char* argn[], char* argv[]); - void SetWindow(const NPWindow& window); - void Initialize3D(); - void Destroy3D(); - void Draw3D(); - - private: - NPObject header_; - NPP npp_; - NPObject* test_object_; - int dimensions_; - - NPDevice* device2d_; - NPDevice* device3d_; - -#if !defined(INDEPENDENT_PLUGIN) - PGLContext pgl_context_; - pepper::Demo3D demo_3d_; -#endif - - NPDevice* deviceaudio_; - - NPDeviceContext3D context3d_; - NPDeviceContextAudio context_audio_; - - - int width_; - int height_; - - DISALLOW_COPY_AND_ASSIGN(PluginObject); -}; - - -#endif // WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_PLUGIN_OBJECT_H_ diff --git a/webkit/tools/pepper_test_plugin/test_object.cc b/webkit/tools/pepper_test_plugin/test_object.cc deleted file mode 100644 index 9b84d33..0000000 --- a/webkit/tools/pepper_test_plugin/test_object.cc +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "webkit/tools/pepper_test_plugin/test_object.h" - -#include <stdlib.h> - -#include "webkit/tools/pepper_test_plugin/plugin_object.h" - -static bool testEnumerate(NPObject*, NPIdentifier **value, uint32_t *count); -static bool testHasMethod(NPObject*, NPIdentifier name); -static bool testInvoke(NPObject* header, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result); -static bool testInvokeDefault(NPObject*, const NPVariant *args, uint32_t argCount, NPVariant *result); -static bool testHasProperty(NPObject*, NPIdentifier name); -static bool testGetProperty(NPObject*, NPIdentifier name, NPVariant *variant); -static NPObject *testAllocate(NPP npp, NPClass *theClass); -static void testDeallocate(NPObject*); -static bool testConstruct(NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result); - -static NPClass testClass = { - NP_CLASS_STRUCT_VERSION, - testAllocate, - testDeallocate, - 0, - testHasMethod, - testInvoke, - testInvokeDefault, - testHasProperty, - testGetProperty, - 0, - 0, - testEnumerate, - testConstruct -}; - -NPClass* GetTestClass() -{ - return &testClass; -} - -int testObjectCount = 0; - -int GetTestObjectCount() -{ - return testObjectCount; -} - -static bool identifiersInitialized = false; - -#define NUM_ENUMERABLE_TEST_IDENTIFIERS 4 -#define NUM_TEST_IDENTIFIERS 5 - -#define ID_PROPERTY_FOO 0 -#define ID_PROPERTY_BAR 1 -#define ID_PROPERTY_TEST_OBJECT 2 -#define ID_PROPERTY_REF_COUNT 3 -#define ID_PROPERTY_OBJECT_POINTER 4 - -static NPIdentifier testIdentifiers[NUM_TEST_IDENTIFIERS]; -static const NPUTF8 *testIdentifierNames[NUM_TEST_IDENTIFIERS] = { - "foo", - "bar", - "testObject", - "refCount", - "objectPointer", -}; - -#define ID_THROW_EXCEPTION_METHOD 0 -#define NUM_METHOD_IDENTIFIERS 1 - -static NPIdentifier testMethodIdentifiers[NUM_METHOD_IDENTIFIERS]; -static const NPUTF8 *testMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = { - "throwException", -}; - -static void initializeIdentifiers(void) -{ - browser->getstringidentifiers(testIdentifierNames, NUM_TEST_IDENTIFIERS, testIdentifiers); - browser->getstringidentifiers(testMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, testMethodIdentifiers); -} - -static NPObject *testAllocate(NPP npp, NPClass *theClass) -{ - TestObject *newInstance = - static_cast<TestObject*>(malloc(sizeof(TestObject))); - newInstance->test_object = NULL; - ++testObjectCount; - - if (!identifiersInitialized) { - identifiersInitialized = true; - initializeIdentifiers(); - } - - return reinterpret_cast<NPObject*>(newInstance); -} - -static void testDeallocate(NPObject *obj) -{ - TestObject *testObject = reinterpret_cast<TestObject*>(obj); - if (testObject->test_object) - browser->releaseobject(testObject->test_object); - --testObjectCount; - free(obj); -} - -static bool testHasMethod(NPObject*, NPIdentifier name) -{ - for (unsigned i = 0; i < NUM_METHOD_IDENTIFIERS; i++) { - if (testMethodIdentifiers[i] == name) - return true; - } - return false; -} - -static bool testInvoke(NPObject* header, NPIdentifier name, const NPVariant* /*args*/, uint32_t /*argCount*/, NPVariant* /*result*/) -{ - if (name == testMethodIdentifiers[ID_THROW_EXCEPTION_METHOD]) { - browser->setexception(header, "test object throwException SUCCESS"); - return true; - } - return false; -} - -static bool testInvokeDefault(NPObject *obj, const NPVariant *args, - uint32_t argCount, NPVariant *result) -{ - INT32_TO_NPVARIANT(2, *result); - return true; -} - -static bool testHasProperty(NPObject*, NPIdentifier name) -{ - for (unsigned i = 0; i < NUM_TEST_IDENTIFIERS; i++) { - if (testIdentifiers[i] == name) - return true; - } - - return false; -} - -static bool testGetProperty(NPObject *obj, NPIdentifier name, - NPVariant *variant) -{ - if (name == testIdentifiers[ID_PROPERTY_FOO]) { - char* mem = static_cast<char*>(browser->memalloc(4)); - strcpy(mem, "foo"); - STRINGZ_TO_NPVARIANT(mem, *variant); - return true; - } else if (name == testIdentifiers[ID_PROPERTY_BAR]) { - BOOLEAN_TO_NPVARIANT(true, *variant); - return true; - } else if (name == testIdentifiers[ID_PROPERTY_TEST_OBJECT]) { - TestObject* testObject = reinterpret_cast<TestObject*>(obj); - if (testObject->test_object == NULL) - testObject->test_object = browser->createobject(NULL, &testClass); - browser->retainobject(testObject->test_object); - OBJECT_TO_NPVARIANT(testObject->test_object, *variant); - return true; - } else if (name == testIdentifiers[ID_PROPERTY_REF_COUNT]) { - INT32_TO_NPVARIANT(obj->referenceCount, *variant); - return true; - } else if (name == testIdentifiers[ID_PROPERTY_OBJECT_POINTER]) { - int32_t objectPointer = static_cast<int32_t>(reinterpret_cast<long long>(obj)); - INT32_TO_NPVARIANT(objectPointer, *variant); - return true; - } - return false; -} - -static bool testEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count) -{ - *count = NUM_ENUMERABLE_TEST_IDENTIFIERS; - - *value = (NPIdentifier*)browser->memalloc(NUM_ENUMERABLE_TEST_IDENTIFIERS * sizeof(NPIdentifier)); - memcpy(*value, testIdentifiers, sizeof(NPIdentifier) * NUM_ENUMERABLE_TEST_IDENTIFIERS); - - return true; -} - -static bool testConstruct(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result) -{ - browser->retainobject(npobj); - - // Just return the same object. - OBJECT_TO_NPVARIANT(npobj, *result); - return true; -} - - diff --git a/webkit/tools/pepper_test_plugin/test_object.h b/webkit/tools/pepper_test_plugin/test_object.h deleted file mode 100644 index 787472d..0000000 --- a/webkit/tools/pepper_test_plugin/test_object.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_TEST_OBJECT_H_ -#define WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_TEST_OBJECT_H_ - -#include "third_party/npapi/bindings/npapi.h" -#include "third_party/npapi/bindings/npruntime.h" - - -struct TestObject { - NPObject header; - NPObject* test_object; -}; - -NPClass* GetTestClass(); -int GetTestObjectCount(); - -#endif // WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_TEST_OBJECT_H_ diff --git a/webkit/tools/pepper_test_plugin/test_page.html b/webkit/tools/pepper_test_plugin/test_page.html deleted file mode 100644 index 332de34..0000000 --- a/webkit/tools/pepper_test_plugin/test_page.html +++ /dev/null @@ -1,42 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title> Pepper Plugin Demo </title> -<script type="text/javascript"> -var event_box; - -var addLine = function(line) { - event_box.innerHTML = line + '<br>' + event_box.innerHTML; -} - -var runScripts = function() { - event_box = document.getElementById("event_text_box");; - var plugin_obj = document.getElementById("plugin"); - if (plugin_obj.setTextBox) { - addLine('<b>Event log</b>'); - plugin_obj.setTextBox(addLine); - } else { - alert('Plugin failed to load.'); - } -} -</script> -</head> - -<body style="background-image:url(http://www.google.com/intl/en_ALL/images/logo.gif); background-repeat:repeat;" onload="runScripts()"> - -<p> -This page embeds a file declared as the pepper test plugins MIME type so that it will get loaded for testing. -</p> -<table> -<tr> -<td valign="top" width="50%"> -<object id="plugin" type="pepper-application/x-pepper-test-plugin" width="400" height="400" dimensions="2" /> -</td> -<td valign="top" style="background-color:Silver" width="50%"> -<div id="event_text_box" style="width:400px; height:400px; overflow:auto"> -</div> -</td> -</tr> -</table> - -</body> -</html> |