Home | History | Annotate | Download | only in renderer
      1 // Copyright (c) 2013 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_PUBLIC_RENDERER_PEPPER_PLUGIN_INSTANCE_H_
      6 #define CONTENT_PUBLIC_RENDERER_PEPPER_PLUGIN_INSTANCE_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/process/process_handle.h"
     10 #include "content/common/content_export.h"
     11 #include "ppapi/c/pp_resource.h"
     12 #include "ppapi/c/private/ppb_instance_private.h"
     13 
     14 class GURL;
     15 
     16 namespace base {
     17 class FilePath;
     18 }
     19 
     20 namespace gfx {
     21 class ImageSkia;
     22 class Rect;
     23 }
     24 
     25 namespace ppapi {
     26 class PpapiPermissions;
     27 class VarTracker;
     28 struct URLRequestInfoData;
     29 }
     30 
     31 namespace IPC {
     32 struct ChannelHandle;
     33 }
     34 
     35 namespace WebKit {
     36 class WebPluginContainer;
     37 }
     38 
     39 namespace content {
     40 class RenderView;
     41 
     42 class PepperPluginInstance {
     43  public:
     44   static CONTENT_EXPORT PepperPluginInstance* Get(PP_Instance instance_id);
     45 
     46   virtual ~PepperPluginInstance() {}
     47 
     48   virtual content::RenderView* GetRenderView() = 0;
     49 
     50   virtual WebKit::WebPluginContainer* GetContainer() = 0;
     51 
     52   virtual ppapi::VarTracker* GetVarTracker() = 0;
     53 
     54   virtual const GURL& GetPluginURL() = 0;
     55 
     56   // Returns the location of this module.
     57   virtual base::FilePath GetModulePath() = 0;
     58 
     59   // Returns a reference to a file with the given path.
     60   // The returned object will have a refcount of 0 (just like "new").
     61   virtual PP_Resource CreateExternalFileReference(
     62       const base::FilePath& external_file_path) = 0;
     63 
     64   // Creates a PPB_ImageData given a Skia image.
     65   virtual PP_Resource CreateImage(gfx::ImageSkia* source_image,
     66                                   float scale) = 0;
     67 
     68   // Switches this instance with one that uses the out of process IPC proxy.
     69   virtual PP_ExternalPluginResult SwitchToOutOfProcessProxy(
     70       const base::FilePath& file_path,
     71       ppapi::PpapiPermissions permissions,
     72       const IPC::ChannelHandle& channel_handle,
     73       base::ProcessId plugin_pid,
     74       int plugin_child_id) = 0;
     75 
     76   // Set this to true if plugin thinks it will always be on top. This allows us
     77   // to use a more optimized painting path in some cases.
     78   virtual void SetAlwaysOnTop(bool on_top) = 0;
     79 
     80   // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe
     81   // or embedded in a page).
     82   virtual bool IsFullPagePlugin() = 0;
     83 
     84   // Switches between fullscreen and normal mode. If |delay_report| is set to
     85   // false, it may report the new state through DidChangeView immediately. If
     86   // true, it will delay it. When called from the plugin, delay_report should
     87   // be true to avoid re-entrancy.
     88   virtual void FlashSetFullscreen(bool fullscreen, bool delay_report) = 0;
     89 
     90   virtual bool IsRectTopmost(const gfx::Rect& rect) = 0;
     91 
     92   virtual int32_t Navigate(const ppapi::URLRequestInfoData& request,
     93                            const char* target,
     94                            bool from_user_action) = 0;
     95 
     96 };
     97 
     98 }  // namespace content
     99 
    100 #endif  // CONTENT_PUBLIC_RENDERER_PEPPER_PLUGIN_INSTANCE_H_
    101