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"
15 #include "ui/base/ime/text_input_type.h"
29 class PpapiPermissions
;
31 struct URLRequestInfoData
;
39 class WebPluginContainer
;
49 class PepperPluginInstance
{
51 static CONTENT_EXPORT PepperPluginInstance
* Get(PP_Instance instance_id
);
53 virtual ~PepperPluginInstance() {}
55 virtual content::RenderView
* GetRenderView() = 0;
57 virtual blink::WebPluginContainer
* GetContainer() = 0;
59 virtual v8::Isolate
* GetIsolate() const = 0;
61 virtual ppapi::VarTracker
* GetVarTracker() = 0;
63 virtual const GURL
& GetPluginURL() = 0;
65 // Returns the location of this module.
66 virtual base::FilePath
GetModulePath() = 0;
68 // Creates a PPB_ImageData given a Skia image.
69 virtual PP_Resource
CreateImage(gfx::ImageSkia
* source_image
,
72 // Switches this instance with one that uses the out of process IPC proxy.
73 virtual PP_ExternalPluginResult
SwitchToOutOfProcessProxy(
74 const base::FilePath
& file_path
,
75 ppapi::PpapiPermissions permissions
,
76 const IPC::ChannelHandle
& channel_handle
,
77 base::ProcessId plugin_pid
,
78 int plugin_child_id
) = 0;
80 // Set this to true if plugin thinks it will always be on top. This allows us
81 // to use a more optimized painting path in some cases.
82 virtual void SetAlwaysOnTop(bool on_top
) = 0;
84 // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe
85 // or embedded in a page).
86 virtual bool IsFullPagePlugin() = 0;
88 // Switches between fullscreen and normal mode. If |delay_report| is set to
89 // false, it may report the new state through DidChangeView immediately. If
90 // true, it will delay it. When called from the plugin, delay_report should
91 // be true to avoid re-entrancy. Returns true if the switch will be carried
92 // out, because of this call or because a switch was pending already anyway.
93 // Returns false if the switch will not be carried out because fullscreen mode
94 // is disallowed by a preference.
95 virtual bool FlashSetFullscreen(bool fullscreen
, bool delay_report
) = 0;
97 virtual bool IsRectTopmost(const gfx::Rect
& rect
) = 0;
99 virtual int32_t Navigate(const ppapi::URLRequestInfoData
& request
,
101 bool from_user_action
) = 0;
103 // Creates a pending PepperFileRefRendererHost. Returns 0 on failure.
104 virtual int MakePendingFileRefRendererHost(const base::FilePath
& path
) = 0;
106 // Sets a read-only property on the <embed> tag for this plugin instance.
107 virtual void SetEmbedProperty(PP_Var key
, PP_Var value
) = 0;
109 // Sets the selected text for this plugin.
110 virtual void SetSelectedText(const base::string16
& selected_text
) = 0;
112 // Sets the link currently under the cursor.
113 virtual void SetLinkUnderCursor(const std::string
& url
) = 0;
115 // Sets the text input type for this plugin.
116 virtual void SetTextInputType(ui::TextInputType type
) = 0;
118 // Posts a message to the JavaScript object for this instance.
119 virtual void PostMessageToJavaScript(PP_Var message
) = 0;
122 } // namespace content
124 #endif // CONTENT_PUBLIC_RENDERER_PEPPER_PLUGIN_INSTANCE_H_