1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PLUGIN_WEBPLUGIN_ACCELERATED_SURFACE_PROXY_H_
6 #define CONTENT_PLUGIN_WEBPLUGIN_ACCELERATED_SURFACE_PROXY_H_
8 #include "base/compiler_specific.h"
9 #include "ui/gl/gpu_preference.h"
10 #include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h"
12 class AcceleratedSurface
;
17 // Out-of-process implementation of WebPluginAcceleratedSurface that proxies
18 // calls through a WebPluginProxy.
19 class WebPluginAcceleratedSurfaceProxy
20 : public webkit::npapi::WebPluginAcceleratedSurface
{
22 // Creates a new WebPluginAcceleratedSurfaceProxy that uses plugin_proxy
23 // to proxy calls. plugin_proxy must outlive this object. Returns NULL if
24 // initialization fails.
25 static WebPluginAcceleratedSurfaceProxy
* Create(
26 WebPluginProxy
* plugin_proxy
,
27 gfx::GpuPreference gpu_preference
);
29 virtual ~WebPluginAcceleratedSurfaceProxy();
31 // WebPluginAcceleratedSurface implementation.
32 virtual void SetWindowHandle(gfx::PluginWindowHandle window
) OVERRIDE
;
33 virtual bool IsComposited() OVERRIDE
;
34 virtual void SetSize(const gfx::Size
& size
) OVERRIDE
;
35 virtual CGLContextObj
context() OVERRIDE
;
36 virtual void StartDrawing() OVERRIDE
;
37 virtual void EndDrawing() OVERRIDE
;
40 WebPluginAcceleratedSurfaceProxy(WebPluginProxy
* plugin_proxy
,
41 AcceleratedSurface
* surface
,
44 WebPluginProxy
* plugin_proxy_
; // Weak ref.
45 gfx::PluginWindowHandle window_handle_
;
46 AcceleratedSurface
* surface_
;
49 DISALLOW_COPY_AND_ASSIGN(WebPluginAcceleratedSurfaceProxy
);
52 } // namespace content
54 #endif // CONTENT_PLUGIN_WEBPLUGIN_ACCELERATED_SURFACE_PROXY_H_