Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / public / renderer / pepper_plugin_instance.h
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 "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
16 class GURL;
17
18 namespace base {
19 class FilePath;
20 }
21
22 namespace gfx {
23 class ImageSkia;
24 class Rect;
25 }
26
27 namespace ppapi {
28 class PpapiPermissions;
29 class VarTracker;
30 struct URLRequestInfoData;
31 }
32
33 namespace IPC {
34 struct ChannelHandle;
35 }
36
37 namespace blink {
38 class WebPluginContainer;
39 }
40
41 namespace v8 {
42 class Isolate;
43 }
44
45 namespace content {
46 class RenderView;
47
48 class PepperPluginInstance {
49  public:
50   static CONTENT_EXPORT PepperPluginInstance* Get(PP_Instance instance_id);
51
52   virtual ~PepperPluginInstance() {}
53
54   virtual content::RenderView* GetRenderView() = 0;
55
56   virtual blink::WebPluginContainer* GetContainer() = 0;
57
58   virtual v8::Isolate* GetIsolate() const = 0;
59
60   virtual ppapi::VarTracker* GetVarTracker() = 0;
61
62   virtual const GURL& GetPluginURL() = 0;
63
64   // Returns the location of this module.
65   virtual base::FilePath GetModulePath() = 0;
66
67   // Creates a PPB_ImageData given a Skia image.
68   virtual PP_Resource CreateImage(gfx::ImageSkia* source_image,
69                                   float scale) = 0;
70
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;
78
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;
82
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;
86
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;
95
96   virtual bool IsRectTopmost(const gfx::Rect& rect) = 0;
97
98   virtual int32_t Navigate(const ppapi::URLRequestInfoData& request,
99                            const char* target,
100                            bool from_user_action) = 0;
101
102   // Creates a pending PepperFileRefRendererHost. Returns 0 on failure.
103   virtual int MakePendingFileRefRendererHost(const base::FilePath& path) = 0;
104
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;
107
108   // Sets the selected text for this plugin.
109   virtual void SetSelectedText(const base::string16& selected_text) = 0;
110
111   // Sets the link currently under the cursor.
112   virtual void SetLinkUnderCursor(const std::string& url) = 0;
113 };
114
115 }  // namespace content
116
117 #endif  // CONTENT_PUBLIC_RENDERER_PEPPER_PLUGIN_INSTANCE_H_