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_PROXY_RESOURCE_CREATION_PROXY_H_ | 5 #ifndef PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_ |
6 #define PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_ | 6 #define PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
12 #include "ppapi/c/pp_bool.h" | 12 #include "ppapi/c/pp_bool.h" |
13 #include "ppapi/c/pp_instance.h" | 13 #include "ppapi/c/pp_instance.h" |
14 #include "ppapi/proxy/serialized_structs.h" | 14 #include "ppapi/proxy/serialized_structs.h" |
15 #include "ppapi/shared_impl/function_group_base.h" | 15 #include "ppapi/shared_impl/function_group_base.h" |
16 #include "ppapi/thunk/resource_creation_api.h" | 16 #include "ppapi/thunk/resource_creation_api.h" |
17 | 17 |
18 struct PP_Size; | 18 struct PP_Size; |
19 | 19 |
20 namespace ppapi { | 20 namespace ppapi { |
| 21 |
21 class HostResource; | 22 class HostResource; |
22 } | |
23 | 23 |
24 namespace pp { | |
25 namespace proxy { | 24 namespace proxy { |
26 | 25 |
27 class Dispatcher; | 26 class Dispatcher; |
28 | 27 |
29 class ResourceCreationProxy : public ::ppapi::FunctionGroupBase, | 28 class ResourceCreationProxy : public FunctionGroupBase, |
30 public ::ppapi::thunk::ResourceCreationAPI, | 29 public thunk::ResourceCreationAPI, |
31 public ::IPC::Channel::Listener, | 30 public IPC::Channel::Listener, |
32 public IPC::Message::Sender { | 31 public IPC::Message::Sender { |
33 public: | 32 public: |
34 explicit ResourceCreationProxy(Dispatcher* dispatcher); | 33 explicit ResourceCreationProxy(Dispatcher* dispatcher); |
35 virtual ~ResourceCreationProxy(); | 34 virtual ~ResourceCreationProxy(); |
36 | 35 |
37 virtual ::ppapi::thunk::ResourceCreationAPI* AsResourceCreationAPI() OVERRIDE; | 36 virtual thunk::ResourceCreationAPI* AsResourceCreationAPI() OVERRIDE; |
38 | 37 |
39 // ResourceCreationAPI (called in plugin). | 38 // ResourceCreationAPI (called in plugin). |
40 virtual PP_Resource CreateAudio(PP_Instance instance, | 39 virtual PP_Resource CreateAudio(PP_Instance instance, |
41 PP_Resource config_id, | 40 PP_Resource config_id, |
42 PPB_Audio_Callback audio_callback, | 41 PPB_Audio_Callback audio_callback, |
43 void* user_data) OVERRIDE; | 42 void* user_data) OVERRIDE; |
44 virtual PP_Resource CreateAudioConfig(PP_Instance instance, | 43 virtual PP_Resource CreateAudioConfig(PP_Instance instance, |
45 PP_AudioSampleRate sample_rate, | 44 PP_AudioSampleRate sample_rate, |
46 uint32_t sample_frame_count) OVERRIDE; | 45 uint32_t sample_frame_count) OVERRIDE; |
47 virtual PP_Resource CreateAudioTrusted(PP_Instance instance) OVERRIDE; | 46 virtual PP_Resource CreateAudioTrusted(PP_Instance instance) OVERRIDE; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 PP_Bool scroll_by_page) OVERRIDE; | 127 PP_Bool scroll_by_page) OVERRIDE; |
129 | 128 |
130 virtual bool Send(IPC::Message* msg) OVERRIDE; | 129 virtual bool Send(IPC::Message* msg) OVERRIDE; |
131 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 130 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
132 | 131 |
133 private: | 132 private: |
134 // IPC message handlers (called in browser). | 133 // IPC message handlers (called in browser). |
135 void OnMsgCreateAudio(PP_Instance instance, | 134 void OnMsgCreateAudio(PP_Instance instance, |
136 int32_t sample_rate, | 135 int32_t sample_rate, |
137 uint32_t sample_frame_count, | 136 uint32_t sample_frame_count, |
138 ppapi::HostResource* result); | 137 HostResource* result); |
139 void OnMsgCreateGraphics2D(PP_Instance instance, | 138 void OnMsgCreateGraphics2D(PP_Instance instance, |
140 const PP_Size& size, | 139 const PP_Size& size, |
141 PP_Bool is_always_opaque, | 140 PP_Bool is_always_opaque, |
142 ppapi::HostResource* result); | 141 HostResource* result); |
143 void OnMsgCreateImageData(PP_Instance instance, | 142 void OnMsgCreateImageData(PP_Instance instance, |
144 int32_t format, | 143 int32_t format, |
145 const PP_Size& size, | 144 const PP_Size& size, |
146 PP_Bool init_to_zero, | 145 PP_Bool init_to_zero, |
147 ppapi::HostResource* result, | 146 HostResource* result, |
148 std::string* image_data_desc, | 147 std::string* image_data_desc, |
149 ImageHandle* result_image_handle); | 148 ImageHandle* result_image_handle); |
150 | 149 |
151 Dispatcher* dispatcher_; | 150 Dispatcher* dispatcher_; |
152 | 151 |
153 DISALLOW_COPY_AND_ASSIGN(ResourceCreationProxy); | 152 DISALLOW_COPY_AND_ASSIGN(ResourceCreationProxy); |
154 }; | 153 }; |
155 | 154 |
156 } // namespace proxy | 155 } // namespace proxy |
157 } // namespace pp | 156 } // namespace ppapi |
158 | 157 |
159 #endif // PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_ | 158 #endif // PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_ |
OLD | NEW |