| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PPAPI_PPB_GRAPHICS_2D_PROXY_H_ | 5 #ifndef PPAPI_PPB_GRAPHICS_2D_PROXY_H_ |
| 6 #define PPAPI_PPB_GRAPHICS_2D_PROXY_H_ | 6 #define PPAPI_PPB_GRAPHICS_2D_PROXY_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
| 11 #include "ppapi/c/pp_module.h" | 11 #include "ppapi/c/pp_module.h" |
| 12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
| 13 #include "ppapi/c/pp_size.h" | 13 #include "ppapi/c/pp_size.h" |
| 14 #include "ppapi/c/pp_var.h" | 14 #include "ppapi/c/pp_var.h" |
| 15 #include "ppapi/cpp/completion_callback.h" | 15 #include "ppapi/cpp/completion_callback.h" |
| 16 #include "ppapi/proxy/host_resource.h" | |
| 17 #include "ppapi/proxy/interface_proxy.h" | 16 #include "ppapi/proxy/interface_proxy.h" |
| 18 #include "ppapi/proxy/plugin_resource.h" | 17 #include "ppapi/proxy/plugin_resource.h" |
| 19 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" | 18 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
| 19 #include "ppapi/shared_impl/host_resource.h" |
| 20 | 20 |
| 21 struct PPB_Graphics2D; | 21 struct PPB_Graphics2D; |
| 22 struct PP_Point; | 22 struct PP_Point; |
| 23 struct PP_Rect; | 23 struct PP_Rect; |
| 24 | 24 |
| 25 namespace pp { | 25 namespace pp { |
| 26 namespace proxy { | 26 namespace proxy { |
| 27 | 27 |
| 28 class PPB_Graphics2D_Proxy : public InterfaceProxy { | 28 class PPB_Graphics2D_Proxy : public InterfaceProxy { |
| 29 public: | 29 public: |
| 30 PPB_Graphics2D_Proxy(Dispatcher* dispatcher, const void* target_interface); | 30 PPB_Graphics2D_Proxy(Dispatcher* dispatcher, const void* target_interface); |
| 31 virtual ~PPB_Graphics2D_Proxy(); | 31 virtual ~PPB_Graphics2D_Proxy(); |
| 32 | 32 |
| 33 static const Info* GetInfo(); | 33 static const Info* GetInfo(); |
| 34 | 34 |
| 35 static PP_Resource CreateProxyResource(PP_Instance instance, | 35 static PP_Resource CreateProxyResource(PP_Instance instance, |
| 36 const PP_Size& size, | 36 const PP_Size& size, |
| 37 PP_Bool is_always_opaque); | 37 PP_Bool is_always_opaque); |
| 38 | 38 |
| 39 const PPB_Graphics2D* ppb_graphics_2d_target() const { | 39 const PPB_Graphics2D* ppb_graphics_2d_target() const { |
| 40 return static_cast<const PPB_Graphics2D*>(target_interface()); | 40 return static_cast<const PPB_Graphics2D*>(target_interface()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 // InterfaceProxy implementation. | 43 // InterfaceProxy implementation. |
| 44 virtual bool OnMessageReceived(const IPC::Message& msg); | 44 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // Plugin->renderer message handlers. | 47 // Plugin->renderer message handlers. |
| 48 void OnMsgPaintImageData(const HostResource& graphics_2d, | 48 void OnMsgPaintImageData(const ppapi::HostResource& graphics_2d, |
| 49 const HostResource& image_data, | 49 const ppapi::HostResource& image_data, |
| 50 const PP_Point& top_left, | 50 const PP_Point& top_left, |
| 51 bool src_rect_specified, | 51 bool src_rect_specified, |
| 52 const PP_Rect& src_rect); | 52 const PP_Rect& src_rect); |
| 53 void OnMsgScroll(const HostResource& graphics_2d, | 53 void OnMsgScroll(const ppapi::HostResource& graphics_2d, |
| 54 bool clip_specified, | 54 bool clip_specified, |
| 55 const PP_Rect& clip, | 55 const PP_Rect& clip, |
| 56 const PP_Point& amount); | 56 const PP_Point& amount); |
| 57 void OnMsgReplaceContents(const HostResource& graphics_2d, | 57 void OnMsgReplaceContents(const ppapi::HostResource& graphics_2d, |
| 58 const HostResource& image_data); | 58 const ppapi::HostResource& image_data); |
| 59 void OnMsgFlush(const HostResource& graphics_2d); | 59 void OnMsgFlush(const ppapi::HostResource& graphics_2d); |
| 60 | 60 |
| 61 // Renderer->plugin message handlers. | 61 // Renderer->plugin message handlers. |
| 62 void OnMsgFlushACK(const HostResource& graphics_2d, | 62 void OnMsgFlushACK(const ppapi::HostResource& graphics_2d, |
| 63 int32_t pp_error); | 63 int32_t pp_error); |
| 64 | 64 |
| 65 // Called in the renderer to send the given flush ACK to the plugin. | 65 // Called in the renderer to send the given flush ACK to the plugin. |
| 66 void SendFlushACKToPlugin(int32_t result, | 66 void SendFlushACKToPlugin(int32_t result, |
| 67 const HostResource& graphics_2d); | 67 const ppapi::HostResource& graphics_2d); |
| 68 | 68 |
| 69 CompletionCallbackFactory<PPB_Graphics2D_Proxy, | 69 CompletionCallbackFactory<PPB_Graphics2D_Proxy, |
| 70 ProxyNonThreadSafeRefCount> callback_factory_; | 70 ProxyNonThreadSafeRefCount> callback_factory_; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 } // namespace proxy | 73 } // namespace proxy |
| 74 } // namespace pp | 74 } // namespace pp |
| 75 | 75 |
| 76 #endif // PPAPI_PPB_GRAPHICS_2D_PROXY_H_ | 76 #endif // PPAPI_PPB_GRAPHICS_2D_PROXY_H_ |
| OLD | NEW |