OLD | NEW |
1 // Copyright (c) 2010 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" |
16 #include "ppapi/proxy/interface_proxy.h" | 17 #include "ppapi/proxy/interface_proxy.h" |
17 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" | 18 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
18 | 19 |
19 struct PPB_Graphics2D; | 20 struct PPB_Graphics2D; |
20 struct PP_Point; | 21 struct PP_Point; |
21 struct PP_Rect; | 22 struct PP_Rect; |
22 | 23 |
23 namespace pp { | 24 namespace pp { |
24 namespace proxy { | 25 namespace proxy { |
25 | 26 |
26 class PPB_Graphics2D_Proxy : public InterfaceProxy { | 27 class PPB_Graphics2D_Proxy : public InterfaceProxy { |
27 public: | 28 public: |
28 PPB_Graphics2D_Proxy(Dispatcher* dispatcher, const void* target_interface); | 29 PPB_Graphics2D_Proxy(Dispatcher* dispatcher, const void* target_interface); |
29 virtual ~PPB_Graphics2D_Proxy(); | 30 virtual ~PPB_Graphics2D_Proxy(); |
30 | 31 |
31 const PPB_Graphics2D* ppb_graphics_2d_target() const { | 32 const PPB_Graphics2D* ppb_graphics_2d_target() const { |
32 return static_cast<const PPB_Graphics2D*>(target_interface()); | 33 return static_cast<const PPB_Graphics2D*>(target_interface()); |
33 } | 34 } |
34 | 35 |
35 // InterfaceProxy implementation. | 36 // InterfaceProxy implementation. |
36 virtual const void* GetSourceInterface() const; | 37 virtual const void* GetSourceInterface() const; |
37 virtual InterfaceID GetInterfaceId() const; | 38 virtual InterfaceID GetInterfaceId() const; |
38 virtual bool OnMessageReceived(const IPC::Message& msg); | 39 virtual bool OnMessageReceived(const IPC::Message& msg); |
39 | 40 |
40 private: | 41 private: |
41 // Plugin->renderer message handlers. | 42 // Plugin->renderer message handlers. |
42 void OnMsgCreate(PP_Module module, | 43 void OnMsgCreate(PP_Module module, |
43 const PP_Size& size, | 44 const PP_Size& size, |
44 PP_Bool is_always_opaque, | 45 PP_Bool is_always_opaque, |
45 PP_Resource* result); | 46 HostResource* result); |
46 void OnMsgPaintImageData(PP_Resource graphics_2d, | 47 void OnMsgPaintImageData(const HostResource& graphics_2d, |
47 PP_Resource image_data, | 48 const HostResource& image_data, |
48 const PP_Point& top_left, | 49 const PP_Point& top_left, |
49 bool src_rect_specified, | 50 bool src_rect_specified, |
50 const PP_Rect& src_rect); | 51 const PP_Rect& src_rect); |
51 void OnMsgScroll(PP_Resource graphics_2d, | 52 void OnMsgScroll(const HostResource& graphics_2d, |
52 bool clip_specified, | 53 bool clip_specified, |
53 const PP_Rect& clip, | 54 const PP_Rect& clip, |
54 const PP_Point& amount); | 55 const PP_Point& amount); |
55 void OnMsgReplaceContents(PP_Resource graphics_2d, | 56 void OnMsgReplaceContents(const HostResource& graphics_2d, |
56 PP_Resource image_data); | 57 const HostResource& image_data); |
57 void OnMsgFlush(PP_Resource graphics_2d); | 58 void OnMsgFlush(const HostResource& graphics_2d); |
58 | 59 |
59 // Renderer->plugin message handlers. | 60 // Renderer->plugin message handlers. |
60 void OnMsgFlushACK(PP_Resource graphics_2d, int32_t pp_error); | 61 void OnMsgFlushACK(const HostResource& graphics_2d, |
| 62 int32_t pp_error); |
61 | 63 |
62 // Called in the renderer to send the given flush ACK to the plugin. | 64 // Called in the renderer to send the given flush ACK to the plugin. |
63 void SendFlushACKToPlugin(int32_t result, PP_Resource graphics_2d); | 65 void SendFlushACKToPlugin(int32_t result, |
| 66 const HostResource& graphics_2d); |
64 | 67 |
65 CompletionCallbackFactory<PPB_Graphics2D_Proxy, | 68 CompletionCallbackFactory<PPB_Graphics2D_Proxy, |
66 ProxyNonThreadSafeRefCount> callback_factory_; | 69 ProxyNonThreadSafeRefCount> callback_factory_; |
67 }; | 70 }; |
68 | 71 |
69 } // namespace proxy | 72 } // namespace proxy |
70 } // namespace pp | 73 } // namespace pp |
71 | 74 |
72 #endif // PPAPI_PPB_GRAPHICS_2D_PROXY_H_ | 75 #endif // PPAPI_PPB_GRAPHICS_2D_PROXY_H_ |
OLD | NEW |