blob: aed90ab97afa8445f89a57e9bf87775321da7370 [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
8#include "ppapi/c/pp_instance.h"
9#include "ppapi/c/pp_resource.h"
[email protected]3b98ced72012-03-09 02:08:3310#include "ppapi/c/pp_time.h"
[email protected]4c2e9352010-11-05 22:13:0211#include "ppapi/c/pp_var.h"
12#include "ppapi/proxy/interface_proxy.h"
[email protected]0f41c012011-10-21 19:49:2013#include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
[email protected]ceadc392011-06-15 23:04:2414#include "ppapi/shared_impl/function_group_base.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]ceadc392011-06-15 23:04:2417#include "ppapi/thunk/ppb_instance_api.h"
[email protected]ae5ff9ae2012-01-06 22:50:3318#include "ppapi/utility/completion_callback_factory.h"
[email protected]4c2e9352010-11-05 22:13:0219
[email protected]0f41c012011-10-21 19:49:2020// Windows headers interfere with this file.
21#ifdef PostMessage
22#undef PostMessage
23#endif
24
[email protected]4d2efd22011-08-18 21:58:0225namespace ppapi {
[email protected]4c2e9352010-11-05 22:13:0226namespace proxy {
27
28class SerializedVarReceiveInput;
29class SerializedVarOutParam;
30class SerializedVarReturnValue;
31
[email protected]ceadc392011-06-15 23:04:2432class PPB_Instance_Proxy : public InterfaceProxy,
[email protected]a9b16dd2012-01-31 05:00:2633 public PPB_Instance_Shared {
[email protected]4c2e9352010-11-05 22:13:0234 public:
[email protected]5c966022011-09-13 18:09:3735 PPB_Instance_Proxy(Dispatcher* dispatcher);
[email protected]4c2e9352010-11-05 22:13:0236 virtual ~PPB_Instance_Proxy();
37
[email protected]ceadc392011-06-15 23:04:2438 static const Info* GetInfoPrivate();
[email protected]4c2e9352010-11-05 22:13:0239
40 // InterfaceProxy implementation.
[email protected]a95986a82010-12-24 06:19:2841 virtual bool OnMessageReceived(const IPC::Message& msg);
[email protected]4c2e9352010-11-05 22:13:0242
[email protected]ceadc392011-06-15 23:04:2443 // FunctionGroupBase overrides.
44 ppapi::thunk::PPB_Instance_FunctionAPI* AsPPB_Instance_FunctionAPI() OVERRIDE;
45
46 // PPB_Instance_FunctionAPI implementation.
47 virtual PP_Bool BindGraphics(PP_Instance instance,
48 PP_Resource device) OVERRIDE;
49 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
[email protected]e8f07ac2012-01-03 17:43:3650 virtual const ViewData* GetViewData(PP_Instance instance) OVERRIDE;
[email protected]ceadc392011-06-15 23:04:2451 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE;
52 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE;
53 virtual PP_Var ExecuteScript(PP_Instance instance,
54 PP_Var script,
55 PP_Var* exception) OVERRIDE;
[email protected]c59ed5892012-02-18 01:10:1956 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance)
57 OVERRIDE;
58 virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance)
59 OVERRIDE;
[email protected]8d770e492011-10-11 04:54:3160 virtual PP_Var GetDefaultCharSet(PP_Instance instance) OVERRIDE;
[email protected]59cf7022011-09-14 22:44:1961 virtual void NumberOfFindResultsChanged(PP_Instance instance,
62 int32_t total,
63 PP_Bool final_result) OVERRIDE;
64 virtual void SelectedFindResultChanged(PP_Instance instance,
65 int32_t index) OVERRIDE;
[email protected]7a26d92e2012-02-17 20:15:2566 virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE;
[email protected]06e0a342011-09-27 04:24:3067 virtual PP_Bool SetFullscreen(PP_Instance instance,
[email protected]3b98ced72012-03-09 02:08:3368 PP_Bool fullscreen) OVERRIDE;
[email protected]06e0a342011-09-27 04:24:3069 virtual PP_Bool GetScreenSize(PP_Instance instance,
70 PP_Size* size) OVERRIDE;
[email protected]dafab752011-09-20 20:08:4071 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE;
72 virtual PP_Bool FlashSetFullscreen(PP_Instance instance,
[email protected]06e0a342011-09-27 04:24:3073 PP_Bool fullscreen) OVERRIDE;
74 virtual PP_Bool FlashGetScreenSize(PP_Instance instance, PP_Size* size)
75 OVERRIDE;
[email protected]957c93a2012-03-01 06:44:5176 virtual void SampleGamepads(PP_Instance instance,
[email protected]d5cc7192012-03-07 16:53:1677 PP_GamepadsSampleData* data) OVERRIDE;
[email protected]493d14212011-07-07 15:38:4878 virtual int32_t RequestInputEvents(PP_Instance instance,
79 uint32_t event_classes) OVERRIDE;
80 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
81 uint32_t event_classes) OVERRIDE;
82 virtual void ClearInputEventRequest(PP_Instance instance,
83 uint32_t event_classes) OVERRIDE;
[email protected]3b98ced72012-03-09 02:08:3384 virtual void ClosePendingUserGesture(PP_Instance instance,
85 PP_TimeTicks timestamp) OVERRIDE;
[email protected]55a5a522011-07-06 22:52:4086 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE;
87 virtual void ZoomLimitsChanged(PP_Instance instance,
88 double minimum_factor,
89 double maximium_factor) OVERRIDE;
[email protected]c962f862012-04-12 00:02:0490 virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE;
91 virtual PP_Bool SetCursor(PP_Instance instance,
92 PP_MouseCursor_Type type,
93 PP_Resource image,
94 const PP_Point* hot_spot) OVERRIDE;
95 virtual int32_t LockMouse(PP_Instance instance,
96 PP_CompletionCallback callback) OVERRIDE;
97 virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
98
99#if !defined(OS_NACL)
[email protected]03460232011-10-10 17:23:57100 virtual PP_Var ResolveRelativeToDocument(
101 PP_Instance instance,
102 PP_Var relative,
103 PP_URLComponents_Dev* components) OVERRIDE;
104 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE;
105 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance,
106 PP_Instance target) OVERRIDE;
107 virtual PP_Var GetDocumentURL(PP_Instance instance,
108 PP_URLComponents_Dev* components) OVERRIDE;
109 virtual PP_Var GetPluginInstanceURL(
110 PP_Instance instance,
111 PP_URLComponents_Dev* components) OVERRIDE;
[email protected]c962f862012-04-12 00:02:04112#endif // !defined(OS_NACL)
[email protected]ceadc392011-06-15 23:04:24113
[email protected]ac4b54d2011-10-20 23:09:28114 static const ApiID kApiID = API_ID_PPB_INSTANCE;
[email protected]5c966022011-09-13 18:09:37115
[email protected]4c2e9352010-11-05 22:13:02116 private:
[email protected]0f41c012011-10-21 19:49:20117 // Plugin -> Host message handlers.
[email protected]e8f07ac2012-01-03 17:43:36118 void OnHostMsgGetWindowObject(PP_Instance instance,
119 SerializedVarReturnValue result);
120 void OnHostMsgGetOwnerElementObject(PP_Instance instance,
[email protected]03460232011-10-10 17:23:57121 SerializedVarReturnValue result);
[email protected]e8f07ac2012-01-03 17:43:36122 void OnHostMsgBindGraphics(PP_Instance instance,
123 const ppapi::HostResource& device,
124 PP_Bool* result);
125 void OnHostMsgIsFullFrame(PP_Instance instance, PP_Bool* result);
126 void OnHostMsgExecuteScript(PP_Instance instance,
127 SerializedVarReceiveInput script,
128 SerializedVarOutParam out_exception,
129 SerializedVarReturnValue result);
[email protected]c59ed5892012-02-18 01:10:19130 void OnHostMsgGetAudioHardwareOutputSampleRate(PP_Instance instance,
131 uint32_t *result);
132 void OnHostMsgGetAudioHardwareOutputBufferSize(PP_Instance instance,
133 uint32_t *result);
[email protected]e8f07ac2012-01-03 17:43:36134 void OnHostMsgGetDefaultCharSet(PP_Instance instance,
135 SerializedVarReturnValue result);
[email protected]e8f07ac2012-01-03 17:43:36136 void OnHostMsgSetFullscreen(PP_Instance instance,
137 PP_Bool fullscreen,
138 PP_Bool* result);
139 void OnHostMsgGetScreenSize(PP_Instance instance,
140 PP_Bool* result,
141 PP_Size* size);
142 void OnHostMsgFlashSetFullscreen(PP_Instance instance,
143 PP_Bool fullscreen,
144 PP_Bool* result);
145 void OnHostMsgFlashGetScreenSize(PP_Instance instance,
146 PP_Bool* result,
147 PP_Size* size);
148 void OnHostMsgRequestInputEvents(PP_Instance instance,
149 bool is_filtering,
150 uint32_t event_classes);
151 void OnHostMsgClearInputEvents(PP_Instance instance,
152 uint32_t event_classes);
[email protected]3b98ced72012-03-09 02:08:33153 void OnMsgHandleInputEventAck(PP_Instance instance,
154 PP_TimeTicks timestamp);
[email protected]e8f07ac2012-01-03 17:43:36155 void OnHostMsgPostMessage(PP_Instance instance,
156 SerializedVarReceiveInput message);
157 void OnHostMsgLockMouse(PP_Instance instance);
158 void OnHostMsgUnlockMouse(PP_Instance instance);
[email protected]c962f862012-04-12 00:02:04159 void OnHostMsgSetCursor(PP_Instance instance,
160 int32_t type,
161 const ppapi::HostResource& custom_image,
162 const PP_Point& hot_spot);
163#if !defined(OS_NACL)
[email protected]e8f07ac2012-01-03 17:43:36164 void OnHostMsgResolveRelativeToDocument(PP_Instance instance,
165 SerializedVarReceiveInput relative,
166 SerializedVarReturnValue result);
167 void OnHostMsgDocumentCanRequest(PP_Instance instance,
168 SerializedVarReceiveInput url,
169 PP_Bool* result);
170 void OnHostMsgDocumentCanAccessDocument(PP_Instance active,
171 PP_Instance target,
172 PP_Bool* result);
173 void OnHostMsgGetDocumentURL(PP_Instance instance,
174 SerializedVarReturnValue result);
175 void OnHostMsgGetPluginInstanceURL(PP_Instance instance,
176 SerializedVarReturnValue result);
[email protected]c962f862012-04-12 00:02:04177#endif // !defined(OS_NACL)
[email protected]0f41c012011-10-21 19:49:20178
179 // Host -> Plugin message handlers.
[email protected]e8f07ac2012-01-03 17:43:36180 void OnPluginMsgMouseLockComplete(PP_Instance instance, int32_t result);
[email protected]0f41c012011-10-21 19:49:20181
182 void MouseLockCompleteInHost(int32_t result, PP_Instance instance);
183
184 pp::CompletionCallbackFactory<PPB_Instance_Proxy,
185 ProxyNonThreadSafeRefCount> callback_factory_;
[email protected]4c2e9352010-11-05 22:13:02186};
187
188} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:02189} // namespace ppapi
[email protected]4c2e9352010-11-05 22:13:02190
191#endif // PPAPI_PROXY_PPB_INSTANCE_PROXY_H_