blob: d408af71f55c36646d49015f35e78659f2c1b5b3 [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,
[email protected]a085aed72012-04-24 05:32:0470 PP_Size* size) OVERRIDE;
71 virtual thunk::PPB_Flash_API* GetFlashAPI() OVERRIDE;
[email protected]957c93a2012-03-01 06:44:5172 virtual void SampleGamepads(PP_Instance instance,
[email protected]d5cc7192012-03-07 16:53:1673 PP_GamepadsSampleData* data) OVERRIDE;
[email protected]493d14212011-07-07 15:38:4874 virtual int32_t RequestInputEvents(PP_Instance instance,
75 uint32_t event_classes) OVERRIDE;
76 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
77 uint32_t event_classes) OVERRIDE;
78 virtual void ClearInputEventRequest(PP_Instance instance,
79 uint32_t event_classes) OVERRIDE;
[email protected]3b98ced72012-03-09 02:08:3380 virtual void ClosePendingUserGesture(PP_Instance instance,
81 PP_TimeTicks timestamp) OVERRIDE;
[email protected]55a5a522011-07-06 22:52:4082 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE;
83 virtual void ZoomLimitsChanged(PP_Instance instance,
84 double minimum_factor,
85 double maximium_factor) OVERRIDE;
[email protected]c962f862012-04-12 00:02:0486 virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE;
87 virtual PP_Bool SetCursor(PP_Instance instance,
88 PP_MouseCursor_Type type,
89 PP_Resource image,
90 const PP_Point* hot_spot) OVERRIDE;
91 virtual int32_t LockMouse(PP_Instance instance,
92 PP_CompletionCallback callback) OVERRIDE;
93 virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
94
95#if !defined(OS_NACL)
[email protected]03460232011-10-10 17:23:5796 virtual PP_Var ResolveRelativeToDocument(
97 PP_Instance instance,
98 PP_Var relative,
99 PP_URLComponents_Dev* components) OVERRIDE;
100 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE;
101 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance,
102 PP_Instance target) OVERRIDE;
103 virtual PP_Var GetDocumentURL(PP_Instance instance,
104 PP_URLComponents_Dev* components) OVERRIDE;
105 virtual PP_Var GetPluginInstanceURL(
106 PP_Instance instance,
107 PP_URLComponents_Dev* components) OVERRIDE;
[email protected]c962f862012-04-12 00:02:04108#endif // !defined(OS_NACL)
[email protected]ceadc392011-06-15 23:04:24109
[email protected]ac4b54d2011-10-20 23:09:28110 static const ApiID kApiID = API_ID_PPB_INSTANCE;
[email protected]5c966022011-09-13 18:09:37111
[email protected]4c2e9352010-11-05 22:13:02112 private:
[email protected]0f41c012011-10-21 19:49:20113 // Plugin -> Host message handlers.
[email protected]e8f07ac2012-01-03 17:43:36114 void OnHostMsgGetWindowObject(PP_Instance instance,
115 SerializedVarReturnValue result);
116 void OnHostMsgGetOwnerElementObject(PP_Instance instance,
[email protected]03460232011-10-10 17:23:57117 SerializedVarReturnValue result);
[email protected]e8f07ac2012-01-03 17:43:36118 void OnHostMsgBindGraphics(PP_Instance instance,
119 const ppapi::HostResource& device,
120 PP_Bool* result);
121 void OnHostMsgIsFullFrame(PP_Instance instance, PP_Bool* result);
122 void OnHostMsgExecuteScript(PP_Instance instance,
123 SerializedVarReceiveInput script,
124 SerializedVarOutParam out_exception,
125 SerializedVarReturnValue result);
[email protected]c59ed5892012-02-18 01:10:19126 void OnHostMsgGetAudioHardwareOutputSampleRate(PP_Instance instance,
127 uint32_t *result);
128 void OnHostMsgGetAudioHardwareOutputBufferSize(PP_Instance instance,
129 uint32_t *result);
[email protected]e8f07ac2012-01-03 17:43:36130 void OnHostMsgGetDefaultCharSet(PP_Instance instance,
131 SerializedVarReturnValue result);
[email protected]e8f07ac2012-01-03 17:43:36132 void OnHostMsgSetFullscreen(PP_Instance instance,
133 PP_Bool fullscreen,
134 PP_Bool* result);
135 void OnHostMsgGetScreenSize(PP_Instance instance,
136 PP_Bool* result,
137 PP_Size* size);
[email protected]e8f07ac2012-01-03 17:43:36138 void OnHostMsgRequestInputEvents(PP_Instance instance,
139 bool is_filtering,
140 uint32_t event_classes);
141 void OnHostMsgClearInputEvents(PP_Instance instance,
142 uint32_t event_classes);
[email protected]3b98ced72012-03-09 02:08:33143 void OnMsgHandleInputEventAck(PP_Instance instance,
144 PP_TimeTicks timestamp);
[email protected]e8f07ac2012-01-03 17:43:36145 void OnHostMsgPostMessage(PP_Instance instance,
146 SerializedVarReceiveInput message);
147 void OnHostMsgLockMouse(PP_Instance instance);
148 void OnHostMsgUnlockMouse(PP_Instance instance);
[email protected]c962f862012-04-12 00:02:04149 void OnHostMsgSetCursor(PP_Instance instance,
150 int32_t type,
151 const ppapi::HostResource& custom_image,
152 const PP_Point& hot_spot);
153#if !defined(OS_NACL)
[email protected]e8f07ac2012-01-03 17:43:36154 void OnHostMsgResolveRelativeToDocument(PP_Instance instance,
155 SerializedVarReceiveInput relative,
156 SerializedVarReturnValue result);
157 void OnHostMsgDocumentCanRequest(PP_Instance instance,
158 SerializedVarReceiveInput url,
159 PP_Bool* result);
160 void OnHostMsgDocumentCanAccessDocument(PP_Instance active,
161 PP_Instance target,
162 PP_Bool* result);
163 void OnHostMsgGetDocumentURL(PP_Instance instance,
164 SerializedVarReturnValue result);
165 void OnHostMsgGetPluginInstanceURL(PP_Instance instance,
166 SerializedVarReturnValue result);
[email protected]c962f862012-04-12 00:02:04167#endif // !defined(OS_NACL)
[email protected]0f41c012011-10-21 19:49:20168
169 // Host -> Plugin message handlers.
[email protected]e8f07ac2012-01-03 17:43:36170 void OnPluginMsgMouseLockComplete(PP_Instance instance, int32_t result);
[email protected]0f41c012011-10-21 19:49:20171
172 void MouseLockCompleteInHost(int32_t result, PP_Instance instance);
173
174 pp::CompletionCallbackFactory<PPB_Instance_Proxy,
175 ProxyNonThreadSafeRefCount> callback_factory_;
[email protected]4c2e9352010-11-05 22:13:02176};
177
178} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:02179} // namespace ppapi
[email protected]4c2e9352010-11-05 22:13:02180
181#endif // PPAPI_PROXY_PPB_INSTANCE_PROXY_H_