blob: 7a84ec85a42298e2cd09ee9e78be31bc3ec7cef7 [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]be0a84b2011-08-13 04:18:4414#include "ppapi/shared_impl/host_resource.h"
[email protected]9a578392011-12-07 18:59:2715#include "ppapi/shared_impl/ppb_instance_shared.h"
[email protected]ceadc392011-06-15 23:04:2416#include "ppapi/thunk/ppb_instance_api.h"
[email protected]ae5ff9ae2012-01-06 22:50:3317#include "ppapi/utility/completion_callback_factory.h"
[email protected]4c2e9352010-11-05 22:13:0218
[email protected]0f41c012011-10-21 19:49:2019// Windows headers interfere with this file.
20#ifdef PostMessage
21#undef PostMessage
22#endif
23
[email protected]4d2efd22011-08-18 21:58:0224namespace ppapi {
[email protected]4c2e9352010-11-05 22:13:0225namespace proxy {
26
27class SerializedVarReceiveInput;
28class SerializedVarOutParam;
29class SerializedVarReturnValue;
30
[email protected]ceadc392011-06-15 23:04:2431class PPB_Instance_Proxy : public InterfaceProxy,
[email protected]a9b16dd2012-01-31 05:00:2632 public PPB_Instance_Shared {
[email protected]4c2e9352010-11-05 22:13:0233 public:
[email protected]5c966022011-09-13 18:09:3734 PPB_Instance_Proxy(Dispatcher* dispatcher);
[email protected]4c2e9352010-11-05 22:13:0235 virtual ~PPB_Instance_Proxy();
36
[email protected]ceadc392011-06-15 23:04:2437 static const Info* GetInfoPrivate();
[email protected]4c2e9352010-11-05 22:13:0238
39 // InterfaceProxy implementation.
[email protected]a95986a82010-12-24 06:19:2840 virtual bool OnMessageReceived(const IPC::Message& msg);
[email protected]4c2e9352010-11-05 22:13:0241
[email protected]4f2006122012-04-30 05:13:1742 // PPB_Instance_API implementation.
[email protected]ceadc392011-06-15 23:04:2443 virtual PP_Bool BindGraphics(PP_Instance instance,
44 PP_Resource device) OVERRIDE;
45 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
[email protected]e8f07ac2012-01-03 17:43:3646 virtual const ViewData* GetViewData(PP_Instance instance) OVERRIDE;
[email protected]ceadc392011-06-15 23:04:2447 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE;
48 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE;
49 virtual PP_Var ExecuteScript(PP_Instance instance,
50 PP_Var script,
51 PP_Var* exception) OVERRIDE;
[email protected]c59ed5892012-02-18 01:10:1952 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance)
53 OVERRIDE;
54 virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance)
55 OVERRIDE;
[email protected]8d770e492011-10-11 04:54:3156 virtual PP_Var GetDefaultCharSet(PP_Instance instance) OVERRIDE;
[email protected]59cf7022011-09-14 22:44:1957 virtual void NumberOfFindResultsChanged(PP_Instance instance,
58 int32_t total,
59 PP_Bool final_result) OVERRIDE;
60 virtual void SelectedFindResultChanged(PP_Instance instance,
61 int32_t index) OVERRIDE;
[email protected]7a26d92e2012-02-17 20:15:2562 virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE;
[email protected]06e0a342011-09-27 04:24:3063 virtual PP_Bool SetFullscreen(PP_Instance instance,
[email protected]3b98ced72012-03-09 02:08:3364 PP_Bool fullscreen) OVERRIDE;
[email protected]06e0a342011-09-27 04:24:3065 virtual PP_Bool GetScreenSize(PP_Instance instance,
[email protected]a085aed72012-04-24 05:32:0466 PP_Size* size) OVERRIDE;
67 virtual thunk::PPB_Flash_API* GetFlashAPI() OVERRIDE;
[email protected]957c93a2012-03-01 06:44:5168 virtual void SampleGamepads(PP_Instance instance,
[email protected]d5cc7192012-03-07 16:53:1669 PP_GamepadsSampleData* data) OVERRIDE;
[email protected]493d14212011-07-07 15:38:4870 virtual int32_t RequestInputEvents(PP_Instance instance,
71 uint32_t event_classes) OVERRIDE;
72 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
73 uint32_t event_classes) OVERRIDE;
74 virtual void ClearInputEventRequest(PP_Instance instance,
75 uint32_t event_classes) OVERRIDE;
[email protected]3b98ced72012-03-09 02:08:3376 virtual void ClosePendingUserGesture(PP_Instance instance,
77 PP_TimeTicks timestamp) OVERRIDE;
[email protected]55a5a522011-07-06 22:52:4078 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE;
79 virtual void ZoomLimitsChanged(PP_Instance instance,
80 double minimum_factor,
81 double maximium_factor) OVERRIDE;
[email protected]c962f862012-04-12 00:02:0482 virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE;
83 virtual PP_Bool SetCursor(PP_Instance instance,
84 PP_MouseCursor_Type type,
85 PP_Resource image,
86 const PP_Point* hot_spot) OVERRIDE;
87 virtual int32_t LockMouse(PP_Instance instance,
88 PP_CompletionCallback callback) OVERRIDE;
89 virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
[email protected]772a74622012-06-14 21:15:5090 virtual PP_Bool GetDefaultPrintSettings(
91 PP_Instance instance,
92 PP_PrintSettings_Dev* print_settings) 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]c962f862012-04-12 00:02:04104
105#if !defined(OS_NACL)
[email protected]03460232011-10-10 17:23:57106 virtual PP_Var ResolveRelativeToDocument(
107 PP_Instance instance,
108 PP_Var relative,
109 PP_URLComponents_Dev* components) OVERRIDE;
110 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE;
111 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance,
112 PP_Instance target) OVERRIDE;
113 virtual PP_Var GetDocumentURL(PP_Instance instance,
114 PP_URLComponents_Dev* components) OVERRIDE;
115 virtual PP_Var GetPluginInstanceURL(
116 PP_Instance instance,
117 PP_URLComponents_Dev* components) OVERRIDE;
[email protected]c962f862012-04-12 00:02:04118#endif // !defined(OS_NACL)
[email protected]ceadc392011-06-15 23:04:24119
[email protected]ac4b54d2011-10-20 23:09:28120 static const ApiID kApiID = API_ID_PPB_INSTANCE;
[email protected]5c966022011-09-13 18:09:37121
[email protected]4c2e9352010-11-05 22:13:02122 private:
[email protected]0f41c012011-10-21 19:49:20123 // Plugin -> Host message handlers.
[email protected]e8f07ac2012-01-03 17:43:36124 void OnHostMsgGetWindowObject(PP_Instance instance,
125 SerializedVarReturnValue result);
126 void OnHostMsgGetOwnerElementObject(PP_Instance instance,
[email protected]03460232011-10-10 17:23:57127 SerializedVarReturnValue result);
[email protected]e8f07ac2012-01-03 17:43:36128 void OnHostMsgBindGraphics(PP_Instance instance,
129 const ppapi::HostResource& device,
130 PP_Bool* result);
131 void OnHostMsgIsFullFrame(PP_Instance instance, PP_Bool* result);
132 void OnHostMsgExecuteScript(PP_Instance instance,
133 SerializedVarReceiveInput script,
134 SerializedVarOutParam out_exception,
135 SerializedVarReturnValue result);
[email protected]c59ed5892012-02-18 01:10:19136 void OnHostMsgGetAudioHardwareOutputSampleRate(PP_Instance instance,
137 uint32_t *result);
138 void OnHostMsgGetAudioHardwareOutputBufferSize(PP_Instance instance,
139 uint32_t *result);
[email protected]e8f07ac2012-01-03 17:43:36140 void OnHostMsgGetDefaultCharSet(PP_Instance instance,
141 SerializedVarReturnValue result);
[email protected]e8f07ac2012-01-03 17:43:36142 void OnHostMsgSetFullscreen(PP_Instance instance,
143 PP_Bool fullscreen,
144 PP_Bool* result);
145 void OnHostMsgGetScreenSize(PP_Instance instance,
146 PP_Bool* result,
147 PP_Size* size);
[email protected]e8f07ac2012-01-03 17:43:36148 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]772a74622012-06-14 21:15:50159 void OnHostMsgGetDefaultPrintSettings(PP_Instance instance,
160 PP_PrintSettings_Dev* settings,
161 bool* result);
[email protected]c962f862012-04-12 00:02:04162 void OnHostMsgSetCursor(PP_Instance instance,
163 int32_t type,
164 const ppapi::HostResource& custom_image,
165 const PP_Point& hot_spot);
[email protected]4c44183a2012-04-27 16:52:23166 void OnHostMsgSetTextInputType(PP_Instance instance, PP_TextInput_Type type);
167 void OnHostMsgUpdateCaretPosition(PP_Instance instance,
168 const PP_Rect& caret,
169 const PP_Rect& bounding_box);
170 void OnHostMsgCancelCompositionText(PP_Instance instance);
171 void OnHostMsgUpdateSurroundingText(
172 PP_Instance instance,
173 const std::string& text,
174 uint32_t caret,
175 uint32_t anchor);
[email protected]c962f862012-04-12 00:02:04176#if !defined(OS_NACL)
[email protected]e8f07ac2012-01-03 17:43:36177 void OnHostMsgResolveRelativeToDocument(PP_Instance instance,
178 SerializedVarReceiveInput relative,
179 SerializedVarReturnValue result);
180 void OnHostMsgDocumentCanRequest(PP_Instance instance,
181 SerializedVarReceiveInput url,
182 PP_Bool* result);
183 void OnHostMsgDocumentCanAccessDocument(PP_Instance active,
184 PP_Instance target,
185 PP_Bool* result);
186 void OnHostMsgGetDocumentURL(PP_Instance instance,
187 SerializedVarReturnValue result);
188 void OnHostMsgGetPluginInstanceURL(PP_Instance instance,
189 SerializedVarReturnValue result);
[email protected]c962f862012-04-12 00:02:04190#endif // !defined(OS_NACL)
[email protected]0f41c012011-10-21 19:49:20191
192 // Host -> Plugin message handlers.
[email protected]e8f07ac2012-01-03 17:43:36193 void OnPluginMsgMouseLockComplete(PP_Instance instance, int32_t result);
[email protected]0f41c012011-10-21 19:49:20194
195 void MouseLockCompleteInHost(int32_t result, PP_Instance instance);
196
197 pp::CompletionCallbackFactory<PPB_Instance_Proxy,
198 ProxyNonThreadSafeRefCount> callback_factory_;
[email protected]4c2e9352010-11-05 22:13:02199};
200
201} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:02202} // namespace ppapi
[email protected]4c2e9352010-11-05 22:13:02203
204#endif // PPAPI_PROXY_PPB_INSTANCE_PROXY_H_