diff options
-rwxr-xr-x | chrome/chrome.gyp | 2 | ||||
-rw-r--r-- | chrome/renderer/DEPS | 1 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc (renamed from webkit/glue/plugins/webplugin_delegate_pepper_impl.cc) | 184 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.h (renamed from webkit/glue/plugins/webplugin_delegate_pepper_impl.h) | 35 | ||||
-rw-r--r-- | third_party/npapi/bindings/npapi.h | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_host.cc | 40 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_instance.cc | 25 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_instance.h | 9 | ||||
-rw-r--r-- | webkit/glue/webplugin.h | 6 | ||||
-rw-r--r-- | webkit/glue/webplugin_delegate.h | 11 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.h | 2 | ||||
-rw-r--r-- | webkit/webkit.gyp | 2 |
13 files changed, 170 insertions, 155 deletions
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 4b8d7e8..9b34464 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -3219,6 +3219,8 @@ 'renderer/visitedlink_slave.h', 'renderer/webplugin_delegate_proxy.cc', 'renderer/webplugin_delegate_proxy.h', + 'renderer/webplugin_delegate_pepper.cc', + 'renderer/webplugin_delegate_pepper.h', 'renderer/webworker_proxy.cc', 'renderer/webworker_proxy.h', ], diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS index f8b66fe..eba4b00 100644 --- a/chrome/renderer/DEPS +++ b/chrome/renderer/DEPS @@ -12,6 +12,7 @@ include_rules = [ "+webkit/glue", "+webkit/glue/plugins", "+v8/include", + "+third_party/npapi/bindings", "+third_party/sqlite/preprocessed", "+third_party/tcmalloc", diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 24b6850..490a1ee 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -50,6 +50,7 @@ #include "chrome/renderer/render_process.h" #include "chrome/renderer/user_script_slave.h" #include "chrome/renderer/visitedlink_slave.h" +#include "chrome/renderer/webplugin_delegate_pepper.h" #include "chrome/renderer/webplugin_delegate_proxy.h" #include "chrome/renderer/webworker_proxy.h" #include "grit/generated_resources.h" @@ -90,7 +91,6 @@ #include "webkit/glue/password_form.h" #include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/plugins/webplugin_delegate_impl.h" -#include "webkit/glue/plugins/webplugin_delegate_pepper_impl.h" #include "webkit/glue/searchable_form_data.h" #include "webkit/glue/webaccessibilitymanager_impl.h" #include "webkit/glue/webdropdata.h" @@ -2458,7 +2458,7 @@ webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate( #if defined(PEPPER_APIS_ENABLED) const char kPepperPrefix[] = "pepper-"; if (StartsWithASCII(*mime_type_to_use, kPepperPrefix, true)) { - return WebPluginDelegatePepperImpl::Create( + return WebPluginDelegatePepper::Create( path, *mime_type_to_use, gfx::NativeViewFromId(host_window_)); } #endif diff --git a/webkit/glue/plugins/webplugin_delegate_pepper_impl.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 3eb8122..42f3f53 100644 --- a/webkit/glue/plugins/webplugin_delegate_pepper_impl.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -4,11 +4,12 @@ #define PEPPER_APIS_ENABLED 1 -#include "webkit/glue/plugins/webplugin_delegate_pepper_impl.h" +#include "chrome/renderer/webplugin_delegate_pepper.h" #include <string> #include <vector> +#include "app/gfx/blit.h" #include "base/file_util.h" #include "base/message_loop.h" #include "base/process_util.h" @@ -33,8 +34,13 @@ using WebKit::WebInputEvent; using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; +namespace { + const uint32 kBytesPerPixel = 4; // Only 8888 RGBA for now. +} // namespace + +uint32 WebPluginDelegatePepper::next_buffer_id = 0; -WebPluginDelegatePepperImpl* WebPluginDelegatePepperImpl::Create( +WebPluginDelegatePepper* WebPluginDelegatePepper::Create( const FilePath& filename, const std::string& mime_type, gfx::PluginWindowHandle containing_view) { @@ -49,10 +55,10 @@ WebPluginDelegatePepperImpl* WebPluginDelegatePepperImpl::Create( scoped_refptr<NPAPI::PluginInstance> instance = plugin_lib->CreateInstance(mime_type); - return new WebPluginDelegatePepperImpl(containing_view, instance.get()); + return new WebPluginDelegatePepper(containing_view, instance.get()); } -bool WebPluginDelegatePepperImpl::Initialize( +bool WebPluginDelegatePepper::Initialize( const GURL& url, const std::vector<std::string>& arg_names, const std::vector<std::string>& arg_values, @@ -87,7 +93,7 @@ bool WebPluginDelegatePepperImpl::Initialize( return true; } -void WebPluginDelegatePepperImpl::DestroyInstance() { +void WebPluginDelegatePepper::DestroyInstance() { if (instance_ && (instance_->npp()->ndata != NULL)) { // Shutdown all streams before destroying so that // no streams are left "in progress". Need to do @@ -106,17 +112,47 @@ void WebPluginDelegatePepperImpl::DestroyInstance() { } } -void WebPluginDelegatePepperImpl::UpdateGeometry( +void WebPluginDelegatePepper::UpdateGeometry( const gfx::Rect& window_rect, const gfx::Rect& clip_rect) { - WindowlessUpdateGeometry(window_rect, clip_rect); + // Only resend to the instance if the geometry has changed. + if (window_rect == window_rect_ && clip_rect == clip_rect_) + return; + + clip_rect_ = clip_rect; + cutout_rects_.clear(); + + if (window_rect_ == window_rect) + return; + window_rect_ = window_rect; + uint32 buffer_size = window_rect.height() * + window_rect.width() * + kBytesPerPixel; + if (buffer_size_ < buffer_size) { + buffer_size_ = buffer_size; + plugin_buffer_ = TransportDIB::Create(buffer_size, ++next_buffer_id); + } + + if (!instance()) + return; + + // TODO(sehr): do we need all this? + window_.clipRect.top = clip_rect_.y(); + window_.clipRect.left = clip_rect_.x(); + window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); + window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); + window_.height = window_rect_.height(); + window_.width = window_rect_.width(); + window_.x = window_rect_.x(); + window_.y = window_rect_.y(); + window_.type = NPWindowTypeDrawable; } -NPObject* WebPluginDelegatePepperImpl::GetPluginScriptableObject() { +NPObject* WebPluginDelegatePepper::GetPluginScriptableObject() { return instance_->GetPluginScriptableObject(); } -void WebPluginDelegatePepperImpl::DidFinishLoadWithReason( +void WebPluginDelegatePepper::DidFinishLoadWithReason( const GURL& url, NPReason reason, intptr_t notify_data) { @@ -124,12 +160,12 @@ void WebPluginDelegatePepperImpl::DidFinishLoadWithReason( url, reason, reinterpret_cast<void*>(notify_data)); } -int WebPluginDelegatePepperImpl::GetProcessId() { +int WebPluginDelegatePepper::GetProcessId() { // We are in process, so the plugin pid is this current process pid. return base::GetCurrentProcId(); } -void WebPluginDelegatePepperImpl::SendJavaScriptStream( +void WebPluginDelegatePepper::SendJavaScriptStream( const GURL& url, const std::string& result, bool success, @@ -139,31 +175,31 @@ void WebPluginDelegatePepperImpl::SendJavaScriptStream( notify_data); } -void WebPluginDelegatePepperImpl::DidReceiveManualResponse( +void WebPluginDelegatePepper::DidReceiveManualResponse( const GURL& url, const std::string& mime_type, const std::string& headers, uint32 expected_length, uint32 last_modified) { instance()->DidReceiveManualResponse(url, mime_type, headers, expected_length, last_modified); } -void WebPluginDelegatePepperImpl::DidReceiveManualData(const char* buffer, +void WebPluginDelegatePepper::DidReceiveManualData(const char* buffer, int length) { instance()->DidReceiveManualData(buffer, length); } -void WebPluginDelegatePepperImpl::DidFinishManualLoading() { +void WebPluginDelegatePepper::DidFinishManualLoading() { instance()->DidFinishManualLoading(); } -void WebPluginDelegatePepperImpl::DidManualLoadFail() { +void WebPluginDelegatePepper::DidManualLoadFail() { instance()->DidManualLoadFail(); } -FilePath WebPluginDelegatePepperImpl::GetPluginPath() { +FilePath WebPluginDelegatePepper::GetPluginPath() { return instance()->plugin_lib()->plugin_info().path; } -WebPluginResourceClient* WebPluginDelegatePepperImpl::CreateResourceClient( +WebPluginResourceClient* WebPluginDelegatePepper::CreateResourceClient( int resource_id, const GURL& url, bool notify_needed, intptr_t notify_data, intptr_t existing_stream) { // Stream already exists. This typically happens for range requests @@ -182,98 +218,61 @@ WebPluginResourceClient* WebPluginDelegatePepperImpl::CreateResourceClient( return stream; } -bool WebPluginDelegatePepperImpl::IsPluginDelegateWindow( +bool WebPluginDelegatePepper::IsPluginDelegateWindow( gfx::NativeWindow window) { return false; } -bool WebPluginDelegatePepperImpl::GetPluginNameFromWindow( +bool WebPluginDelegatePepper::GetPluginNameFromWindow( gfx::NativeWindow window, std::wstring *plugin_name) { return false; } -bool WebPluginDelegatePepperImpl::IsDummyActivationWindow( +bool WebPluginDelegatePepper::IsDummyActivationWindow( gfx::NativeWindow window) { return false; } -WebPluginDelegatePepperImpl::WebPluginDelegatePepperImpl( +WebPluginDelegatePepper::WebPluginDelegatePepper( gfx::PluginWindowHandle containing_view, NPAPI::PluginInstance *instance) : plugin_(NULL), instance_(instance), - parent_(containing_view) { + parent_(containing_view), + buffer_size_(0), + plugin_buffer_(0), + background_canvas_(0) { memset(&window_, 0, sizeof(window_)); } -WebPluginDelegatePepperImpl::~WebPluginDelegatePepperImpl() { +WebPluginDelegatePepper::~WebPluginDelegatePepper() { DestroyInstance(); } -void WebPluginDelegatePepperImpl::PluginDestroyed() { +void WebPluginDelegatePepper::PluginDestroyed() { delete this; } -void WebPluginDelegatePepperImpl::Paint(gfx::NativeDrawingContext context, const gfx::Rect& rect) { - NOTIMPLEMENTED(); +void WebPluginDelegatePepper::Paint(gfx::NativeDrawingContext context, + const gfx::Rect& rect) { + static StatsRate plugin_paint("Plugin.Paint"); + StatsScope<StatsRate> scope(plugin_paint); + // Blit from background_context to context. + if (background_canvas_ != NULL) { + gfx::Point origin(window_rect_.origin().x(), window_rect_.origin().y()); + gfx::BlitCanvasToContext(context, rect, background_canvas_, origin); + } } -void WebPluginDelegatePepperImpl::Print(gfx::NativeDrawingContext context) { +void WebPluginDelegatePepper::Print(gfx::NativeDrawingContext context) { NOTIMPLEMENTED(); } -void WebPluginDelegatePepperImpl::InstallMissingPlugin() { +void WebPluginDelegatePepper::InstallMissingPlugin() { NOTIMPLEMENTED(); } -void WebPluginDelegatePepperImpl::WindowlessUpdateGeometry( - const gfx::Rect& window_rect, - const gfx::Rect& clip_rect) { - // Only resend to the instance if the geometry has changed. - if (window_rect == window_rect_ && clip_rect == clip_rect_) - return; - - // We will inform the instance of this change when we call NPP_SetWindow. - clip_rect_ = clip_rect; - cutout_rects_.clear(); - - if (window_rect_ != window_rect) { - window_rect_ = window_rect; - WindowlessSetWindow(true); - // TODO(sehr): update the context here? - } -} - -void WebPluginDelegatePepperImpl::WindowlessPaint( - gfx::NativeDrawingContext context, - const gfx::Rect& damage_rect) { - static StatsRate plugin_paint("Plugin.Paint"); - StatsScope<StatsRate> scope(plugin_paint); - // TODO(sehr): save the context here? -} - -void WebPluginDelegatePepperImpl::WindowlessSetWindow(bool force_set_window) { - if (!instance()) - return; - - if (window_rect_.IsEmpty()) // wait for geometry to be set. - return; - - window_.clipRect.top = clip_rect_.y(); - window_.clipRect.left = clip_rect_.x(); - window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); - window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); - window_.height = window_rect_.height(); - window_.width = window_rect_.width(); - window_.x = window_rect_.x(); - window_.y = window_rect_.y(); - window_.type = NPWindowTypeDrawable; - - NPError err = instance()->NPP_SetWindow(&window_); - DCHECK(err == NPERR_NO_ERROR); -} - -void WebPluginDelegatePepperImpl::SetFocus() { +void WebPluginDelegatePepper::SetFocus() { NPEvent npevent; npevent.type = NPEventType_Focus; @@ -358,8 +357,8 @@ void BuildMouseWheelEvent(const WebInputEvent* event, NPEvent* npevent) { } } // namespace -bool WebPluginDelegatePepperImpl::HandleInputEvent(const WebInputEvent& event, - WebCursorInfo* cursor_info) { +bool WebPluginDelegatePepper::HandleInputEvent(const WebInputEvent& event, + WebCursorInfo* cursor_info) { NPEvent npevent; npevent.type = ConvertEventTypes(event.type); @@ -393,3 +392,32 @@ bool WebPluginDelegatePepperImpl::HandleInputEvent(const WebInputEvent& event, } return instance()->NPP_HandleEvent(&npevent) != 0; } + +NPError WebPluginDelegatePepper::InitializeRenderContext( + NPRenderType type, NPRenderContext* context) { + switch (type) { + case NPRenderGraphicsRGBA: { + int width = window_rect_.width(); + int height = window_rect_.height(); + background_canvas_ = new skia::PlatformCanvas(width, height, false); + plugin_canvas_ = plugin_buffer_->GetPlatformCanvas(width, height); + if (background_canvas_ == NULL || plugin_canvas_ == NULL) { + return NPERR_GENERIC_ERROR; + } + context->u.graphicsRgba.region = plugin_buffer_->memory(); + context->u.graphicsRgba.stride = width * kBytesPerPixel; + return NPERR_NO_ERROR; + } + default: + return NPERR_GENERIC_ERROR; + } +} + +NPError WebPluginDelegatePepper::FlushRenderContext( + NPRenderContext* context) { + gfx::BlitCanvasToCanvas(background_canvas_, + window_rect_, + plugin_canvas_, + window_rect_.origin()); + return NPERR_NO_ERROR; +} diff --git a/webkit/glue/plugins/webplugin_delegate_pepper_impl.h b/chrome/renderer/webplugin_delegate_pepper.h index 8a21340..bc59b2a 100644 --- a/webkit/glue/plugins/webplugin_delegate_pepper_impl.h +++ b/chrome/renderer/webplugin_delegate_pepper.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_PEPPER_IMPL_H_ -#define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_PEPPER_IMPL_H_ +#ifndef CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ +#define CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ #include "build/build_config.h" @@ -16,6 +16,8 @@ #include "base/gfx/rect.h" #include "base/ref_counted.h" #include "base/task.h" +#include "chrome/common/transport_dib.h" +#include "skia/ext/platform_canvas.h" #include "third_party/npapi/bindings/npapi.h" #include "webkit/glue/webcursor.h" #include "webkit/glue/webplugin_delegate.h" @@ -25,9 +27,9 @@ class PluginInstance; } // An implementation of WebPluginDelegate for Pepper in-process plugins. -class WebPluginDelegatePepperImpl : public webkit_glue::WebPluginDelegate { +class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { public: - static WebPluginDelegatePepperImpl* Create(const FilePath& filename, + static WebPluginDelegatePepper* Create(const FilePath& filename, const std::string& mime_type, gfx::PluginWindowHandle containing_view); static bool IsPluginDelegateWindow(gfx::NativeWindow window); @@ -85,17 +87,15 @@ class WebPluginDelegatePepperImpl : public webkit_glue::WebPluginDelegate { FilePath GetPluginPath(); private: - friend class DeleteTask<WebPluginDelegatePepperImpl>; - - WebPluginDelegatePepperImpl(gfx::PluginWindowHandle containing_view, - NPAPI::PluginInstance *instance); - ~WebPluginDelegatePepperImpl(); + WebPluginDelegatePepper(gfx::PluginWindowHandle containing_view, + NPAPI::PluginInstance *instance); + ~WebPluginDelegatePepper(); //---------------------------- // used for windowless plugins - void WindowlessUpdateGeometry(const gfx::Rect& window_rect, - const gfx::Rect& clip_rect); - void WindowlessPaint(gfx::NativeDrawingContext hdc, const gfx::Rect& rect); + virtual NPError InitializeRenderContext(NPRenderType type, + NPRenderContext* context); + virtual NPError FlushRenderContext(NPRenderContext* context); // Tells the plugin about the current state of the window. // See NPAPI NPP_SetWindow for more information. @@ -118,10 +118,17 @@ class WebPluginDelegatePepperImpl : public webkit_glue::WebPluginDelegate { gfx::Rect clip_rect_; std::vector<gfx::Rect> cutout_rects_; + // Plugin graphics context implementation + size_t buffer_size_; + TransportDIB* plugin_buffer_; + static uint32 next_buffer_id; + skia::PlatformCanvas* plugin_canvas_; + skia::PlatformCanvas* background_canvas_; + // The url with which the plugin was instantiated. std::string plugin_url_; - DISALLOW_COPY_AND_ASSIGN(WebPluginDelegatePepperImpl); + DISALLOW_COPY_AND_ASSIGN(WebPluginDelegatePepper); }; -#endif // WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_PEPPER_IMPL_H_ +#endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ diff --git a/third_party/npapi/bindings/npapi.h b/third_party/npapi/bindings/npapi.h index ed886fe..47b4744 100644 --- a/third_party/npapi/bindings/npapi.h +++ b/third_party/npapi/bindings/npapi.h @@ -747,6 +747,10 @@ enum NPEventType { #endif /* XP_MACOSX */ +/* Stub typedefs for interfaces requiring Pepper types. */ +typedef int NPRenderType; +typedef struct _NPRenderContext NPRenderContext; + #else // defined(PEPPER_APIS_ENABLED) typedef enum { NPMouseButton_None = -1, diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index 58b456d..c21dd07 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -18,6 +18,7 @@ #include "webkit/default_plugin/default_plugin_shared.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webplugininfo.h" +#include "webkit/glue/webplugin_delegate.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/plugins/plugin_instance.h" #include "webkit/glue/plugins/plugin_lib.h" @@ -667,7 +668,9 @@ static NPError InitializeRenderContext(NPP id, NPRenderContext* context) { scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); if (plugin) { - return plugin->InitializeRenderContext(type, context); + webkit_glue::WebPluginDelegate* delegate = plugin->webplugin()->delegate(); + // Set up the renderer for the specified type. + return delegate->InitializeRenderContext(type, context); } return NPERR_GENERIC_ERROR; } @@ -675,10 +678,18 @@ static NPError InitializeRenderContext(NPP id, static NPError FlushRenderContext(NPP id, NPRenderContext* context, NPFlushRenderContextCallbackPtr callback, - void* userData) { + void* user_data) { scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); if (plugin) { - return plugin->FlushRenderContext(context, callback, userData); + webkit_glue::WebPluginDelegate* delegate = plugin->webplugin()->delegate(); + // Do the flush. + NPError err = delegate->FlushRenderContext(context); + // Invoke the callback to inform the caller the work was done. + if (callback != NULL) { + (*callback)(context, err, user_data); + } + // Return any errors. + return err; } return NPERR_GENERIC_ERROR; } @@ -975,29 +986,6 @@ void NPN_PluginThreadAsyncCall(NPP id, } } -#if defined(PEPPER_APIS_ENABLED) -NPError NPN_InitializeRenderContext(NPP id, - NPRenderType type, - NPRenderContext* context) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); - if (plugin) { - return plugin->InitializeRenderContext(type, context); - } - return NPERR_GENERIC_ERROR; -} - -NPError NPN_FlushRenderContext(NPP id, - NPRenderContext* context, - NPFlushRenderContextCallbackPtr callback, - void* userData) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); - if (plugin) { - return plugin->FlushRenderContext(context, callback, userData); - } - return NPERR_GENERIC_ERROR; -} -#endif // defined(PEPPER_APIS_ENABLED) - NPError NPN_GetValueForURL(NPP id, NPNURLVariable variable, const char *url, diff --git a/webkit/glue/plugins/plugin_instance.cc b/webkit/glue/plugins/plugin_instance.cc index a52a971..7f71f8e 100644 --- a/webkit/glue/plugins/plugin_instance.cc +++ b/webkit/glue/plugins/plugin_instance.cc @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Pepper API support should be enabled for this file. -#define PEPPER_APIS_ENABLED - #include "build/build_config.h" #include "webkit/glue/plugins/plugin_instance.h" @@ -14,6 +11,7 @@ #include "base/string_util.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webplugin.h" +#include "webkit/glue/webplugin_delegate.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/plugins/plugin_host.h" #include "webkit/glue/plugins/plugin_lib.h" @@ -355,27 +353,6 @@ void PluginInstance::DidManualLoadFail() { } } -#ifndef PEPPER_APIS_DISABLED -NPError PluginInstance::InitializeRenderContext(NPRenderType type, - NPRenderContext* context) { - // Set up the renderer for the specified type. - // Return no errors. - return NPERR_NO_ERROR; -} - -NPError PluginInstance::FlushRenderContext(NPRenderContext* context, - NPFlushRenderContextCallbackPtr callback, void* user_data) { - // Do the flush. - NPError err = NPERR_NO_ERROR; - // Invoke the callback to inform the caller the work was done. - if (callback != NULL) { - (*callback)(context, err, user_data); - } - // Return no errors. - return NPERR_NO_ERROR; -} -#endif // PEPPER_APIS_DISABLED - void PluginInstance::PluginThreadAsyncCall(void (*func)(void *), void *user_data) { message_loop_->PostTask(FROM_HERE, NewRunnableMethod( diff --git a/webkit/glue/plugins/plugin_instance.h b/webkit/glue/plugins/plugin_instance.h index 5b5fc72..aea05ab 100644 --- a/webkit/glue/plugins/plugin_instance.h +++ b/webkit/glue/plugins/plugin_instance.h @@ -108,15 +108,6 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { void set_event_model(int value) { event_model_ = value; } #endif -#if defined(PEPPER_APIS_ENABLED) - NPError InitializeRenderContext(NPRenderType type, - NPRenderContext* context); - NPError FlushRenderContext(NPRenderContext* context, - NPFlushRenderContextCallbackPtr callback, - void* userData); - -#endif // defined(PEPPER_APIS_ENABLED) - // Creates a stream for sending an URL. If notify_needed // is true, it will send a notification to the plugin // when the stream is complete; otherwise it will not. diff --git a/webkit/glue/webplugin.h b/webkit/glue/webplugin.h index 1cb24d5..b301dde 100644 --- a/webkit/glue/webplugin.h +++ b/webkit/glue/webplugin.h @@ -26,6 +26,7 @@ class WebFrame; namespace webkit_glue { +class WebPluginDelegate; class WebPluginParentView; class WebPluginResourceClient; @@ -125,6 +126,11 @@ class WebPlugin { // Defers the loading of the resource identified by resource_id. This is // controlled by the defer parameter. virtual void SetDeferResourceLoading(int resource_id, bool defer) = 0; + + // Gets the WebPluginDelegate that implements the interface. + // This API is only for use with Pepper, and hence only with + // in renderer process plugins. + virtual WebPluginDelegate* delegate() { return NULL; } }; // Simpler version of ResourceHandleClient that lends itself to proxying. diff --git a/webkit/glue/webplugin_delegate.h b/webkit/glue/webplugin_delegate.h index 2481a61..8b47b78 100644 --- a/webkit/glue/webplugin_delegate.h +++ b/webkit/glue/webplugin_delegate.h @@ -123,6 +123,17 @@ class WebPluginDelegate { bool notify_needed, intptr_t notify_data, intptr_t stream) = 0; + + // The following two methods are for use in implementing Pepper renderers. + // They should not be called outside of that context. + virtual NPError InitializeRenderContext(NPRenderType type, + NPRenderContext* context) { + return NPERR_GENERIC_ERROR; + } + + virtual NPError FlushRenderContext(NPRenderContext* context) { + return NPERR_GENERIC_ERROR; + } }; } // namespace webkit_glue diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h index 3be1afd..c5a77f9 100644 --- a/webkit/glue/webplugin_impl.h +++ b/webkit/glue/webplugin_impl.h @@ -55,6 +55,8 @@ class WebPluginImpl : public WebPlugin, const char* buf, uint32 length); + virtual WebPluginDelegate* delegate() { return delegate_; } + private: // WebKit::WebPlugin methods: virtual bool initialize( diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index 2bcc616..5877e74 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -537,8 +537,6 @@ 'glue/plugins/webplugin_delegate_impl_gtk.cc', 'glue/plugins/webplugin_delegate_impl_mac.mm', 'glue/plugins/webplugin_delegate_impl_win.cc', - 'glue/plugins/webplugin_delegate_pepper_impl.cc', - 'glue/plugins/webplugin_delegate_pepper_impl.h', 'glue/alt_error_page_resource_fetcher.cc', 'glue/alt_error_page_resource_fetcher.h', 'glue/autofill_form.cc', |