Refactor android test results logging.
[chromium-blink-merge.git] / ppapi / proxy / ppb_instance_proxy.h
blobaf52ed924123e85880f90a8b5fd60c5358fa3f82
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_PPB_INSTANCE_PROXY_H_
6 #define PPAPI_PROXY_PPB_INSTANCE_PROXY_H_
8 #include <string>
10 #include "ppapi/c/pp_instance.h"
11 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_time.h"
13 #include "ppapi/c/pp_var.h"
14 #include "ppapi/proxy/interface_proxy.h"
15 #include "ppapi/proxy/proxy_completion_callback_factory.h"
16 #include "ppapi/shared_impl/host_resource.h"
17 #include "ppapi/shared_impl/ppb_instance_shared.h"
18 #include "ppapi/shared_impl/singleton_resource_id.h"
19 #include "ppapi/thunk/ppb_instance_api.h"
20 #include "ppapi/utility/completion_callback_factory.h"
22 // Windows headers interfere with this file.
23 #ifdef PostMessage
24 #undef PostMessage
25 #endif
27 struct PP_DecryptedBlockInfo;
28 struct PP_DecryptedFrameInfo;
30 namespace ppapi {
31 namespace proxy {
33 class SerializedVarReceiveInput;
34 class SerializedVarOutParam;
35 class SerializedVarReturnValue;
37 class PPB_Instance_Proxy : public InterfaceProxy,
38 public PPB_Instance_Shared {
39 public:
40 PPB_Instance_Proxy(Dispatcher* dispatcher);
41 virtual ~PPB_Instance_Proxy();
43 static const Info* GetInfoPrivate();
45 // InterfaceProxy implementation.
46 virtual bool OnMessageReceived(const IPC::Message& msg);
48 // PPB_Instance_API implementation.
49 virtual PP_Bool BindGraphics(PP_Instance instance,
50 PP_Resource device) OVERRIDE;
51 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
52 virtual const ViewData* GetViewData(PP_Instance instance) OVERRIDE;
53 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE;
54 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE;
55 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE;
56 virtual PP_Var ExecuteScript(PP_Instance instance,
57 PP_Var script,
58 PP_Var* exception) OVERRIDE;
59 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance)
60 OVERRIDE;
61 virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance)
62 OVERRIDE;
63 virtual PP_Var GetDefaultCharSet(PP_Instance instance) OVERRIDE;
64 virtual void NumberOfFindResultsChanged(PP_Instance instance,
65 int32_t total,
66 PP_Bool final_result) OVERRIDE;
67 virtual void SelectedFindResultChanged(PP_Instance instance,
68 int32_t index) OVERRIDE;
69 virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE;
70 virtual PP_Bool SetFullscreen(PP_Instance instance,
71 PP_Bool fullscreen) OVERRIDE;
72 virtual PP_Bool GetScreenSize(PP_Instance instance,
73 PP_Size* size) OVERRIDE;
74 virtual thunk::PPB_Flash_API* GetFlashAPI() OVERRIDE;
75 virtual Resource* GetSingletonResource(PP_Instance instance,
76 SingletonResourceID id) OVERRIDE;
77 virtual int32_t RequestInputEvents(PP_Instance instance,
78 uint32_t event_classes) OVERRIDE;
79 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
80 uint32_t event_classes) OVERRIDE;
81 virtual void ClearInputEventRequest(PP_Instance instance,
82 uint32_t event_classes) OVERRIDE;
83 virtual void ClosePendingUserGesture(PP_Instance instance,
84 PP_TimeTicks timestamp) OVERRIDE;
85 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE;
86 virtual void ZoomLimitsChanged(PP_Instance instance,
87 double minimum_factor,
88 double maximium_factor) OVERRIDE;
89 virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE;
90 virtual PP_Bool SetCursor(PP_Instance instance,
91 PP_MouseCursor_Type type,
92 PP_Resource image,
93 const PP_Point* hot_spot) OVERRIDE;
94 virtual int32_t LockMouse(PP_Instance instance,
95 scoped_refptr<TrackedCallback> callback) OVERRIDE;
96 virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
97 virtual void SetTextInputType(PP_Instance instance,
98 PP_TextInput_Type type) OVERRIDE;
99 virtual void UpdateCaretPosition(PP_Instance instance,
100 const PP_Rect& caret,
101 const PP_Rect& bounding_box) OVERRIDE;
102 virtual void CancelCompositionText(PP_Instance instance) OVERRIDE;
103 virtual void SelectionChanged(PP_Instance instance) OVERRIDE;
104 virtual void UpdateSurroundingText(PP_Instance instance,
105 const char* text,
106 uint32_t caret,
107 uint32_t anchor) OVERRIDE;
108 virtual PP_Var GetDocumentURL(PP_Instance instance,
109 PP_URLComponents_Dev* components) OVERRIDE;
110 #if !defined(OS_NACL)
111 virtual PP_Var ResolveRelativeToDocument(
112 PP_Instance instance,
113 PP_Var relative,
114 PP_URLComponents_Dev* components) OVERRIDE;
115 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE;
116 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance,
117 PP_Instance target) OVERRIDE;
118 virtual PP_Var GetPluginInstanceURL(
119 PP_Instance instance,
120 PP_URLComponents_Dev* components) OVERRIDE;
121 virtual void NeedKey(PP_Instance instance,
122 PP_Var key_system,
123 PP_Var session_id,
124 PP_Var init_data) OVERRIDE;
125 virtual void KeyAdded(PP_Instance instance,
126 PP_Var key_system,
127 PP_Var session_id) OVERRIDE;
128 virtual void KeyMessage(PP_Instance instance,
129 PP_Var key_system,
130 PP_Var session_id,
131 PP_Var message,
132 PP_Var default_url) OVERRIDE;
133 virtual void KeyError(PP_Instance instance,
134 PP_Var key_system,
135 PP_Var session_id,
136 int32_t media_error,
137 int32_t system_code) OVERRIDE;
138 virtual void DeliverBlock(PP_Instance instance,
139 PP_Resource decrypted_block,
140 const PP_DecryptedBlockInfo* block_info) OVERRIDE;
141 virtual void DecoderInitializeDone(PP_Instance instance,
142 PP_DecryptorStreamType decoder_type,
143 uint32_t request_id,
144 PP_Bool success) OVERRIDE;
145 virtual void DecoderDeinitializeDone(PP_Instance instance,
146 PP_DecryptorStreamType decoder_type,
147 uint32_t request_id) OVERRIDE;
148 virtual void DecoderResetDone(PP_Instance instance,
149 PP_DecryptorStreamType decoder_type,
150 uint32_t request_id) OVERRIDE;
151 virtual void DeliverFrame(PP_Instance instance,
152 PP_Resource decrypted_frame,
153 const PP_DecryptedFrameInfo* frame_info) OVERRIDE;
154 virtual void DeliverSamples(PP_Instance instance,
155 PP_Resource audio_frames,
156 const PP_DecryptedBlockInfo* block_info) OVERRIDE;
157 #endif // !defined(OS_NACL)
159 static const ApiID kApiID = API_ID_PPB_INSTANCE;
161 private:
162 // Plugin -> Host message handlers.
163 void OnHostMsgGetWindowObject(PP_Instance instance,
164 SerializedVarReturnValue result);
165 void OnHostMsgGetOwnerElementObject(PP_Instance instance,
166 SerializedVarReturnValue result);
167 void OnHostMsgBindGraphics(PP_Instance instance,
168 PP_Resource device);
169 void OnHostMsgIsFullFrame(PP_Instance instance, PP_Bool* result);
170 void OnHostMsgExecuteScript(PP_Instance instance,
171 SerializedVarReceiveInput script,
172 SerializedVarOutParam out_exception,
173 SerializedVarReturnValue result);
174 void OnHostMsgGetAudioHardwareOutputSampleRate(PP_Instance instance,
175 uint32_t *result);
176 void OnHostMsgGetAudioHardwareOutputBufferSize(PP_Instance instance,
177 uint32_t *result);
178 void OnHostMsgGetDefaultCharSet(PP_Instance instance,
179 SerializedVarReturnValue result);
180 void OnHostMsgSetFullscreen(PP_Instance instance,
181 PP_Bool fullscreen,
182 PP_Bool* result);
183 void OnHostMsgGetScreenSize(PP_Instance instance,
184 PP_Bool* result,
185 PP_Size* size);
186 void OnHostMsgRequestInputEvents(PP_Instance instance,
187 bool is_filtering,
188 uint32_t event_classes);
189 void OnHostMsgClearInputEvents(PP_Instance instance,
190 uint32_t event_classes);
191 void OnMsgHandleInputEventAck(PP_Instance instance,
192 PP_TimeTicks timestamp);
193 void OnHostMsgPostMessage(PP_Instance instance,
194 SerializedVarReceiveInput message);
195 void OnHostMsgLockMouse(PP_Instance instance);
196 void OnHostMsgUnlockMouse(PP_Instance instance);
197 void OnHostMsgSetCursor(PP_Instance instance,
198 int32_t type,
199 const ppapi::HostResource& custom_image,
200 const PP_Point& hot_spot);
201 void OnHostMsgSetTextInputType(PP_Instance instance, PP_TextInput_Type type);
202 void OnHostMsgUpdateCaretPosition(PP_Instance instance,
203 const PP_Rect& caret,
204 const PP_Rect& bounding_box);
205 void OnHostMsgCancelCompositionText(PP_Instance instance);
206 void OnHostMsgUpdateSurroundingText(
207 PP_Instance instance,
208 const std::string& text,
209 uint32_t caret,
210 uint32_t anchor);
211 void OnHostMsgGetDocumentURL(PP_Instance instance,
212 PP_URLComponents_Dev* components,
213 SerializedVarReturnValue result);
215 #if !defined(OS_NACL)
216 void OnHostMsgResolveRelativeToDocument(PP_Instance instance,
217 SerializedVarReceiveInput relative,
218 SerializedVarReturnValue result);
219 void OnHostMsgDocumentCanRequest(PP_Instance instance,
220 SerializedVarReceiveInput url,
221 PP_Bool* result);
222 void OnHostMsgDocumentCanAccessDocument(PP_Instance active,
223 PP_Instance target,
224 PP_Bool* result);
225 void OnHostMsgGetPluginInstanceURL(PP_Instance instance,
226 SerializedVarReturnValue result);
227 virtual void OnHostMsgNeedKey(PP_Instance instance,
228 SerializedVarReceiveInput key_system,
229 SerializedVarReceiveInput session_id,
230 SerializedVarReceiveInput init_data);
231 virtual void OnHostMsgKeyAdded(PP_Instance instance,
232 SerializedVarReceiveInput key_system,
233 SerializedVarReceiveInput session_id);
234 virtual void OnHostMsgKeyMessage(PP_Instance instance,
235 SerializedVarReceiveInput key_system,
236 SerializedVarReceiveInput session_id,
237 SerializedVarReceiveInput message,
238 SerializedVarReceiveInput default_url);
239 virtual void OnHostMsgKeyError(PP_Instance instance,
240 SerializedVarReceiveInput key_system,
241 SerializedVarReceiveInput session_id,
242 int32_t media_error,
243 int32_t system_code);
244 virtual void OnHostMsgDecoderInitializeDone(
245 PP_Instance instance,
246 PP_DecryptorStreamType decoder_type,
247 uint32_t request_id,
248 PP_Bool success);
249 virtual void OnHostMsgDecoderDeinitializeDone(
250 PP_Instance instance,
251 PP_DecryptorStreamType decoder_type,
252 uint32_t request_id);
253 virtual void OnHostMsgDecoderResetDone(PP_Instance instance,
254 PP_DecryptorStreamType decoder_type,
255 uint32_t request_id);
256 virtual void OnHostMsgDeliverBlock(PP_Instance instance,
257 PP_Resource decrypted_block,
258 const std::string& serialized_block_info);
259 virtual void OnHostMsgDeliverFrame(PP_Instance instance,
260 PP_Resource decrypted_frame,
261 const std::string& serialized_block_info);
262 virtual void OnHostMsgDeliverSamples(
263 PP_Instance instance,
264 PP_Resource audio_frames,
265 const std::string& serialized_block_info);
266 #endif // !defined(OS_NACL)
268 // Host -> Plugin message handlers.
269 void OnPluginMsgMouseLockComplete(PP_Instance instance, int32_t result);
271 void MouseLockCompleteInHost(int32_t result, PP_Instance instance);
273 // Other helpers.
274 void CancelAnyPendingRequestSurroundingText(PP_Instance instance);
276 ProxyCompletionCallbackFactory<PPB_Instance_Proxy> callback_factory_;
279 } // namespace proxy
280 } // namespace ppapi
282 #endif // PPAPI_PROXY_PPB_INSTANCE_PROXY_H_