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.
5 #ifndef PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_
6 #define PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_
10 #include "base/basictypes.h"
11 #include "ipc/ipc_channel.h"
12 #include "ppapi/c/pp_bool.h"
13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/proxy/interface_proxy.h"
15 #include "ppapi/proxy/serialized_structs.h"
16 #include "ppapi/thunk/resource_creation_api.h"
29 class ResourceCreationProxy
: public InterfaceProxy
,
30 public thunk::ResourceCreationAPI
{
32 explicit ResourceCreationProxy(Dispatcher
* dispatcher
);
33 virtual ~ResourceCreationProxy();
35 // Factory function used for registration (normal code can just use the
37 static InterfaceProxy
* Create(Dispatcher
* dispatcher
);
39 // ResourceCreationAPI (called in plugin).
40 virtual PP_Resource
CreateFileIO(PP_Instance instance
) OVERRIDE
;
41 virtual PP_Resource
CreateFileRef(PP_Resource file_system
,
42 const char* path
) OVERRIDE
;
43 virtual PP_Resource
CreateFileSystem(PP_Instance instance
,
44 PP_FileSystemType type
) OVERRIDE
;
45 virtual PP_Resource
CreateIMEInputEvent(PP_Instance instance
,
46 PP_InputEvent_Type type
,
47 PP_TimeTicks time_stamp
,
49 uint32_t segment_number
,
50 const uint32_t* segment_offsets
,
51 int32_t target_segment
,
52 uint32_t selection_start
,
53 uint32_t selection_end
) OVERRIDE
;
54 virtual PP_Resource
CreateKeyboardInputEvent(
56 PP_InputEvent_Type type
,
57 PP_TimeTicks time_stamp
,
60 PP_Var character_text
) OVERRIDE
;
61 virtual PP_Resource
CreateMouseInputEvent(
63 PP_InputEvent_Type type
,
64 PP_TimeTicks time_stamp
,
66 PP_InputEvent_MouseButton mouse_button
,
67 const PP_Point
* mouse_position
,
69 const PP_Point
* mouse_movement
) OVERRIDE
;
70 virtual PP_Resource
CreateTouchInputEvent(
72 PP_InputEvent_Type type
,
73 PP_TimeTicks time_stamp
,
74 uint32_t modifiers
) OVERRIDE
;
75 virtual PP_Resource
CreateResourceArray(PP_Instance instance
,
76 const PP_Resource elements
[],
77 uint32_t size
) OVERRIDE
;
78 virtual PP_Resource
CreateURLLoader(PP_Instance instance
) OVERRIDE
;
79 virtual PP_Resource
CreateURLRequestInfo(
81 const URLRequestInfoData
& data
) OVERRIDE
;
82 virtual PP_Resource
CreateURLResponseInfo(
84 const URLResponseInfoData
& data
,
85 PP_Resource file_ref_resource
) OVERRIDE
;
86 virtual PP_Resource
CreateWheelInputEvent(
88 PP_TimeTicks time_stamp
,
90 const PP_FloatPoint
* wheel_delta
,
91 const PP_FloatPoint
* wheel_ticks
,
92 PP_Bool scroll_by_page
) OVERRIDE
;
94 virtual PP_Resource
CreateAudio(PP_Instance instance
,
95 PP_Resource config_id
,
96 PPB_Audio_Callback audio_callback
,
97 void* user_data
) OVERRIDE
;
98 virtual PP_Resource
CreateAudioTrusted(PP_Instance instance
) OVERRIDE
;
99 virtual PP_Resource
CreateAudioConfig(PP_Instance instance
,
100 PP_AudioSampleRate sample_rate
,
101 uint32_t sample_frame_count
) OVERRIDE
;
102 virtual PP_Resource
CreateFileChooser(PP_Instance instance
,
103 PP_FileChooserMode_Dev mode
,
104 const char* accept_types
) OVERRIDE
;
105 virtual PP_Resource
CreateGraphics2D(PP_Instance pp_instance
,
107 PP_Bool is_always_opaque
) OVERRIDE
;
108 virtual PP_Resource
CreateGraphics3D(PP_Instance instance
,
109 PP_Resource share_context
,
110 const int32_t* attrib_list
) OVERRIDE
;
111 virtual PP_Resource
CreateGraphics3DRaw(
112 PP_Instance instance
,
113 PP_Resource share_context
,
114 const int32_t* attrib_list
) OVERRIDE
;
115 virtual PP_Resource
CreateHostResolverPrivate(PP_Instance instance
) OVERRIDE
;
116 virtual PP_Resource
CreateImageData(PP_Instance instance
,
117 PP_ImageDataFormat format
,
119 PP_Bool init_to_zero
) OVERRIDE
;
120 virtual PP_Resource
CreateImageDataNaCl(PP_Instance instance
,
121 PP_ImageDataFormat format
,
123 PP_Bool init_to_zero
) OVERRIDE
;
124 virtual PP_Resource
CreateNetworkMonitor(
125 PP_Instance instance
,
126 PPB_NetworkMonitor_Callback callback
,
127 void* user_data
) OVERRIDE
;
128 virtual PP_Resource
CreatePrinting(PP_Instance
) OVERRIDE
;
129 virtual PP_Resource
CreateTCPServerSocketPrivate(
130 PP_Instance instance
) OVERRIDE
;
131 virtual PP_Resource
CreateTCPSocketPrivate(PP_Instance instance
) OVERRIDE
;
132 virtual PP_Resource
CreateUDPSocketPrivate(PP_Instance instance
) OVERRIDE
;
133 virtual PP_Resource
CreateWebSocket(PP_Instance instance
) OVERRIDE
;
134 virtual PP_Resource
CreateX509CertificatePrivate(
135 PP_Instance instance
) OVERRIDE
;
136 #if !defined(OS_NACL)
137 virtual PP_Resource
CreateAudioInput(PP_Instance instance
) OVERRIDE
;
138 virtual PP_Resource
CreateBroker(PP_Instance instance
) OVERRIDE
;
139 virtual PP_Resource
CreateBrowserFont(
140 PP_Instance instance
,
141 const PP_BrowserFont_Trusted_Description
* description
) OVERRIDE
;
142 virtual PP_Resource
CreateBuffer(PP_Instance instance
,
143 uint32_t size
) OVERRIDE
;
144 virtual PP_Resource
CreateDirectoryReader(PP_Resource directory_ref
) OVERRIDE
;
145 virtual PP_Resource
CreateFlashDeviceID(PP_Instance instance
) OVERRIDE
;
146 virtual PP_Resource
CreateFlashFontFile(
147 PP_Instance instance
,
148 const PP_BrowserFont_Trusted_Description
* description
,
149 PP_PrivateFontCharset charset
) OVERRIDE
;
150 virtual PP_Resource
CreateFlashMenu(PP_Instance instance
,
151 const PP_Flash_Menu
* menu_data
) OVERRIDE
;
152 virtual PP_Resource
CreateFlashMessageLoop(PP_Instance instance
) OVERRIDE
;
153 virtual PP_Resource
CreateScrollbar(PP_Instance instance
,
154 PP_Bool vertical
) OVERRIDE
;
155 virtual PP_Resource
CreateTalk(PP_Instance instance
) OVERRIDE
;
156 virtual PP_Resource
CreateVideoCapture(PP_Instance instance
) OVERRIDE
;
157 virtual PP_Resource
CreateVideoDecoder(
158 PP_Instance instance
,
159 PP_Resource context3d_id
,
160 PP_VideoDecoder_Profile profile
) OVERRIDE
;
161 #endif // !defined(OS_NACL)
163 virtual bool Send(IPC::Message
* msg
) OVERRIDE
;
164 virtual bool OnMessageReceived(const IPC::Message
& msg
) OVERRIDE
;
167 Connection
GetConnection();
168 DISALLOW_COPY_AND_ASSIGN(ResourceCreationProxy
);
174 #endif // PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_