summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/content_tests.gypi1
-rw-r--r--content/renderer/pepper/mock_plugin_delegate.cc6
-rw-r--r--content/renderer/pepper/mock_plugin_delegate.h2
-rw-r--r--content/renderer/pepper/pepper_graphics_2d_host.h37
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.cc19
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.h9
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.cc53
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.h12
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_unittest.cc130
-rw-r--r--content/renderer/pepper/plugin_delegate.h33
10 files changed, 57 insertions, 245 deletions
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 7539b27..da58e63 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -435,7 +435,6 @@
'renderer/pepper/mock_plugin_delegate.cc',
'renderer/pepper/mock_plugin_delegate.h',
'renderer/pepper/mock_resource.h',
- 'renderer/pepper/pepper_plugin_instance_unittest.cc',
'renderer/pepper/ppapi_unittest.cc',
'renderer/pepper/ppapi_unittest.h',
'renderer/pepper/quota_file_io_unittest.cc',
diff --git a/content/renderer/pepper/mock_plugin_delegate.cc b/content/renderer/pepper/mock_plugin_delegate.cc
index d84ae2b..0d995f4 100644
--- a/content/renderer/pepper/mock_plugin_delegate.cc
+++ b/content/renderer/pepper/mock_plugin_delegate.cc
@@ -77,12 +77,6 @@ WebKit::WebPlugin* MockPluginDelegate::CreatePluginReplacement(
return NULL;
}
-PluginDelegate::PlatformGraphics2D* MockPluginDelegate::GetGraphics2D(
- PepperPluginInstanceImpl* instance,
- PP_Resource graphics_2d) {
- return NULL;
-}
-
MockPluginDelegate::PlatformContext3D* MockPluginDelegate::CreateContext3D() {
return NULL;
}
diff --git a/content/renderer/pepper/mock_plugin_delegate.h b/content/renderer/pepper/mock_plugin_delegate.h
index dec3ebb..b9425b5 100644
--- a/content/renderer/pepper/mock_plugin_delegate.h
+++ b/content/renderer/pepper/mock_plugin_delegate.h
@@ -42,8 +42,6 @@ class MockPluginDelegate : public PluginDelegate {
virtual SkBitmap* GetSadPluginBitmap() OVERRIDE;
virtual WebKit::WebPlugin* CreatePluginReplacement(
const base::FilePath& file_path) OVERRIDE;
- virtual PlatformGraphics2D* GetGraphics2D(PepperPluginInstanceImpl* instance,
- PP_Resource graphics_2d) OVERRIDE;
virtual PlatformContext3D* CreateContext3D() OVERRIDE;
virtual PlatformVideoDecoder* CreateVideoDecoder(
media::VideoDecodeAccelerator::Client* client,
diff --git a/content/renderer/pepper/pepper_graphics_2d_host.h b/content/renderer/pepper/pepper_graphics_2d_host.h
index af379bf..965974c 100644
--- a/content/renderer/pepper/pepper_graphics_2d_host.h
+++ b/content/renderer/pepper/pepper_graphics_2d_host.h
@@ -30,7 +30,6 @@ class RendererPpapiHost;
class CONTENT_EXPORT PepperGraphics2DHost
: public ppapi::host::ResourceHost,
- public PluginDelegate::PlatformGraphics2D,
public base::SupportsWeakPtr<PepperGraphics2DHost> {
public:
static PepperGraphics2DHost* Create(RendererPpapiHost* host,
@@ -47,20 +46,28 @@ class CONTENT_EXPORT PepperGraphics2DHost
ppapi::host::HostMessageContext* context) OVERRIDE;
virtual PepperGraphics2DHost* AsPepperGraphics2DHost() OVERRIDE;
- // PlatformGraphics2D overrides.
- virtual bool ReadImageData(PP_Resource image,
- const PP_Point* top_left) OVERRIDE;
- virtual bool BindToInstance(PepperPluginInstanceImpl* new_instance) OVERRIDE;
- virtual void Paint(WebKit::WebCanvas* canvas,
- const gfx::Rect& plugin_rect,
- const gfx::Rect& paint_rect) OVERRIDE;
- virtual void ViewWillInitiatePaint() OVERRIDE;
- virtual void ViewInitiatedPaint() OVERRIDE;
- virtual void ViewFlushedPaint() OVERRIDE;
- virtual void SetScale(float scale) OVERRIDE;
- virtual float GetScale() const OVERRIDE;
- virtual bool IsAlwaysOpaque() const OVERRIDE;
- virtual PPB_ImageData_Impl* ImageData() OVERRIDE;
+ bool ReadImageData(PP_Resource image,
+ const PP_Point* top_left);
+ // Assciates this device with the given plugin instance. You can pass NULL
+ // to clear the existing device. Returns true on success. In this case, a
+ // repaint of the page will also be scheduled. Failure means that the device
+ // is already bound to a different instance, and nothing will happen.
+ bool BindToInstance(PepperPluginInstanceImpl* new_instance);
+ // Paints the current backing store to the web page.
+ void Paint(WebKit::WebCanvas* canvas,
+ const gfx::Rect& plugin_rect,
+ const gfx::Rect& paint_rect);
+
+ // Notifications about the view's progress painting. See PluginInstance.
+ // These messages are used to send Flush callbacks to the plugin.
+ void ViewWillInitiatePaint();
+ void ViewInitiatedPaint();
+ void ViewFlushedPaint();
+
+ void SetScale(float scale);
+ float GetScale() const;
+ bool IsAlwaysOpaque() const;
+ PPB_ImageData_Impl* ImageData();
private:
PepperGraphics2DHost(RendererPpapiHost* host,
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index 6f2be66..845a17c 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -171,7 +171,9 @@ void CreateHostForInProcessModule(RenderViewImpl* render_view,
render_view->PpapiPluginCreated(host_impl);
}
-ppapi::host::ResourceHost* GetRendererResourceHost(
+} // namespace
+
+ppapi::host::ResourceHost* PepperPluginDelegateImpl::GetRendererResourceHost(
PP_Instance instance, PP_Resource resource) {
const ppapi::host::PpapiHost* ppapi_host =
RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost();
@@ -180,8 +182,6 @@ ppapi::host::ResourceHost* GetRendererResourceHost(
return ppapi_host->GetResourceHost(resource);
}
-} // namespace
-
PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view)
: RenderViewObserver(render_view),
render_view_(render_view),
@@ -627,19 +627,6 @@ WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePluginReplacement(
render_view_, file_path);
}
-PluginDelegate::PlatformGraphics2D*
- PepperPluginDelegateImpl::GetGraphics2D(
- PepperPluginInstanceImpl* instance,
- PP_Resource resource) {
- ppapi::host::ResourceHost* host =
- GetRendererResourceHost(instance->pp_instance(), resource);
- if (!host)
- return NULL;
- PepperGraphics2DHost* result = host->AsPepperGraphics2DHost();
- DLOG_IF(ERROR, !result) << "Resource is not PepperGraphics2DHost.";
- return result;
-}
-
PluginDelegate::PlatformContext3D*
PepperPluginDelegateImpl::CreateContext3D() {
// If accelerated compositing of plugins is disabled, fail to create a 3D
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h
index f304c7b..5372532 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h
@@ -33,6 +33,9 @@ class FilePath;
namespace ppapi {
class PepperFilePath;
class PPB_X509Certificate_Fields;
+namespace host {
+class ResourceHost;
+}
}
namespace WebKit {
@@ -54,6 +57,9 @@ class PepperPluginDelegateImpl
public base::SupportsWeakPtr<PepperPluginDelegateImpl>,
public RenderViewObserver {
public:
+ static ppapi::host::ResourceHost* GetRendererResourceHost(
+ PP_Instance instance, PP_Resource resource);
+
explicit PepperPluginDelegateImpl(RenderViewImpl* render_view);
virtual ~PepperPluginDelegateImpl();
@@ -139,9 +145,6 @@ class PepperPluginDelegateImpl
uint32_t sample_rate,
uint32_t sample_count,
PlatformAudioOutputClient* client) OVERRIDE;
- virtual PlatformGraphics2D* GetGraphics2D(
- PepperPluginInstanceImpl* instance,
- PP_Resource resource) OVERRIDE;
virtual PlatformContext3D* CreateContext3D() OVERRIDE;
virtual PlatformVideoDecoder* CreateVideoDecoder(
media::VideoDecodeAccelerator::Client* client,
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index 77d9b3d..9e1a15c 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -25,6 +25,8 @@
#include "content/renderer/pepper/host_globals.h"
#include "content/renderer/pepper/message_channel.h"
#include "content/renderer/pepper/npapi_glue.h"
+#include "content/renderer/pepper/pepper_graphics_2d_host.h"
+#include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
#include "content/renderer/pepper/plugin_module.h"
#include "content/renderer/pepper/plugin_object.h"
#include "content/renderer/pepper/ppb_buffer_impl.h"
@@ -552,9 +554,8 @@ void PepperPluginInstanceImpl::Paint(WebCanvas* canvas,
return;
}
- PluginDelegate::PlatformGraphics2D* bound_graphics_2d = GetBoundGraphics2D();
- if (bound_graphics_2d)
- bound_graphics_2d->Paint(canvas, plugin_rect, paint_rect);
+ if (bound_graphics_2d_platform_)
+ bound_graphics_2d_platform_->Paint(canvas, plugin_rect, paint_rect);
}
void PepperPluginInstanceImpl::InvalidateRect(const gfx::Rect& rect) {
@@ -1012,15 +1013,15 @@ void PepperPluginInstanceImpl::PageVisibilityChanged(bool is_visible) {
}
void PepperPluginInstanceImpl::ViewWillInitiatePaint() {
- if (GetBoundGraphics2D())
- GetBoundGraphics2D()->ViewWillInitiatePaint();
+ if (bound_graphics_2d_platform_)
+ bound_graphics_2d_platform_->ViewWillInitiatePaint();
else if (bound_graphics_3d_.get())
bound_graphics_3d_->ViewWillInitiatePaint();
}
void PepperPluginInstanceImpl::ViewInitiatedPaint() {
- if (GetBoundGraphics2D())
- GetBoundGraphics2D()->ViewInitiatedPaint();
+ if (bound_graphics_2d_platform_)
+ bound_graphics_2d_platform_->ViewInitiatedPaint();
else if (bound_graphics_3d_.get())
bound_graphics_3d_->ViewInitiatedPaint();
}
@@ -1028,8 +1029,8 @@ void PepperPluginInstanceImpl::ViewInitiatedPaint() {
void PepperPluginInstanceImpl::ViewFlushedPaint() {
// Keep a reference on the stack. See NOTE above.
scoped_refptr<PepperPluginInstanceImpl> ref(this);
- if (GetBoundGraphics2D())
- GetBoundGraphics2D()->ViewFlushedPaint();
+ if (bound_graphics_2d_platform_)
+ bound_graphics_2d_platform_->ViewFlushedPaint();
else if (bound_graphics_3d_.get())
bound_graphics_3d_->ViewFlushedPaint();
}
@@ -1042,13 +1043,15 @@ bool PepperPluginInstanceImpl::GetBitmapForOptimizedPluginPaint(
float* scale_factor) {
if (!always_on_top_)
return false;
- if (!GetBoundGraphics2D() || !GetBoundGraphics2D()->IsAlwaysOpaque())
+ if (!bound_graphics_2d_platform_ ||
+ !bound_graphics_2d_platform_->IsAlwaysOpaque()) {
return false;
+ }
// We specifically want to compare against the area covered by the backing
// store when seeing if we cover the given paint bounds, since the backing
// store could be smaller than the declared plugin area.
- PPB_ImageData_Impl* image_data = GetBoundGraphics2D()->ImageData();
+ PPB_ImageData_Impl* image_data = bound_graphics_2d_platform_->ImageData();
// ImageDatas created by NaCl don't have a TransportDIB, so can't be
// optimized this way.
if (!image_data->GetTransportDIB())
@@ -1062,7 +1065,7 @@ bool PepperPluginInstanceImpl::GetBitmapForOptimizedPluginPaint(
gfx::Rect pixel_plugin_backing_store_rect(
0, 0, image_data->width(), image_data->height());
- float scale = GetBoundGraphics2D()->GetScale();
+ float scale = bound_graphics_2d_platform_->GetScale();
gfx::Rect plugin_backing_store_rect = gfx::ToEnclosedRect(
gfx::ScaleRect(pixel_plugin_backing_store_rect, scale));
@@ -1499,15 +1502,6 @@ bool PepperPluginInstanceImpl::CanRotateView() {
return true;
}
-void PepperPluginInstanceImpl::SetBoundGraphics2DForTest(
- PluginDelegate::PlatformGraphics2D* graphics) {
- BindGraphics(pp_instance(), 0); // Unbind any old stuff.
- if (graphics) {
- bound_graphics_2d_platform_ = graphics;
- bound_graphics_2d_platform_->BindToInstance(this);
- }
-}
-
void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) {
if (!LoadPdfInterface())
return;
@@ -1709,11 +1703,6 @@ bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output,
#endif
}
-PluginDelegate::PlatformGraphics2D*
- PepperPluginInstanceImpl::GetBoundGraphics2D() const {
- return bound_graphics_2d_platform_;
-}
-
static void IgnoreCallback(unsigned, bool) {}
void PepperPluginInstanceImpl::UpdateLayer() {
@@ -1902,7 +1891,7 @@ PP_Bool PepperPluginInstanceImpl::BindGraphics(PP_Instance instance,
bound_graphics_3d_ = NULL;
}
if (bound_graphics_2d_platform_) {
- GetBoundGraphics2D()->BindToInstance(NULL);
+ bound_graphics_2d_platform_->BindToInstance(NULL);
bound_graphics_2d_platform_ = NULL;
}
@@ -1919,8 +1908,14 @@ PP_Bool PepperPluginInstanceImpl::BindGraphics(PP_Instance instance,
desired_fullscreen_state_ != view_data_.is_fullscreen)
return PP_FALSE;
- PluginDelegate::PlatformGraphics2D* graphics_2d =
- delegate_->GetGraphics2D(this, device);
+ ppapi::host::ResourceHost* host =
+ PepperPluginDelegateImpl::GetRendererResourceHost(pp_instance(), device);
+ PepperGraphics2DHost* graphics_2d = NULL;
+ if (host) {
+ graphics_2d = host->AsPepperGraphics2DHost();
+ DLOG_IF(ERROR, !graphics_2d) << "Resource is not PepperGraphics2DHost.";
+ }
+
EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false);
PPB_Graphics3D_Impl* graphics_3d = enter_3d.succeeded() ?
static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) : NULL;
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h
index 9b01645..915108d 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.h
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.h
@@ -97,6 +97,7 @@ namespace content {
class ContentDecryptorDelegate;
class FullscreenContainer;
class MessageChannel;
+class PepperGraphics2DHost;
class PluginDelegate;
class PluginModule;
class PluginObject;
@@ -250,11 +251,6 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
bool CanRotateView();
void RotateView(WebKit::WebPlugin::RotationType type);
- // Sets the bound_graphics_2d_platform_ for testing purposes. This is instead
- // of calling BindGraphics and allows any PlatformGraphics implementation to
- // be used, not just a resource one.
- void SetBoundGraphics2DForTest(PluginDelegate::PlatformGraphics2D* graphics);
-
// There are 2 implementations of the fullscreen interface
// PPB_FlashFullscreen is used by Pepper Flash.
// PPB_Fullscreen is intended for other applications including NaCl.
@@ -599,10 +595,6 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format);
bool PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas);
- // Get the bound graphics context as a concrete 2D graphics context or returns
- // null if the context is not 2D.
- PluginDelegate::PlatformGraphics2D* GetBoundGraphics2D() const;
-
// Updates the layer for compositing. This creates a layer and attaches to the
// container if:
// - we have a bound Graphics3D
@@ -692,7 +684,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// The current device context for painting in 2D and 3D.
scoped_refptr<PPB_Graphics3D_Impl> bound_graphics_3d_;
- PluginDelegate::PlatformGraphics2D* bound_graphics_2d_platform_;
+ PepperGraphics2DHost* bound_graphics_2d_platform_;
// We track two types of focus, one from WebKit, which is the focus among
// all elements of the page, one one from the browser, which is whether the
diff --git a/content/renderer/pepper/pepper_plugin_instance_unittest.cc b/content/renderer/pepper/pepper_plugin_instance_unittest.cc
deleted file mode 100644
index f0bd5a3..0000000
--- a/content/renderer/pepper/pepper_plugin_instance_unittest.cc
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright (c) 2012 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 "content/renderer/pepper/pepper_plugin_instance_impl.h"
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "content/renderer/pepper/plugin_delegate.h"
-#include "content/renderer/pepper/ppapi_unittest.h"
-#include "content/renderer/pepper/ppb_image_data_impl.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/safe_integer_conversions.h"
-
-namespace content {
-
-namespace {
-
-// A mock graphics object to bind. We only have to implement enough so that
-// GetBitmapForOptimizedPluginPaint runs.
-//
-// If this is eventually all moved to content, we can simplify this. The
-// point here is that we need to just have a bound graphics 2d resource host
-// with the right properties.
-class MockPlatformGraphics2D : public PluginDelegate::PlatformGraphics2D {
- public:
- // The image data pointer must outlive this class.
- MockPlatformGraphics2D(PPB_ImageData_Impl* image_data, float scale)
- : image_data_(image_data),
- scale_(scale),
- bound_instance_(NULL) {
- }
- virtual ~MockPlatformGraphics2D() {
- if (bound_instance_)
- bound_instance_->SetBoundGraphics2DForTest(NULL);
- }
-
- virtual bool ReadImageData(PP_Resource image,
- const PP_Point* top_left) OVERRIDE {
- return false;
- }
- virtual bool BindToInstance(PepperPluginInstanceImpl* new_instance) OVERRIDE {
- bound_instance_ = new_instance;
- return true;
- }
- virtual void Paint(WebKit::WebCanvas* canvas,
- const gfx::Rect& plugin_rect,
- const gfx::Rect& paint_rect) OVERRIDE {}
- virtual void ViewWillInitiatePaint() OVERRIDE {}
- virtual void ViewInitiatedPaint() OVERRIDE {}
- virtual void ViewFlushedPaint() OVERRIDE {}
-
- virtual bool IsAlwaysOpaque() const OVERRIDE { return true; }
- virtual void SetScale(float scale) OVERRIDE {}
- virtual float GetScale() const OVERRIDE { return scale_; }
- virtual PPB_ImageData_Impl* ImageData() OVERRIDE {
- return image_data_;
- }
-
- private:
- PPB_ImageData_Impl* image_data_;
- float scale_;
- PepperPluginInstanceImpl* bound_instance_;
-
- DISALLOW_COPY_AND_ASSIGN(MockPlatformGraphics2D);
-};
-
-} // namespace
-
-// This class is forward-declared as a friend so can't be in the anonymous
-// namespace.
-class PpapiPluginInstanceTest : public PpapiUnittest {
- public:
- bool GetBitmapForOptimizedPluginPaint(const gfx::Rect& paint_bounds,
- TransportDIB** dib,
- gfx::Rect* location,
- gfx::Rect* clip,
- float* scale_factor) {
- return !!instance()->GetBitmapForOptimizedPluginPaint(
- paint_bounds, dib, location, clip, scale_factor);
- }
-};
-
-// This matches the if condition in ImageDataPlatformBackend::Init as we can't
-// use RenderThread in the test.
-#if !(defined(OS_POSIX) && !defined(TOOLKIT_GTK) && !defined(OS_ANDROID))
-
-// Test that GetBitmapForOptimizedPluginPaint doesn't return a bitmap rect
-// that's bigger than the actual backing store bitmap.
-TEST_F(PpapiPluginInstanceTest, GetBitmap2xScale) {
- PP_Size size;
- size.width = 3;
- size.height = 3;
-
- scoped_refptr<PPB_ImageData_Impl> image_data = new PPB_ImageData_Impl(
- instance()->pp_instance(), PPB_ImageData_Impl::PLATFORM);
- image_data->Init(PPB_ImageData_Impl::GetNativeImageDataFormat(),
- size.width, size.height, true);
- ASSERT_TRUE(image_data->Map() != NULL);
-
- float scale = 2.0;
- MockPlatformGraphics2D mock_graphics_2d(image_data.get(), 1.0 / scale);
- instance()->SetBoundGraphics2DForTest(&mock_graphics_2d);
-
- instance()->SetAlwaysOnTop(true);
- SetViewSize(size.width, size.height);
-
- gfx::Rect bounds(0, 0, 1, 1);
- gfx::Rect location;
- gfx::Rect clip;
- float bitmap_scale = 0;
- TransportDIB* dib = NULL;
- EXPECT_TRUE(GetBitmapForOptimizedPluginPaint(
- bounds, &dib, &location, &clip, &bitmap_scale));
-
- EXPECT_EQ(0, location.x());
- EXPECT_EQ(0, location.y());
- EXPECT_EQ(gfx::ToFlooredInt(size.width / scale), location.width());
- EXPECT_EQ(gfx::ToFlooredInt(size.height / scale), location.height());
- EXPECT_EQ(0, clip.x());
- EXPECT_EQ(0, clip.y());
- EXPECT_EQ(size.width, clip.width());
- EXPECT_EQ(size.height, clip.height());
- EXPECT_EQ(scale, bitmap_scale);
-}
-
-#endif
-
-} // namespace content
diff --git a/content/renderer/pepper/plugin_delegate.h b/content/renderer/pepper/plugin_delegate.h
index 0e3a5cb..9ad53c7 100644
--- a/content/renderer/pepper/plugin_delegate.h
+++ b/content/renderer/pepper/plugin_delegate.h
@@ -113,35 +113,6 @@ class PPB_TCPSocket_Private_Impl;
// PPAPI plugins.
class PluginDelegate {
public:
- class CONTENT_EXPORT PlatformGraphics2D {
- public:
- virtual ~PlatformGraphics2D() {}
-
- virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0;
-
- // Assciates this device with the given plugin instance. You can pass NULL
- // to clear the existing device. Returns true on success. In this case, a
- // repaint of the page will also be scheduled. Failure means that the device
- // is already bound to a different instance, and nothing will happen.
- virtual bool BindToInstance(PepperPluginInstanceImpl* new_instance) = 0;
-
- // Paints the current backing store to the web page.
- virtual void Paint(WebKit::WebCanvas* canvas,
- const gfx::Rect& plugin_rect,
- const gfx::Rect& paint_rect) = 0;
-
- // Notifications about the view's progress painting. See PluginInstance.
- // These messages are used to send Flush callbacks to the plugin.
- virtual void ViewWillInitiatePaint() = 0;
- virtual void ViewInitiatedPaint() = 0;
- virtual void ViewFlushedPaint() = 0;
-
- virtual bool IsAlwaysOpaque() const = 0;
- virtual void SetScale(float scale) = 0;
- virtual float GetScale() const = 0;
- virtual PPB_ImageData_Impl* ImageData() = 0;
- };
-
class PlatformContext3D {
public:
virtual ~PlatformContext3D() {}
@@ -277,10 +248,6 @@ class PluginDelegate {
virtual WebKit::WebPlugin* CreatePluginReplacement(
const base::FilePath& file_path) = 0;
- // Returns the internal PlatformGraphics2D implementation.
- virtual PlatformGraphics2D* GetGraphics2D(PepperPluginInstanceImpl* instance,
- PP_Resource graphics_2d) = 0;
-
// The caller will own the pointer returned from this.
virtual PlatformContext3D* CreateContext3D() = 0;