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.
5 #ifndef CONTENT_PUBLIC_RENDERER_PEPPER_PLUGIN_INSTANCE_H_
6 #define CONTENT_PUBLIC_RENDERER_PEPPER_PLUGIN_INSTANCE_H_
8 #include "base/basictypes.h"
9 #include "base/process/process_handle.h"
10 #include "base/strings/string16.h"
11 #include "content/common/content_export.h"
12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_var.h"
14 #include "ppapi/c/private/ppb_instance_private.h"
28 class PpapiPermissions;
30 struct URLRequestInfoData;
38 class WebPluginContainer;
48 class PepperPluginInstance {
50 static CONTENT_EXPORT PepperPluginInstance* Get(PP_Instance instance_id);
52 virtual ~PepperPluginInstance() {}
54 virtual content::RenderView* GetRenderView() = 0;
56 virtual blink::WebPluginContainer* GetContainer() = 0;
58 virtual v8::Isolate* GetIsolate() const = 0;
60 virtual ppapi::VarTracker* GetVarTracker() = 0;
62 virtual const GURL& GetPluginURL() = 0;
64 // Returns the location of this module.
65 virtual base::FilePath GetModulePath() = 0;
67 // Creates a PPB_ImageData given a Skia image.
68 virtual PP_Resource CreateImage(gfx::ImageSkia* source_image,
71 // Switches this instance with one that uses the out of process IPC proxy.
72 virtual PP_ExternalPluginResult SwitchToOutOfProcessProxy(
73 const base::FilePath& file_path,
74 ppapi::PpapiPermissions permissions,
75 const IPC::ChannelHandle& channel_handle,
76 base::ProcessId plugin_pid,
77 int plugin_child_id) = 0;
79 // Set this to true if plugin thinks it will always be on top. This allows us
80 // to use a more optimized painting path in some cases.
81 virtual void SetAlwaysOnTop(bool on_top) = 0;
83 // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe
84 // or embedded in a page).
85 virtual bool IsFullPagePlugin() = 0;
87 // Switches between fullscreen and normal mode. If |delay_report| is set to
88 // false, it may report the new state through DidChangeView immediately. If
89 // true, it will delay it. When called from the plugin, delay_report should
90 // be true to avoid re-entrancy. Returns true if the switch will be carried
91 // out, because of this call or because a switch was pending already anyway.
92 // Returns false if the switch will not be carried out because fullscreen mode
93 // is disallowed by a preference.
94 virtual bool FlashSetFullscreen(bool fullscreen, bool delay_report) = 0;
96 virtual bool IsRectTopmost(const gfx::Rect& rect) = 0;
98 virtual int32_t Navigate(const ppapi::URLRequestInfoData& request,
100 bool from_user_action) = 0;
102 // Creates a pending PepperFileRefRendererHost. Returns 0 on failure.
103 virtual int MakePendingFileRefRendererHost(const base::FilePath& path) = 0;
105 // Sets a read-only property on the <embed> tag for this plugin instance.
106 virtual void SetEmbedProperty(PP_Var key, PP_Var value) = 0;
108 // Sets the selected text for this plugin.
109 virtual void SetSelectedText(const base::string16& selected_text) = 0;
111 // Sets the link currently under the cursor.
112 virtual void SetLinkUnderCursor(const std::string& url) = 0;
115 } // namespace content
117 #endif // CONTENT_PUBLIC_RENDERER_PEPPER_PLUGIN_INSTANCE_H_