OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/ref_counted.h" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" |
| 14 |
| 15 typedef struct _pp_Instance PP_Instance; |
| 16 typedef struct _pp_Resource PP_Resource; |
| 17 typedef struct _ppb_Instance PPB_Instance; |
| 18 typedef struct _ppp_Instance PPP_Instance; |
| 19 |
| 20 namespace gfx { |
| 21 class Rect; |
| 22 } |
| 23 |
| 24 namespace WebKit { |
| 25 struct WebCursorInfo; |
| 26 class WebInputEvent; |
| 27 } |
| 28 |
| 29 namespace pepper { |
| 30 |
| 31 class DeviceContext2D; |
| 32 class PluginDelegate; |
| 33 class PluginModule; |
| 34 |
| 35 class PluginInstance : public base::RefCounted<PluginInstance> { |
| 36 public: |
| 37 PluginInstance(PluginDelegate* delegate, |
| 38 PluginModule* module, |
| 39 const PPP_Instance* instance_interface); |
| 40 ~PluginInstance(); |
| 41 |
| 42 static const PPB_Instance* GetInterface(); |
| 43 |
| 44 // Converts the given instance ID to an actual instance object. |
| 45 static PluginInstance* FromPPInstance(PP_Instance instance); |
| 46 |
| 47 PluginDelegate* delegate() const { return delegate_; } |
| 48 PluginModule* module() const { return module_.get(); } |
| 49 |
| 50 PP_Instance GetPPInstance(); |
| 51 |
| 52 void Paint(WebKit::WebCanvas* canvas, |
| 53 const gfx::Rect& plugin_rect, |
| 54 const gfx::Rect& paint_rect); |
| 55 |
| 56 // PPB_Instance implementation. |
| 57 bool BindGraphicsDeviceContext(PP_Resource device_id); |
| 58 |
| 59 // PPP_Instance pass-through. |
| 60 void Delete(); |
| 61 bool Initialize(const std::vector<std::string>& arg_names, |
| 62 const std::vector<std::string>& arg_values); |
| 63 bool HandleInputEvent(const WebKit::WebInputEvent& event, |
| 64 WebKit::WebCursorInfo* cursor_info); |
| 65 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip); |
| 66 |
| 67 private: |
| 68 PluginDelegate* delegate_; |
| 69 scoped_refptr<PluginModule> module_; |
| 70 const PPP_Instance* instance_interface_; |
| 71 |
| 72 // The current device context for painting in 2D. |
| 73 scoped_refptr<DeviceContext2D> device_context_2d_; |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 76 }; |
| 77 |
| 78 } // namespace pepper |
| 79 |
| 80 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ |
OLD | NEW |