Home | History | Annotate | Download | only in plugin
      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.
      4 
      5 #ifndef CONTENT_PLUGIN_WEBPLUGIN_ACCELERATED_SURFACE_PROXY_H_
      6 #define CONTENT_PLUGIN_WEBPLUGIN_ACCELERATED_SURFACE_PROXY_H_
      7 
      8 #include "base/compiler_specific.h"
      9 #include "content/child/npapi/webplugin_accelerated_surface_mac.h"
     10 #include "ui/gl/gpu_preference.h"
     11 
     12 class AcceleratedSurface;
     13 
     14 namespace content {
     15 class WebPluginProxy;
     16 
     17 // Out-of-process implementation of WebPluginAcceleratedSurface that proxies
     18 // calls through a WebPluginProxy.
     19 class WebPluginAcceleratedSurfaceProxy : public WebPluginAcceleratedSurface {
     20  public:
     21   // Creates a new WebPluginAcceleratedSurfaceProxy that uses plugin_proxy
     22   // to proxy calls. plugin_proxy must outlive this object. Returns NULL if
     23   // initialization fails.
     24   static WebPluginAcceleratedSurfaceProxy* Create(
     25       WebPluginProxy* plugin_proxy,
     26       gfx::GpuPreference gpu_preference);
     27 
     28   virtual ~WebPluginAcceleratedSurfaceProxy();
     29 
     30   // WebPluginAcceleratedSurface implementation.
     31   virtual void SetSize(const gfx::Size& size) OVERRIDE;
     32   virtual CGLContextObj context() OVERRIDE;
     33   virtual void StartDrawing() OVERRIDE;
     34   virtual void EndDrawing() OVERRIDE;
     35 
     36  private:
     37   WebPluginAcceleratedSurfaceProxy(WebPluginProxy* plugin_proxy,
     38                                    AcceleratedSurface* surface);
     39 
     40   WebPluginProxy* plugin_proxy_;  // Weak ref.
     41   AcceleratedSurface* surface_;
     42 
     43   DISALLOW_COPY_AND_ASSIGN(WebPluginAcceleratedSurfaceProxy);
     44 };
     45 
     46 }  // namespace content
     47 
     48 #endif  // CONTENT_PLUGIN_WEBPLUGIN_ACCELERATED_SURFACE_PROXY_H_
     49