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