cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / proxy / ppb_instance_proxy.h
blob6df4f8d9eab70876902c85695096bf75aec88ac5
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_PPB_INSTANCE_PROXY_H_
6 #define PPAPI_PROXY_PPB_INSTANCE_PROXY_H_
8 #include <string>
10 #include "ppapi/c/pp_instance.h"
11 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_var.h"
13 #include "ppapi/proxy/interface_proxy.h"
14 #include "ppapi/proxy/proxy_completion_callback_factory.h"
15 #include "ppapi/shared_impl/host_resource.h"
16 #include "ppapi/shared_impl/ppb_instance_shared.h"
17 #include "ppapi/shared_impl/singleton_resource_id.h"
18 #include "ppapi/thunk/ppb_instance_api.h"
19 #include "ppapi/utility/completion_callback_factory.h"
21 // Windows headers interfere with this file.
22 #ifdef PostMessage
23 #undef PostMessage
24 #endif
26 struct PP_DecryptedBlockInfo;
27 struct PP_DecryptedFrameInfo;
29 namespace ppapi {
30 namespace proxy {
32 class SerializedVarReceiveInput;
33 class SerializedVarOutParam;
34 class SerializedVarReturnValue;
36 class PPB_Instance_Proxy : public InterfaceProxy,
37 public PPB_Instance_Shared {
38 public:
39 PPB_Instance_Proxy(Dispatcher* dispatcher);
40 virtual ~PPB_Instance_Proxy();
42 static const Info* GetInfoPrivate();
44 // InterfaceProxy implementation.
45 virtual bool OnMessageReceived(const IPC::Message& msg);
47 // PPB_Instance_API implementation.
48 virtual PP_Bool BindGraphics(PP_Instance instance,
49 PP_Resource device) OVERRIDE;
50 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
51 virtual const ViewData* GetViewData(PP_Instance instance) OVERRIDE;
52 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE;
53 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;
58 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance)
59 OVERRIDE;
60 virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance)
61 OVERRIDE;
62 virtual PP_Var GetDefaultCharSet(PP_Instance instance) OVERRIDE;
63 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;
68 virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE;
69 virtual PP_Bool SetFullscreen(PP_Instance instance,
70 PP_Bool fullscreen) OVERRIDE;
71 virtual PP_Bool GetScreenSize(PP_Instance instance,
72 PP_Size* size) OVERRIDE;
73 virtual Resource* GetSingletonResource(PP_Instance instance,
74 SingletonResourceID id) OVERRIDE;
75 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;
81 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;
85 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,
91 scoped_refptr<TrackedCallback> callback) OVERRIDE;
92 virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
93 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;
104 virtual PP_Var GetDocumentURL(PP_Instance instance,
105 PP_URLComponents_Dev* components) OVERRIDE;
106 #if !defined(OS_NACL)
107 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;
114 virtual PP_Var GetPluginInstanceURL(
115 PP_Instance instance,
116 PP_URLComponents_Dev* components) OVERRIDE;
117 virtual void NeedKey(PP_Instance instance,
118 PP_Var key_system,
119 PP_Var session_id,
120 PP_Var init_data) OVERRIDE;
121 virtual void KeyAdded(PP_Instance instance,
122 PP_Var key_system,
123 PP_Var session_id) OVERRIDE;
124 virtual void KeyMessage(PP_Instance instance,
125 PP_Var key_system,
126 PP_Var session_id,
127 PP_Var message,
128 PP_Var default_url) OVERRIDE;
129 virtual void KeyError(PP_Instance instance,
130 PP_Var key_system,
131 PP_Var session_id,
132 int32_t media_error,
133 int32_t system_code) OVERRIDE;
134 virtual void DeliverBlock(PP_Instance instance,
135 PP_Resource decrypted_block,
136 const PP_DecryptedBlockInfo* block_info) OVERRIDE;
137 virtual void DecoderInitializeDone(PP_Instance instance,
138 PP_DecryptorStreamType decoder_type,
139 uint32_t request_id,
140 PP_Bool success) OVERRIDE;
141 virtual void DecoderDeinitializeDone(PP_Instance instance,
142 PP_DecryptorStreamType decoder_type,
143 uint32_t request_id) OVERRIDE;
144 virtual void DecoderResetDone(PP_Instance instance,
145 PP_DecryptorStreamType decoder_type,
146 uint32_t request_id) OVERRIDE;
147 virtual void DeliverFrame(PP_Instance instance,
148 PP_Resource decrypted_frame,
149 const PP_DecryptedFrameInfo* frame_info) OVERRIDE;
150 virtual void DeliverSamples(PP_Instance instance,
151 PP_Resource audio_frames,
152 const PP_DecryptedBlockInfo* block_info) OVERRIDE;
153 #endif // !defined(OS_NACL)
155 static const ApiID kApiID = API_ID_PPB_INSTANCE;
157 private:
158 // Plugin -> Host message handlers.
159 void OnHostMsgGetWindowObject(PP_Instance instance,
160 SerializedVarReturnValue result);
161 void OnHostMsgGetOwnerElementObject(PP_Instance instance,
162 SerializedVarReturnValue result);
163 void OnHostMsgBindGraphics(PP_Instance instance,
164 PP_Resource device);
165 void OnHostMsgIsFullFrame(PP_Instance instance, PP_Bool* result);
166 void OnHostMsgExecuteScript(PP_Instance instance,
167 SerializedVarReceiveInput script,
168 SerializedVarOutParam out_exception,
169 SerializedVarReturnValue result);
170 void OnHostMsgGetAudioHardwareOutputSampleRate(PP_Instance instance,
171 uint32_t *result);
172 void OnHostMsgGetAudioHardwareOutputBufferSize(PP_Instance instance,
173 uint32_t *result);
174 void OnHostMsgGetDefaultCharSet(PP_Instance instance,
175 SerializedVarReturnValue result);
176 void OnHostMsgSetFullscreen(PP_Instance instance,
177 PP_Bool fullscreen,
178 PP_Bool* result);
179 void OnHostMsgGetScreenSize(PP_Instance instance,
180 PP_Bool* result,
181 PP_Size* size);
182 void OnHostMsgRequestInputEvents(PP_Instance instance,
183 bool is_filtering,
184 uint32_t event_classes);
185 void OnHostMsgClearInputEvents(PP_Instance instance,
186 uint32_t event_classes);
187 void OnHostMsgPostMessage(PP_Instance instance,
188 SerializedVarReceiveInput message);
189 void OnHostMsgLockMouse(PP_Instance instance);
190 void OnHostMsgUnlockMouse(PP_Instance instance);
191 void OnHostMsgSetCursor(PP_Instance instance,
192 int32_t type,
193 const ppapi::HostResource& custom_image,
194 const PP_Point& hot_spot);
195 void OnHostMsgSetTextInputType(PP_Instance instance, PP_TextInput_Type type);
196 void OnHostMsgUpdateCaretPosition(PP_Instance instance,
197 const PP_Rect& caret,
198 const PP_Rect& bounding_box);
199 void OnHostMsgCancelCompositionText(PP_Instance instance);
200 void OnHostMsgUpdateSurroundingText(
201 PP_Instance instance,
202 const std::string& text,
203 uint32_t caret,
204 uint32_t anchor);
205 void OnHostMsgGetDocumentURL(PP_Instance instance,
206 PP_URLComponents_Dev* components,
207 SerializedVarReturnValue result);
209 #if !defined(OS_NACL)
210 void OnHostMsgResolveRelativeToDocument(PP_Instance instance,
211 SerializedVarReceiveInput relative,
212 SerializedVarReturnValue result);
213 void OnHostMsgDocumentCanRequest(PP_Instance instance,
214 SerializedVarReceiveInput url,
215 PP_Bool* result);
216 void OnHostMsgDocumentCanAccessDocument(PP_Instance active,
217 PP_Instance target,
218 PP_Bool* result);
219 void OnHostMsgGetPluginInstanceURL(PP_Instance instance,
220 SerializedVarReturnValue result);
221 virtual void OnHostMsgNeedKey(PP_Instance instance,
222 SerializedVarReceiveInput key_system,
223 SerializedVarReceiveInput session_id,
224 SerializedVarReceiveInput init_data);
225 virtual void OnHostMsgKeyAdded(PP_Instance instance,
226 SerializedVarReceiveInput key_system,
227 SerializedVarReceiveInput session_id);
228 virtual void OnHostMsgKeyMessage(PP_Instance instance,
229 SerializedVarReceiveInput key_system,
230 SerializedVarReceiveInput session_id,
231 SerializedVarReceiveInput message,
232 SerializedVarReceiveInput default_url);
233 virtual void OnHostMsgKeyError(PP_Instance instance,
234 SerializedVarReceiveInput key_system,
235 SerializedVarReceiveInput session_id,
236 int32_t media_error,
237 int32_t system_code);
238 virtual void OnHostMsgDecoderInitializeDone(
239 PP_Instance instance,
240 PP_DecryptorStreamType decoder_type,
241 uint32_t request_id,
242 PP_Bool success);
243 virtual void OnHostMsgDecoderDeinitializeDone(
244 PP_Instance instance,
245 PP_DecryptorStreamType decoder_type,
246 uint32_t request_id);
247 virtual void OnHostMsgDecoderResetDone(PP_Instance instance,
248 PP_DecryptorStreamType decoder_type,
249 uint32_t request_id);
250 virtual void OnHostMsgDeliverBlock(PP_Instance instance,
251 PP_Resource decrypted_block,
252 const std::string& serialized_block_info);
253 virtual void OnHostMsgDeliverFrame(PP_Instance instance,
254 PP_Resource decrypted_frame,
255 const std::string& serialized_block_info);
256 virtual void OnHostMsgDeliverSamples(
257 PP_Instance instance,
258 PP_Resource audio_frames,
259 const std::string& serialized_block_info);
260 #endif // !defined(OS_NACL)
262 // Host -> Plugin message handlers.
263 void OnPluginMsgMouseLockComplete(PP_Instance instance, int32_t result);
265 void MouseLockCompleteInHost(int32_t result, PP_Instance instance);
267 // Other helpers.
268 void CancelAnyPendingRequestSurroundingText(PP_Instance instance);
270 ProxyCompletionCallbackFactory<PPB_Instance_Proxy> callback_factory_;
273 } // namespace proxy
274 } // namespace ppapi
276 #endif // PPAPI_PROXY_PPB_INSTANCE_PROXY_H_