| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 PPAPI_PPB_GRAPHICS_2D_PROXY_H_ | |
| 6 #define PPAPI_PPB_GRAPHICS_2D_PROXY_H_ | |
| 7 | |
| 8 #include "ppapi/c/pp_bool.h" | |
| 9 #include "ppapi/c/pp_completion_callback.h" | |
| 10 #include "ppapi/c/pp_module.h" | |
| 11 #include "ppapi/c/pp_module.h" | |
| 12 #include "ppapi/c/pp_resource.h" | |
| 13 #include "ppapi/c/pp_size.h" | |
| 14 #include "ppapi/c/pp_var.h" | |
| 15 #include "ppapi/proxy/interface_proxy.h" | |
| 16 #include "ppapi/proxy/proxy_completion_callback_factory.h" | |
| 17 #include "ppapi/shared_impl/host_resource.h" | |
| 18 #include "ppapi/utility/completion_callback_factory.h" | |
| 19 | |
| 20 struct PP_Point; | |
| 21 struct PP_Rect; | |
| 22 | |
| 23 namespace ppapi { | |
| 24 namespace proxy { | |
| 25 | |
| 26 class PPB_Graphics2D_Proxy : public InterfaceProxy { | |
| 27 public: | |
| 28 PPB_Graphics2D_Proxy(Dispatcher* dispatcher); | |
| 29 virtual ~PPB_Graphics2D_Proxy(); | |
| 30 | |
| 31 static PP_Resource CreateProxyResource(PP_Instance instance, | |
| 32 const PP_Size& size, | |
| 33 PP_Bool is_always_opaque); | |
| 34 | |
| 35 // InterfaceProxy implementation. | |
| 36 virtual bool OnMessageReceived(const IPC::Message& msg); | |
| 37 | |
| 38 static const ApiID kApiID = API_ID_PPB_GRAPHICS_2D; | |
| 39 | |
| 40 private: | |
| 41 // Plugin->host message handlers. | |
| 42 void OnHostMsgCreate(PP_Instance instance, | |
| 43 const PP_Size& size, | |
| 44 PP_Bool is_always_opaque, | |
| 45 HostResource* result); | |
| 46 void OnHostMsgPaintImageData(const HostResource& graphics_2d, | |
| 47 const HostResource& image_data, | |
| 48 const PP_Point& top_left, | |
| 49 bool src_rect_specified, | |
| 50 const PP_Rect& src_rect); | |
| 51 void OnHostMsgScroll(const HostResource& graphics_2d, | |
| 52 bool clip_specified, | |
| 53 const PP_Rect& clip, | |
| 54 const PP_Point& amount); | |
| 55 void OnHostMsgReplaceContents(const HostResource& graphics_2d, | |
| 56 const HostResource& image_data); | |
| 57 void OnHostMsgFlush(const HostResource& graphics_2d); | |
| 58 void OnHostMsgSetScale(const HostResource& graphics_2d, | |
| 59 float scale); | |
| 60 | |
| 61 // Host->plugin message handlers. | |
| 62 void OnPluginMsgFlushACK(const HostResource& graphics_2d, | |
| 63 int32_t pp_error); | |
| 64 | |
| 65 // Called in the renderer to send the given flush ACK to the plugin. | |
| 66 void SendFlushACKToPlugin(int32_t result, | |
| 67 const HostResource& graphics_2d); | |
| 68 | |
| 69 ProxyCompletionCallbackFactory<PPB_Graphics2D_Proxy> callback_factory_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Proxy); | |
| 72 }; | |
| 73 | |
| 74 } // namespace proxy | |
| 75 } // namespace ppapi | |
| 76 | |
| 77 #endif // PPAPI_PPB_GRAPHICS_2D_PROXY_H_ | |
| OLD | NEW |