| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_ |
| 6 #define PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "ipc/ipc_channel.h" |
| 10 #include "ppapi/c/pp_bool.h" |
| 11 #include "ppapi/c/pp_instance.h" |
| 12 #include "ppapi/proxy/serialized_structs.h" |
| 13 #include "ppapi/shared_impl/function_group_base.h" |
| 14 #include "ppapi/thunk/resource_creation_api.h" |
| 15 |
| 16 struct PP_Size; |
| 17 |
| 18 namespace pp { |
| 19 namespace proxy { |
| 20 |
| 21 class HostResource; |
| 22 class Dispatcher; |
| 23 |
| 24 class ResourceCreationProxy : public ::ppapi::shared_impl::FunctionGroupBase, |
| 25 public ::ppapi::thunk::ResourceCreationAPI, |
| 26 public ::IPC::Channel::Listener, |
| 27 public IPC::Message::Sender { |
| 28 public: |
| 29 ResourceCreationProxy(Dispatcher* dispatcher); |
| 30 virtual ~ResourceCreationProxy(); |
| 31 |
| 32 virtual ::ppapi::thunk::ResourceCreationAPI* AsResourceCreation(); |
| 33 |
| 34 // ResourceCreationAPI (called in plugin). |
| 35 virtual PP_Resource CreateGraphics2D(PP_Instance pp_instance, |
| 36 const PP_Size& size, |
| 37 PP_Bool is_always_opaque); |
| 38 virtual PP_Resource CreateImageData(PP_Instance instance, |
| 39 PP_ImageDataFormat format, |
| 40 const PP_Size& size, |
| 41 PP_Bool init_to_zero); |
| 42 |
| 43 virtual bool Send(IPC::Message* msg); |
| 44 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 45 |
| 46 private: |
| 47 // IPC message handlers (called in browser). |
| 48 void OnMsgCreateGraphics2D(PP_Instance instance, |
| 49 const PP_Size& size, |
| 50 PP_Bool is_always_opaque, |
| 51 HostResource* result); |
| 52 void OnMsgCreateImageData(PP_Instance instance, |
| 53 int32_t format, |
| 54 const PP_Size& size, |
| 55 PP_Bool init_to_zero, |
| 56 HostResource* result, |
| 57 std::string* image_data_desc, |
| 58 ImageHandle* result_image_handle); |
| 59 |
| 60 Dispatcher* dispatcher_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(ResourceCreationProxy); |
| 63 }; |
| 64 |
| 65 } // namespace proxy |
| 66 } // namespace pp |
| 67 |
| 68 #endif // PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_ |
| OLD | NEW |