blob: 6dff87c7778c4ff9ff0cb6d84b7df0a4515a85cb [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]4c2e9352010-11-05 22:13:0212#include "ppapi/c/pp_var.h"
13#include "ppapi/proxy/interface_proxy.h"
[email protected]47a961c2012-07-13 19:18:5214#include "ppapi/proxy/proxy_completion_callback_factory.h"
[email protected]be0a84b2011-08-13 04:18:4415#include "ppapi/shared_impl/host_resource.h"
[email protected]9a578392011-12-07 18:59:2716#include "ppapi/shared_impl/ppb_instance_shared.h"
[email protected]109dcfb2012-11-29 17:59:1917#include "ppapi/shared_impl/singleton_resource_id.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]22fdaa62012-11-30 01:55:4452 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE;
[email protected]ceadc392011-06-15 23:04:2453 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE;
54 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE;
55 virtual PP_Var ExecuteScript(PP_Instance instance,
56 PP_Var script,
57 PP_Var* exception) OVERRIDE;
[email protected]c59ed5892012-02-18 01:10:1958 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance)
59 OVERRIDE;
60 virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance)
61 OVERRIDE;
[email protected]8d770e492011-10-11 04:54:3162 virtual PP_Var GetDefaultCharSet(PP_Instance instance) OVERRIDE;
[email protected]59cf7022011-09-14 22:44:1963 virtual void NumberOfFindResultsChanged(PP_Instance instance,
64 int32_t total,
65 PP_Bool final_result) OVERRIDE;
66 virtual void SelectedFindResultChanged(PP_Instance instance,
67 int32_t index) OVERRIDE;
[email protected]1a77d232013-05-02 01:35:0668 virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE;
[email protected]06e0a342011-09-27 04:24:3069 virtual PP_Bool SetFullscreen(PP_Instance instance,
[email protected]3b98ced72012-03-09 02:08:3370 PP_Bool fullscreen) OVERRIDE;
[email protected]06e0a342011-09-27 04:24:3071 virtual PP_Bool GetScreenSize(PP_Instance instance,
[email protected]a085aed72012-04-24 05:32:0472 PP_Size* size) OVERRIDE;
[email protected]109dcfb2012-11-29 17:59:1973 virtual Resource* GetSingletonResource(PP_Instance instance,
74 SingletonResourceID id) OVERRIDE;
[email protected]493d14212011-07-07 15:38:4875 virtual int32_t RequestInputEvents(PP_Instance instance,
76 uint32_t event_classes) OVERRIDE;
77 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
78 uint32_t event_classes) OVERRIDE;
79 virtual void ClearInputEventRequest(PP_Instance instance,
80 uint32_t event_classes) OVERRIDE;
[email protected]55a5a522011-07-06 22:52:4081 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE;
82 virtual void ZoomLimitsChanged(PP_Instance instance,
83 double minimum_factor,
84 double maximium_factor) OVERRIDE;
[email protected]c962f862012-04-12 00:02:0485 virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE;
86 virtual PP_Bool SetCursor(PP_Instance instance,
87 PP_MouseCursor_Type type,
88 PP_Resource image,
89 const PP_Point* hot_spot) OVERRIDE;
90 virtual int32_t LockMouse(PP_Instance instance,
[email protected]aed96532012-06-23 14:27:4291 scoped_refptr<TrackedCallback> callback) OVERRIDE;
[email protected]c962f862012-04-12 00:02:0492 virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
[email protected]4c44183a2012-04-27 16:52:2393 virtual void SetTextInputType(PP_Instance instance,
94 PP_TextInput_Type type) OVERRIDE;
95 virtual void UpdateCaretPosition(PP_Instance instance,
96 const PP_Rect& caret,
97 const PP_Rect& bounding_box) OVERRIDE;
98 virtual void CancelCompositionText(PP_Instance instance) OVERRIDE;
99 virtual void SelectionChanged(PP_Instance instance) OVERRIDE;
100 virtual void UpdateSurroundingText(PP_Instance instance,
101 const char* text,
102 uint32_t caret,
103 uint32_t anchor) OVERRIDE;
[email protected]32938de2012-10-19 18:42:32104 virtual PP_Var GetDocumentURL(PP_Instance instance,
105 PP_URLComponents_Dev* components) OVERRIDE;
[email protected]c962f862012-04-12 00:02:04106#if !defined(OS_NACL)
[email protected]03460232011-10-10 17:23:57107 virtual PP_Var ResolveRelativeToDocument(
108 PP_Instance instance,
109 PP_Var relative,
110 PP_URLComponents_Dev* components) OVERRIDE;
111 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE;
112 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance,
113 PP_Instance target) OVERRIDE;
[email protected]03460232011-10-10 17:23:57114 virtual PP_Var GetPluginInstanceURL(
115 PP_Instance instance,
116 PP_URLComponents_Dev* components) OVERRIDE;
[email protected]f5a14022013-09-07 15:47:40117 virtual PP_Var GetPluginReferrerURL(
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,
[email protected]a6e4fbf2012-12-12 05:25:00130 PP_Var message,
[email protected]e5aeef02012-08-17 00:18:43131 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]c999b3b72012-10-19 22:33:46140 virtual void DecoderInitializeDone(PP_Instance instance,
141 PP_DecryptorStreamType decoder_type,
142 uint32_t request_id,
143 PP_Bool success) OVERRIDE;
[email protected]23de87452012-10-12 07:03:09144 virtual void DecoderDeinitializeDone(PP_Instance instance,
145 PP_DecryptorStreamType decoder_type,
146 uint32_t request_id) OVERRIDE;
147 virtual void DecoderResetDone(PP_Instance instance,
148 PP_DecryptorStreamType decoder_type,
149 uint32_t request_id) OVERRIDE;
[email protected]e5aeef02012-08-17 00:18:43150 virtual void DeliverFrame(PP_Instance instance,
151 PP_Resource decrypted_frame,
[email protected]181d9c12012-10-03 22:53:48152 const PP_DecryptedFrameInfo* frame_info) OVERRIDE;
[email protected]e5aeef02012-08-17 00:18:43153 virtual void DeliverSamples(PP_Instance instance,
[email protected]c999b3b72012-10-19 22:33:46154 PP_Resource audio_frames,
[email protected]98ad9782012-08-22 04:06:22155 const PP_DecryptedBlockInfo* block_info) OVERRIDE;
[email protected]c962f862012-04-12 00:02:04156#endif // !defined(OS_NACL)
[email protected]ceadc392011-06-15 23:04:24157
[email protected]ac4b54d2011-10-20 23:09:28158 static const ApiID kApiID = API_ID_PPB_INSTANCE;
[email protected]5c966022011-09-13 18:09:37159
[email protected]4c2e9352010-11-05 22:13:02160 private:
[email protected]0f41c012011-10-21 19:49:20161 // Plugin -> Host message handlers.
[email protected]e8f07ac2012-01-03 17:43:36162 void OnHostMsgGetWindowObject(PP_Instance instance,
163 SerializedVarReturnValue result);
164 void OnHostMsgGetOwnerElementObject(PP_Instance instance,
[email protected]03460232011-10-10 17:23:57165 SerializedVarReturnValue result);
[email protected]e8f07ac2012-01-03 17:43:36166 void OnHostMsgBindGraphics(PP_Instance instance,
[email protected]473ef7d2012-12-03 23:39:05167 PP_Resource device);
[email protected]e8f07ac2012-01-03 17:43:36168 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]e8f07ac2012-01-03 17:43:36190 void OnHostMsgPostMessage(PP_Instance instance,
191 SerializedVarReceiveInput message);
192 void OnHostMsgLockMouse(PP_Instance instance);
193 void OnHostMsgUnlockMouse(PP_Instance instance);
[email protected]c962f862012-04-12 00:02:04194 void OnHostMsgSetCursor(PP_Instance instance,
195 int32_t type,
196 const ppapi::HostResource& custom_image,
197 const PP_Point& hot_spot);
[email protected]4c44183a2012-04-27 16:52:23198 void OnHostMsgSetTextInputType(PP_Instance instance, PP_TextInput_Type type);
199 void OnHostMsgUpdateCaretPosition(PP_Instance instance,
200 const PP_Rect& caret,
201 const PP_Rect& bounding_box);
202 void OnHostMsgCancelCompositionText(PP_Instance instance);
203 void OnHostMsgUpdateSurroundingText(
204 PP_Instance instance,
205 const std::string& text,
206 uint32_t caret,
207 uint32_t anchor);
[email protected]32938de2012-10-19 18:42:32208 void OnHostMsgGetDocumentURL(PP_Instance instance,
209 PP_URLComponents_Dev* components,
210 SerializedVarReturnValue result);
[email protected]e5aeef02012-08-17 00:18:43211
[email protected]c962f862012-04-12 00:02:04212#if !defined(OS_NACL)
[email protected]e8f07ac2012-01-03 17:43:36213 void OnHostMsgResolveRelativeToDocument(PP_Instance instance,
214 SerializedVarReceiveInput relative,
215 SerializedVarReturnValue result);
216 void OnHostMsgDocumentCanRequest(PP_Instance instance,
217 SerializedVarReceiveInput url,
218 PP_Bool* result);
219 void OnHostMsgDocumentCanAccessDocument(PP_Instance active,
220 PP_Instance target,
221 PP_Bool* result);
[email protected]e8f07ac2012-01-03 17:43:36222 void OnHostMsgGetPluginInstanceURL(PP_Instance instance,
223 SerializedVarReturnValue result);
[email protected]f5a14022013-09-07 15:47:40224 void OnHostMsgGetPluginReferrerURL(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,
[email protected]a6e4fbf2012-12-12 05:25:00236 SerializedVarReceiveInput message,
[email protected]e5aeef02012-08-17 00:18:43237 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]c999b3b72012-10-19 22:33:46243 virtual void OnHostMsgDecoderInitializeDone(
244 PP_Instance instance,
245 PP_DecryptorStreamType decoder_type,
246 uint32_t request_id,
247 PP_Bool success);
[email protected]23de87452012-10-12 07:03:09248 virtual void OnHostMsgDecoderDeinitializeDone(
249 PP_Instance instance,
250 PP_DecryptorStreamType decoder_type,
251 uint32_t request_id);
252 virtual void OnHostMsgDecoderResetDone(PP_Instance instance,
253 PP_DecryptorStreamType decoder_type,
254 uint32_t request_id);
[email protected]e5aeef02012-08-17 00:18:43255 virtual void OnHostMsgDeliverBlock(PP_Instance instance,
256 PP_Resource decrypted_block,
[email protected]98ad9782012-08-22 04:06:22257 const std::string& serialized_block_info);
[email protected]e5aeef02012-08-17 00:18:43258 virtual void OnHostMsgDeliverFrame(PP_Instance instance,
259 PP_Resource decrypted_frame,
[email protected]98ad9782012-08-22 04:06:22260 const std::string& serialized_block_info);
261 virtual void OnHostMsgDeliverSamples(
262 PP_Instance instance,
[email protected]c999b3b72012-10-19 22:33:46263 PP_Resource audio_frames,
[email protected]98ad9782012-08-22 04:06:22264 const std::string& serialized_block_info);
[email protected]c962f862012-04-12 00:02:04265#endif // !defined(OS_NACL)
[email protected]0f41c012011-10-21 19:49:20266
267 // Host -> Plugin message handlers.
[email protected]e8f07ac2012-01-03 17:43:36268 void OnPluginMsgMouseLockComplete(PP_Instance instance, int32_t result);
[email protected]0f41c012011-10-21 19:49:20269
270 void MouseLockCompleteInHost(int32_t result, PP_Instance instance);
271
[email protected]a8e72142012-08-21 17:24:20272 // Other helpers.
273 void CancelAnyPendingRequestSurroundingText(PP_Instance instance);
274
[email protected]47a961c2012-07-13 19:18:52275 ProxyCompletionCallbackFactory<PPB_Instance_Proxy> callback_factory_;
[email protected]4c2e9352010-11-05 22:13:02276};
277
278} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:02279} // namespace ppapi
[email protected]4c2e9352010-11-05 22:13:02280
281#endif // PPAPI_PROXY_PPB_INSTANCE_PROXY_H_