blob: a36d40c518938aed5879453563b48182ecb04a1f [file] [log] [blame]
[email protected]0a424af2012-01-10 19:24:281// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]4c2e9352010-11-05 22:13:022// 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_PPB_INSTANCE_PROXY_H_
6#define PPAPI_PROXY_PPB_INSTANCE_PROXY_H_
7
[email protected]98ad9782012-08-22 04:06:228#include <string>
9
[email protected]4c2e9352010-11-05 22:13:0210#include "ppapi/c/pp_instance.h"
11#include "ppapi/c/pp_resource.h"
[email protected]3b98ced72012-03-09 02:08:3312#include "ppapi/c/pp_time.h"
[email protected]4c2e9352010-11-05 22:13:0213#include "ppapi/c/pp_var.h"
14#include "ppapi/proxy/interface_proxy.h"
[email protected]47a961c2012-07-13 19:18:5215#include "ppapi/proxy/proxy_completion_callback_factory.h"
[email protected]be0a84b2011-08-13 04:18:4416#include "ppapi/shared_impl/host_resource.h"
[email protected]9a578392011-12-07 18:59:2717#include "ppapi/shared_impl/ppb_instance_shared.h"
[email protected]ceadc392011-06-15 23:04:2418#include "ppapi/thunk/ppb_instance_api.h"
[email protected]ae5ff9ae2012-01-06 22:50:3319#include "ppapi/utility/completion_callback_factory.h"
[email protected]4c2e9352010-11-05 22:13:0220
[email protected]0f41c012011-10-21 19:49:2021// Windows headers interfere with this file.
22#ifdef PostMessage
23#undef PostMessage
24#endif
25
[email protected]98ad9782012-08-22 04:06:2226struct PP_DecryptedBlockInfo;
[email protected]181d9c12012-10-03 22:53:4827struct PP_DecryptedFrameInfo;
[email protected]98ad9782012-08-22 04:06:2228
[email protected]4d2efd22011-08-18 21:58:0229namespace ppapi {
[email protected]4c2e9352010-11-05 22:13:0230namespace proxy {
31
32class SerializedVarReceiveInput;
33class SerializedVarOutParam;
34class SerializedVarReturnValue;
35
[email protected]ceadc392011-06-15 23:04:2436class PPB_Instance_Proxy : public InterfaceProxy,
[email protected]a9b16dd2012-01-31 05:00:2637 public PPB_Instance_Shared {
[email protected]4c2e9352010-11-05 22:13:0238 public:
[email protected]5c966022011-09-13 18:09:3739 PPB_Instance_Proxy(Dispatcher* dispatcher);
[email protected]4c2e9352010-11-05 22:13:0240 virtual ~PPB_Instance_Proxy();
41
[email protected]ceadc392011-06-15 23:04:2442 static const Info* GetInfoPrivate();
[email protected]4c2e9352010-11-05 22:13:0243
44 // InterfaceProxy implementation.
[email protected]a95986a82010-12-24 06:19:2845 virtual bool OnMessageReceived(const IPC::Message& msg);
[email protected]4c2e9352010-11-05 22:13:0246
[email protected]4f2006122012-04-30 05:13:1747 // PPB_Instance_API implementation.
[email protected]ceadc392011-06-15 23:04:2448 virtual PP_Bool BindGraphics(PP_Instance instance,
49 PP_Resource device) OVERRIDE;
50 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
[email protected]e8f07ac2012-01-03 17:43:3651 virtual const ViewData* GetViewData(PP_Instance instance) OVERRIDE;
[email protected]ceadc392011-06-15 23:04:2452 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE;
53 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE;
54 virtual PP_Var ExecuteScript(PP_Instance instance,
55 PP_Var script,
56 PP_Var* exception) OVERRIDE;
[email protected]c59ed5892012-02-18 01:10:1957 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance)
58 OVERRIDE;
59 virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance)
60 OVERRIDE;
[email protected]8d770e492011-10-11 04:54:3161 virtual PP_Var GetDefaultCharSet(PP_Instance instance) OVERRIDE;
[email protected]59cf7022011-09-14 22:44:1962 virtual void NumberOfFindResultsChanged(PP_Instance instance,
63 int32_t total,
64 PP_Bool final_result) OVERRIDE;
65 virtual void SelectedFindResultChanged(PP_Instance instance,
66 int32_t index) OVERRIDE;
[email protected]7a26d92e2012-02-17 20:15:2567 virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE;
[email protected]06e0a342011-09-27 04:24:3068 virtual PP_Bool SetFullscreen(PP_Instance instance,
[email protected]3b98ced72012-03-09 02:08:3369 PP_Bool fullscreen) OVERRIDE;
[email protected]06e0a342011-09-27 04:24:3070 virtual PP_Bool GetScreenSize(PP_Instance instance,
[email protected]a085aed72012-04-24 05:32:0471 PP_Size* size) OVERRIDE;
72 virtual thunk::PPB_Flash_API* GetFlashAPI() OVERRIDE;
[email protected]11d0c362012-10-11 02:02:1173 virtual thunk::PPB_Flash_Functions_API* GetFlashFunctionsAPI(
74 PP_Instance instance) OVERRIDE;
[email protected]f5118812012-08-24 19:54:3075 virtual thunk::PPB_Gamepad_API* GetGamepadAPI(PP_Instance instance) OVERRIDE;
[email protected]493d14212011-07-07 15:38:4876 virtual int32_t RequestInputEvents(PP_Instance instance,
77 uint32_t event_classes) OVERRIDE;
78 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
79 uint32_t event_classes) OVERRIDE;
80 virtual void ClearInputEventRequest(PP_Instance instance,
81 uint32_t event_classes) OVERRIDE;
[email protected]3b98ced72012-03-09 02:08:3382 virtual void ClosePendingUserGesture(PP_Instance instance,
83 PP_TimeTicks timestamp) OVERRIDE;
[email protected]55a5a522011-07-06 22:52:4084 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE;
85 virtual void ZoomLimitsChanged(PP_Instance instance,
86 double minimum_factor,
87 double maximium_factor) OVERRIDE;
[email protected]c962f862012-04-12 00:02:0488 virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE;
89 virtual PP_Bool SetCursor(PP_Instance instance,
90 PP_MouseCursor_Type type,
91 PP_Resource image,
92 const PP_Point* hot_spot) OVERRIDE;
93 virtual int32_t LockMouse(PP_Instance instance,
[email protected]aed96532012-06-23 14:27:4294 scoped_refptr<TrackedCallback> callback) OVERRIDE;
[email protected]c962f862012-04-12 00:02:0495 virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
[email protected]4c44183a2012-04-27 16:52:2396 virtual void SetTextInputType(PP_Instance instance,
97 PP_TextInput_Type type) OVERRIDE;
98 virtual void UpdateCaretPosition(PP_Instance instance,
99 const PP_Rect& caret,
100 const PP_Rect& bounding_box) OVERRIDE;
101 virtual void CancelCompositionText(PP_Instance instance) OVERRIDE;
102 virtual void SelectionChanged(PP_Instance instance) OVERRIDE;
103 virtual void UpdateSurroundingText(PP_Instance instance,
104 const char* text,
105 uint32_t caret,
106 uint32_t anchor) OVERRIDE;
[email protected]32938de2012-10-19 18:42:32107 virtual PP_Var GetDocumentURL(PP_Instance instance,
108 PP_URLComponents_Dev* components) OVERRIDE;
[email protected]c962f862012-04-12 00:02:04109#if !defined(OS_NACL)
[email protected]03460232011-10-10 17:23:57110 virtual PP_Var ResolveRelativeToDocument(
111 PP_Instance instance,
112 PP_Var relative,
113 PP_URLComponents_Dev* components) OVERRIDE;
114 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE;
115 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance,
116 PP_Instance target) OVERRIDE;
[email protected]03460232011-10-10 17:23:57117 virtual PP_Var GetPluginInstanceURL(
118 PP_Instance instance,
119 PP_URLComponents_Dev* components) OVERRIDE;
[email protected]e5aeef02012-08-17 00:18:43120 virtual void NeedKey(PP_Instance instance,
121 PP_Var key_system,
122 PP_Var session_id,
123 PP_Var init_data) OVERRIDE;
124 virtual void KeyAdded(PP_Instance instance,
125 PP_Var key_system,
126 PP_Var session_id) OVERRIDE;
127 virtual void KeyMessage(PP_Instance instance,
128 PP_Var key_system,
129 PP_Var session_id,
130 PP_Resource message,
131 PP_Var default_url) OVERRIDE;
132 virtual void KeyError(PP_Instance instance,
133 PP_Var key_system,
134 PP_Var session_id,
135 int32_t media_error,
136 int32_t system_code) OVERRIDE;
137 virtual void DeliverBlock(PP_Instance instance,
138 PP_Resource decrypted_block,
[email protected]98ad9782012-08-22 04:06:22139 const PP_DecryptedBlockInfo* block_info) OVERRIDE;
[email protected]e9d3a1022012-10-11 23:43:55140 virtual void DecoderInitialized(PP_Instance instance,
141 PP_Bool success,
142 uint32_t request_id) OVERRIDE;
[email protected]23de87452012-10-12 07:03:09143 virtual void DecoderDeinitializeDone(PP_Instance instance,
144 PP_DecryptorStreamType decoder_type,
145 uint32_t request_id) OVERRIDE;
146 virtual void DecoderResetDone(PP_Instance instance,
147 PP_DecryptorStreamType decoder_type,
148 uint32_t request_id) OVERRIDE;
[email protected]e5aeef02012-08-17 00:18:43149 virtual void DeliverFrame(PP_Instance instance,
150 PP_Resource decrypted_frame,
[email protected]181d9c12012-10-03 22:53:48151 const PP_DecryptedFrameInfo* frame_info) OVERRIDE;
[email protected]e5aeef02012-08-17 00:18:43152 virtual void DeliverSamples(PP_Instance instance,
153 PP_Resource decrypted_samples,
[email protected]98ad9782012-08-22 04:06:22154 const PP_DecryptedBlockInfo* block_info) OVERRIDE;
[email protected]c962f862012-04-12 00:02:04155#endif // !defined(OS_NACL)
[email protected]ceadc392011-06-15 23:04:24156
[email protected]ac4b54d2011-10-20 23:09:28157 static const ApiID kApiID = API_ID_PPB_INSTANCE;
[email protected]5c966022011-09-13 18:09:37158
[email protected]4c2e9352010-11-05 22:13:02159 private:
[email protected]0f41c012011-10-21 19:49:20160 // Plugin -> Host message handlers.
[email protected]e8f07ac2012-01-03 17:43:36161 void OnHostMsgGetWindowObject(PP_Instance instance,
162 SerializedVarReturnValue result);
163 void OnHostMsgGetOwnerElementObject(PP_Instance instance,
[email protected]03460232011-10-10 17:23:57164 SerializedVarReturnValue result);
[email protected]e8f07ac2012-01-03 17:43:36165 void OnHostMsgBindGraphics(PP_Instance instance,
166 const ppapi::HostResource& device,
167 PP_Bool* result);
168 void OnHostMsgIsFullFrame(PP_Instance instance, PP_Bool* result);
169 void OnHostMsgExecuteScript(PP_Instance instance,
170 SerializedVarReceiveInput script,
171 SerializedVarOutParam out_exception,
172 SerializedVarReturnValue result);
[email protected]c59ed5892012-02-18 01:10:19173 void OnHostMsgGetAudioHardwareOutputSampleRate(PP_Instance instance,
174 uint32_t *result);
175 void OnHostMsgGetAudioHardwareOutputBufferSize(PP_Instance instance,
176 uint32_t *result);
[email protected]e8f07ac2012-01-03 17:43:36177 void OnHostMsgGetDefaultCharSet(PP_Instance instance,
178 SerializedVarReturnValue result);
[email protected]e8f07ac2012-01-03 17:43:36179 void OnHostMsgSetFullscreen(PP_Instance instance,
180 PP_Bool fullscreen,
181 PP_Bool* result);
182 void OnHostMsgGetScreenSize(PP_Instance instance,
183 PP_Bool* result,
184 PP_Size* size);
[email protected]e8f07ac2012-01-03 17:43:36185 void OnHostMsgRequestInputEvents(PP_Instance instance,
186 bool is_filtering,
187 uint32_t event_classes);
188 void OnHostMsgClearInputEvents(PP_Instance instance,
189 uint32_t event_classes);
[email protected]3b98ced72012-03-09 02:08:33190 void OnMsgHandleInputEventAck(PP_Instance instance,
191 PP_TimeTicks timestamp);
[email protected]e8f07ac2012-01-03 17:43:36192 void OnHostMsgPostMessage(PP_Instance instance,
193 SerializedVarReceiveInput message);
194 void OnHostMsgLockMouse(PP_Instance instance);
195 void OnHostMsgUnlockMouse(PP_Instance instance);
[email protected]c962f862012-04-12 00:02:04196 void OnHostMsgSetCursor(PP_Instance instance,
197 int32_t type,
198 const ppapi::HostResource& custom_image,
199 const PP_Point& hot_spot);
[email protected]4c44183a2012-04-27 16:52:23200 void OnHostMsgSetTextInputType(PP_Instance instance, PP_TextInput_Type type);
201 void OnHostMsgUpdateCaretPosition(PP_Instance instance,
202 const PP_Rect& caret,
203 const PP_Rect& bounding_box);
204 void OnHostMsgCancelCompositionText(PP_Instance instance);
205 void OnHostMsgUpdateSurroundingText(
206 PP_Instance instance,
207 const std::string& text,
208 uint32_t caret,
209 uint32_t anchor);
[email protected]32938de2012-10-19 18:42:32210 void OnHostMsgGetDocumentURL(PP_Instance instance,
211 PP_URLComponents_Dev* components,
212 SerializedVarReturnValue result);
[email protected]e5aeef02012-08-17 00:18:43213
[email protected]c962f862012-04-12 00:02:04214#if !defined(OS_NACL)
[email protected]e8f07ac2012-01-03 17:43:36215 void OnHostMsgResolveRelativeToDocument(PP_Instance instance,
216 SerializedVarReceiveInput relative,
217 SerializedVarReturnValue result);
218 void OnHostMsgDocumentCanRequest(PP_Instance instance,
219 SerializedVarReceiveInput url,
220 PP_Bool* result);
221 void OnHostMsgDocumentCanAccessDocument(PP_Instance active,
222 PP_Instance target,
223 PP_Bool* result);
[email protected]e8f07ac2012-01-03 17:43:36224 void OnHostMsgGetPluginInstanceURL(PP_Instance instance,
225 SerializedVarReturnValue result);
[email protected]e5aeef02012-08-17 00:18:43226 virtual void OnHostMsgNeedKey(PP_Instance instance,
227 SerializedVarReceiveInput key_system,
228 SerializedVarReceiveInput session_id,
229 SerializedVarReceiveInput init_data);
230 virtual void OnHostMsgKeyAdded(PP_Instance instance,
231 SerializedVarReceiveInput key_system,
232 SerializedVarReceiveInput session_id);
233 virtual void OnHostMsgKeyMessage(PP_Instance instance,
234 SerializedVarReceiveInput key_system,
235 SerializedVarReceiveInput session_id,
236 PP_Resource message,
237 SerializedVarReceiveInput default_url);
238 virtual void OnHostMsgKeyError(PP_Instance instance,
239 SerializedVarReceiveInput key_system,
240 SerializedVarReceiveInput session_id,
241 int32_t media_error,
242 int32_t system_code);
[email protected]e9d3a1022012-10-11 23:43:55243 virtual void OnHostMsgDecoderInitialized(PP_Instance instance,
244 PP_Bool success,
245 uint32_t request_id);
[email protected]23de87452012-10-12 07:03:09246 virtual void OnHostMsgDecoderDeinitializeDone(
247 PP_Instance instance,
248 PP_DecryptorStreamType decoder_type,
249 uint32_t request_id);
250 virtual void OnHostMsgDecoderResetDone(PP_Instance instance,
251 PP_DecryptorStreamType decoder_type,
252 uint32_t request_id);
[email protected]e5aeef02012-08-17 00:18:43253 virtual void OnHostMsgDeliverBlock(PP_Instance instance,
254 PP_Resource decrypted_block,
[email protected]98ad9782012-08-22 04:06:22255 const std::string& serialized_block_info);
[email protected]e5aeef02012-08-17 00:18:43256 virtual void OnHostMsgDeliverFrame(PP_Instance instance,
257 PP_Resource decrypted_frame,
[email protected]98ad9782012-08-22 04:06:22258 const std::string& serialized_block_info);
259 virtual void OnHostMsgDeliverSamples(
260 PP_Instance instance,
261 PP_Resource decrypted_samples,
262 const std::string& serialized_block_info);
[email protected]c962f862012-04-12 00:02:04263#endif // !defined(OS_NACL)
[email protected]0f41c012011-10-21 19:49:20264
265 // Host -> Plugin message handlers.
[email protected]e8f07ac2012-01-03 17:43:36266 void OnPluginMsgMouseLockComplete(PP_Instance instance, int32_t result);
[email protected]0f41c012011-10-21 19:49:20267
268 void MouseLockCompleteInHost(int32_t result, PP_Instance instance);
269
[email protected]a8e72142012-08-21 17:24:20270 // Other helpers.
271 void CancelAnyPendingRequestSurroundingText(PP_Instance instance);
272
[email protected]47a961c2012-07-13 19:18:52273 ProxyCompletionCallbackFactory<PPB_Instance_Proxy> callback_factory_;
[email protected]4c2e9352010-11-05 22:13:02274};
275
276} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:02277} // namespace ppapi
[email protected]4c2e9352010-11-05 22:13:02278
279#endif // PPAPI_PROXY_PPB_INSTANCE_PROXY_H_