diff options
-rw-r--r-- | content/child/npapi/plugin_instance.cc | 1 | ||||
-rw-r--r-- | content/child/npapi/plugin_stream_url.h | 2 | ||||
-rw-r--r-- | content/child/npapi/webplugin.h | 27 | ||||
-rw-r--r-- | content/child/npapi/webplugin_delegate.h | 4 | ||||
-rw-r--r-- | content/child/npapi/webplugin_delegate_impl.h | 2 | ||||
-rw-r--r-- | content/child/npapi/webplugin_delegate_impl_android.cc | 3 | ||||
-rw-r--r-- | content/child/npapi/webplugin_delegate_impl_aura.cc | 3 | ||||
-rw-r--r-- | content/child/npapi/webplugin_delegate_impl_gtk.cc | 3 | ||||
-rw-r--r-- | content/child/npapi/webplugin_delegate_impl_mac.mm | 3 | ||||
-rw-r--r-- | content/child/npapi/webplugin_delegate_impl_win.cc | 3 | ||||
-rw-r--r-- | content/child/npapi/webplugin_resource_client.h | 45 | ||||
-rw-r--r-- | content/content_child.gypi | 1 | ||||
-rw-r--r-- | content/plugin/webplugin_delegate_stub.cc | 1 | ||||
-rw-r--r-- | content/plugin/webplugin_proxy.h | 61 | ||||
-rw-r--r-- | content/renderer/npapi/webplugin_delegate_proxy.cc | 3 | ||||
-rw-r--r-- | content/renderer/npapi/webplugin_delegate_proxy.h | 2 | ||||
-rw-r--r-- | content/renderer/npapi/webplugin_impl.cc | 1 |
17 files changed, 84 insertions, 81 deletions
diff --git a/content/child/npapi/plugin_instance.cc b/content/child/npapi/plugin_instance.cc index 8117c75..d2f2a57 100644 --- a/content/child/npapi/plugin_instance.cc +++ b/content/child/npapi/plugin_instance.cc @@ -16,6 +16,7 @@ #include "content/child/npapi/plugin_string_stream.h" #include "content/child/npapi/webplugin.h" #include "content/child/npapi/webplugin_delegate.h" +#include "content/child/npapi/webplugin_resource_client.h" #include "content/public/common/content_constants.h" #include "net/base/escape.h" diff --git a/content/child/npapi/plugin_stream_url.h b/content/child/npapi/plugin_stream_url.h index 2e3dc2b..6cc6ab2 100644 --- a/content/child/npapi/plugin_stream_url.h +++ b/content/child/npapi/plugin_stream_url.h @@ -8,7 +8,7 @@ #include <vector> #include "content/child/npapi/plugin_stream.h" -#include "content/child/npapi/webplugin.h" +#include "content/child/npapi/webplugin_resource_client.h" #include "url/gurl.h" namespace content { diff --git a/content/child/npapi/webplugin.h b/content/child/npapi/webplugin.h index eb13cbd..545ee94 100644 --- a/content/child/npapi/webplugin.h +++ b/content/child/npapi/webplugin.h @@ -134,33 +134,6 @@ class WebPlugin { virtual void URLRedirectResponse(bool allow, int resource_id) = 0; }; -// Simpler version of ResourceHandleClient that lends itself to proxying. -class WebPluginResourceClient { - public: - virtual ~WebPluginResourceClient() {} - - virtual void WillSendRequest(const GURL& url, int http_status_code) = 0; - // The request_is_seekable parameter indicates whether byte range requests - // can be issued for the underlying stream. - virtual void DidReceiveResponse(const std::string& mime_type, - const std::string& headers, - uint32 expected_length, - uint32 last_modified, - bool request_is_seekable) = 0; - virtual void DidReceiveData(const char* buffer, int length, - int data_offset) = 0; - // The resource ids passed here ensures that data for range requests - // is cleared. This applies for seekable streams. - virtual void DidFinishLoading(unsigned long resource_id) = 0; - virtual void DidFail(unsigned long resource_id) = 0; - virtual bool IsMultiByteResponseExpected() = 0; - virtual int ResourceId() = 0; - // Tells this object that it will get responses from multiple resources. - // This is necessary since the plugin process uses a single instance of - // PluginStreamUrl object for multiple range requests. - virtual void AddRangeRequestResourceId(unsigned long resource_id) { } -}; - } // namespace content #endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_H_ diff --git a/content/child/npapi/webplugin_delegate.h b/content/child/npapi/webplugin_delegate.h index a05d1ff..005d88f 100644 --- a/content/child/npapi/webplugin_delegate.h +++ b/content/child/npapi/webplugin_delegate.h @@ -10,12 +10,12 @@ #include "base/strings/string16.h" #include "build/build_config.h" -#include "third_party/WebKit/public/platform/WebCanvas.h" #include "third_party/npapi/bindings/npapi.h" #include "ui/gfx/native_widget_types.h" #include "webkit/common/cursors/webcursor.h" class GURL; +class SkCanvas; struct NPObject; namespace WebKit { @@ -66,7 +66,7 @@ class WebPluginDelegate { // Tells the plugin to paint the damaged rect. |canvas| is only used for // windowless plugins. - virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) = 0; + virtual void Paint(SkCanvas* canvas, const gfx::Rect& rect) = 0; // Informs the plugin that it has gained or lost focus. This is only called in // windowless mode. diff --git a/content/child/npapi/webplugin_delegate_impl.h b/content/child/npapi/webplugin_delegate_impl.h index c9dc00b..19ccc35 100644 --- a/content/child/npapi/webplugin_delegate_impl.h +++ b/content/child/npapi/webplugin_delegate_impl.h @@ -89,7 +89,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate { virtual void PluginDestroyed() OVERRIDE; virtual void UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect) OVERRIDE; - virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) OVERRIDE; + virtual void Paint(SkCanvas* canvas, const gfx::Rect& rect) OVERRIDE; virtual void SetFocus(bool focused) OVERRIDE; virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, WebCursor::CursorInfo* cursor_info) OVERRIDE; diff --git a/content/child/npapi/webplugin_delegate_impl_android.cc b/content/child/npapi/webplugin_delegate_impl_android.cc index 2bc19ed..35c1488 100644 --- a/content/child/npapi/webplugin_delegate_impl_android.cc +++ b/content/child/npapi/webplugin_delegate_impl_android.cc @@ -38,8 +38,7 @@ void WebPluginDelegateImpl::PlatformDestroyInstance() { // Nothing to do here. } -void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas, - const gfx::Rect& rect) { +void WebPluginDelegateImpl::Paint(SkCanvas* canvas, const gfx::Rect& rect) { } bool WebPluginDelegateImpl::WindowedCreatePlugin() { diff --git a/content/child/npapi/webplugin_delegate_impl_aura.cc b/content/child/npapi/webplugin_delegate_impl_aura.cc index 2389798..bfe3378 100644 --- a/content/child/npapi/webplugin_delegate_impl_aura.cc +++ b/content/child/npapi/webplugin_delegate_impl_aura.cc @@ -25,8 +25,7 @@ void WebPluginDelegateImpl::PlatformDestroyInstance() { // Nothing to do here. } -void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas, - const gfx::Rect& rect) { +void WebPluginDelegateImpl::Paint(SkCanvas* canvas, const gfx::Rect& rect) { } bool WebPluginDelegateImpl::WindowedCreatePlugin() { diff --git a/content/child/npapi/webplugin_delegate_impl_gtk.cc b/content/child/npapi/webplugin_delegate_impl_gtk.cc index 36906c5..f081814 100644 --- a/content/child/npapi/webplugin_delegate_impl_gtk.cc +++ b/content/child/npapi/webplugin_delegate_impl_gtk.cc @@ -95,8 +95,7 @@ void WebPluginDelegateImpl::PlatformDestroyInstance() { // Nothing to do here. } -void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas, - const gfx::Rect& rect) { +void WebPluginDelegateImpl::Paint(SkCanvas* canvas, const gfx::Rect& rect) { if (!windowless_ || !skia::SupportsPlatformPaint(canvas)) return; skia::ScopedPlatformPaint scoped_platform_paint(canvas); diff --git a/content/child/npapi/webplugin_delegate_impl_mac.mm b/content/child/npapi/webplugin_delegate_impl_mac.mm index eceaeb0..82207b5 100644 --- a/content/child/npapi/webplugin_delegate_impl_mac.mm +++ b/content/child/npapi/webplugin_delegate_impl_mac.mm @@ -275,8 +275,7 @@ void WebPluginDelegateImpl::UpdateGeometryAndContext( UpdateGeometry(window_rect, clip_rect); } -void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas, - const gfx::Rect& rect) { +void WebPluginDelegateImpl::Paint(SkCanvas* canvas, const gfx::Rect& rect) { gfx::SkiaBitLocker bit_locker(canvas); CGContextRef context = bit_locker.cgContext(); CGPaint(context, rect); diff --git a/content/child/npapi/webplugin_delegate_impl_win.cc b/content/child/npapi/webplugin_delegate_impl_win.cc index 6193055..766b552 100644 --- a/content/child/npapi/webplugin_delegate_impl_win.cc +++ b/content/child/npapi/webplugin_delegate_impl_win.cc @@ -439,8 +439,7 @@ void WebPluginDelegateImpl::PlatformDestroyInstance() { } } -void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas, - const gfx::Rect& rect) { +void WebPluginDelegateImpl::Paint(SkCanvas* canvas, const gfx::Rect& rect) { if (windowless_ && skia::SupportsPlatformPaint(canvas)) { skia::ScopedPlatformPaint scoped_platform_paint(canvas); HDC hdc = scoped_platform_paint.GetPlatformSurface(); diff --git a/content/child/npapi/webplugin_resource_client.h b/content/child/npapi/webplugin_resource_client.h new file mode 100644 index 0000000..fc39264 --- /dev/null +++ b/content/child/npapi/webplugin_resource_client.h @@ -0,0 +1,45 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_CHILD_NPAPI_WEBPLUGIN_RESOURCE_CLIENT_H_ +#define CONTENT_CHILD_NPAPI_WEBPLUGIN_RESOURCE_CLIENT_H_ + +#include <string> + +#include "base/basictypes.h" + +class GURL; + +namespace content { + +// Simpler version of ResourceHandleClient that lends itself to proxying. +class WebPluginResourceClient { + public: + virtual ~WebPluginResourceClient() {} + + virtual void WillSendRequest(const GURL& url, int http_status_code) = 0; + // The request_is_seekable parameter indicates whether byte range requests + // can be issued for the underlying stream. + virtual void DidReceiveResponse(const std::string& mime_type, + const std::string& headers, + uint32 expected_length, + uint32 last_modified, + bool request_is_seekable) = 0; + virtual void DidReceiveData(const char* buffer, int length, + int data_offset) = 0; + // The resource ids passed here ensures that data for range requests + // is cleared. This applies for seekable streams. + virtual void DidFinishLoading(unsigned long resource_id) = 0; + virtual void DidFail(unsigned long resource_id) = 0; + virtual bool IsMultiByteResponseExpected() = 0; + virtual int ResourceId() = 0; + // Tells this object that it will get responses from multiple resources. + // This is necessary since the plugin process uses a single instance of + // PluginStreamUrl object for multiple range requests. + virtual void AddRangeRequestResourceId(unsigned long resource_id) { } +}; + +} // namespace content + +#endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_RESOURCE_CLIENT_H_ diff --git a/content/content_child.gypi b/content/content_child.gypi index aac52fa..e168326 100644 --- a/content/content_child.gypi +++ b/content/content_child.gypi @@ -103,6 +103,7 @@ 'child/npapi/webplugin_delegate_impl_win.cc', 'child/npapi/webplugin_ime_win.cc', 'child/npapi/webplugin_ime_win.h', + 'child/npapi/webplugin_resource_client.h', 'child/plugin_message_generator.cc', 'child/plugin_message_generator.h', 'child/plugin_messages.h', diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc index 21c995f..af574e4 100644 --- a/content/plugin/webplugin_delegate_stub.cc +++ b/content/plugin/webplugin_delegate_stub.cc @@ -11,6 +11,7 @@ #include "base/strings/string_number_conversions.h" #include "content/child/npapi/plugin_instance.h" #include "content/child/npapi/webplugin_delegate_impl.h" +#include "content/child/npapi/webplugin_resource_client.h" #include "content/child/plugin_messages.h" #include "content/plugin/plugin_channel.h" #include "content/plugin/plugin_thread.h" diff --git a/content/plugin/webplugin_proxy.h b/content/plugin/webplugin_proxy.h index eeec5dd..d1899f5 100644 --- a/content/plugin/webplugin_proxy.h +++ b/content/plugin/webplugin_proxy.h @@ -52,16 +52,12 @@ class WebPluginProxy : public WebPlugin { // WebPlugin overrides virtual void SetWindow(gfx::PluginWindowHandle window) OVERRIDE; - - // Whether input events should be sent to the delegate. virtual void SetAcceptsInputEvents(bool accepts) OVERRIDE; - virtual void WillDestroyWindow(gfx::PluginWindowHandle window) OVERRIDE; #if defined(OS_WIN) void SetWindowlessData(HANDLE pump_messages_event, gfx::NativeViewId dummy_activation_window); #endif - virtual void CancelResource(unsigned long id) OVERRIDE; virtual void Invalidate() OVERRIDE; virtual void InvalidateRect(const gfx::Rect& rect) OVERRIDE; @@ -74,30 +70,6 @@ class WebPluginProxy : public WebPlugin { const std::string& cookie) OVERRIDE; virtual std::string GetCookies(const GURL& url, const GURL& first_party_for_cookies) OVERRIDE; - - // class-specific methods - - // Returns a WebPluginResourceClient object given its id, or NULL if no - // object with that id exists. - WebPluginResourceClient* GetResourceClient(int id); - - // Returns the id of the renderer that contains this plugin. - int GetRendererId(); - - // Returns the id of the associated render view. - int host_render_view_routing_id() const { - return host_render_view_routing_id_; - } - - // For windowless plugins, paints the given rectangle into the local buffer. - void Paint(const gfx::Rect& rect); - - // Callback from the renderer to let us know that a paint occurred. - void DidPaint(); - - // Notification received on a plugin issued resource request creation. - void OnResourceCreated(int resource_id, WebPluginResourceClient* client); - virtual void HandleURLRequest(const char* url, const char* method, const char* target, @@ -125,24 +97,37 @@ class WebPluginProxy : public WebPlugin { virtual void StartIme() OVERRIDE; virtual WebPluginAcceleratedSurface* GetAcceleratedSurface(gfx::GpuPreference gpu_preference) OVERRIDE; - - //---------------------------------------------------------------------- - // Accelerated plugin implementation which renders via the compositor. - - // Tells the renderer, and from there the GPU process, that the plugin - // is using accelerated rather than software rendering. virtual void AcceleratedPluginEnabledRendering() OVERRIDE; - - // Tells the renderer, and from there the GPU process, that the plugin - // allocated the given IOSurface to be used as its backing store. virtual void AcceleratedPluginAllocatedIOSurface(int32 width, int32 height, uint32 surface_id) OVERRIDE; virtual void AcceleratedPluginSwappedIOSurface() OVERRIDE; #endif - virtual void URLRedirectResponse(bool allow, int resource_id) OVERRIDE; + // class-specific methods + + // Returns a WebPluginResourceClient object given its id, or NULL if no + // object with that id exists. + WebPluginResourceClient* GetResourceClient(int id); + + // Returns the id of the renderer that contains this plugin. + int GetRendererId(); + + // Returns the id of the associated render view. + int host_render_view_routing_id() const { + return host_render_view_routing_id_; + } + + // For windowless plugins, paints the given rectangle into the local buffer. + void Paint(const gfx::Rect& rect); + + // Callback from the renderer to let us know that a paint occurred. + void DidPaint(); + + // Notification received on a plugin issued resource request creation. + void OnResourceCreated(int resource_id, WebPluginResourceClient* client); + #if defined(OS_WIN) && !defined(USE_AURA) // Retrieves the IME status from a windowless plug-in and sends it to a // renderer process. A renderer process will convert the coordinates from diff --git a/content/renderer/npapi/webplugin_delegate_proxy.cc b/content/renderer/npapi/webplugin_delegate_proxy.cc index 61c8776..672e48f 100644 --- a/content/renderer/npapi/webplugin_delegate_proxy.cc +++ b/content/renderer/npapi/webplugin_delegate_proxy.cc @@ -29,6 +29,7 @@ #include "content/child/npapi/npobject_stub.h" #include "content/child/npapi/npobject_util.h" #include "content/child/npapi/webplugin.h" +#include "content/child/npapi/webplugin_resource_client.h" #include "content/child/plugin_messages.h" #include "content/common/content_constants_internal.h" #include "content/common/view_messages.h" @@ -672,7 +673,7 @@ static void FlipRectVerticallyWithHeight(gfx::Rect* rect, int height) { } #endif -void WebPluginDelegateProxy::Paint(WebKit::WebCanvas* canvas, +void WebPluginDelegateProxy::Paint(SkCanvas* canvas, const gfx::Rect& damaged_rect) { // Limit the damaged rectangle to whatever is contained inside the plugin // rectangle, as that's the rectangle that we'll actually draw. diff --git a/content/renderer/npapi/webplugin_delegate_proxy.h b/content/renderer/npapi/webplugin_delegate_proxy.h index a40da83..3c5e5a2 100644 --- a/content/renderer/npapi/webplugin_delegate_proxy.h +++ b/content/renderer/npapi/webplugin_delegate_proxy.h @@ -60,7 +60,7 @@ class WebPluginDelegateProxy bool load_manually) OVERRIDE; virtual void UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect) OVERRIDE; - virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) OVERRIDE; + virtual void Paint(SkCanvas* canvas, const gfx::Rect& rect) OVERRIDE; virtual NPObject* GetPluginScriptableObject() OVERRIDE; virtual struct _NPP* GetPluginNPP() OVERRIDE; virtual bool GetFormValue(string16* value) OVERRIDE; diff --git a/content/renderer/npapi/webplugin_impl.cc b/content/renderer/npapi/webplugin_impl.cc index d898011..2f09631 100644 --- a/content/renderer/npapi/webplugin_impl.cc +++ b/content/renderer/npapi/webplugin_impl.cc @@ -17,6 +17,7 @@ #include "content/child/npapi/plugin_host.h" #include "content/child/npapi/plugin_instance.h" #include "content/child/npapi/webplugin_delegate_impl.h" +#include "content/child/npapi/webplugin_resource_client.h" #include "content/common/view_messages.h" #include "content/public/common/content_constants.h" #include "content/public/renderer/content_renderer_client.h" |