Extend relocation packing to cover arm64.
[chromium-blink-merge.git] / ppapi / thunk / ppb_instance_api.h
blob263b49cc42c7dd5c7e0b3905ee11a6cf69ddca95
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_THUNK_INSTANCE_API_H_
6 #define PPAPI_THUNK_INSTANCE_API_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ppapi/c/dev/ppb_url_util_dev.h"
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_size.h"
14 #include "ppapi/c/ppb_audio_config.h"
15 #include "ppapi/c/ppb_console.h"
16 #include "ppapi/c/ppb_gamepad.h"
17 #include "ppapi/c/ppb_instance.h"
18 #include "ppapi/c/ppb_mouse_cursor.h"
19 #include "ppapi/c/ppb_text_input_controller.h"
20 #include "ppapi/c/private/pp_content_decryptor.h"
21 #include "ppapi/c/private/ppb_instance_private.h"
22 #include "ppapi/shared_impl/api_id.h"
23 #include "ppapi/shared_impl/resource.h"
24 #include "ppapi/shared_impl/singleton_resource_id.h"
26 // Windows headers interfere with this file.
27 #ifdef PostMessage
28 #undef PostMessage
29 #endif
31 struct PP_DecryptedBlockInfo;
32 struct PP_DecryptedFrameInfo;
33 struct PPP_MessageHandler_0_1;
35 namespace ppapi {
37 class Resource;
38 class TrackedCallback;
39 struct ViewData;
41 namespace thunk {
43 class PPB_Flash_API;
45 class PPB_Instance_API {
46 public:
47 virtual ~PPB_Instance_API() {}
49 virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) = 0;
50 virtual PP_Bool IsFullFrame(PP_Instance instance) = 0;
52 // Unexposed PPAPI functions for proxying.
53 // Returns the internal view data struct.
54 virtual const ViewData* GetViewData(PP_Instance instance) = 0;
55 // Returns the flash fullscreen status.
56 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) = 0;
58 // InstancePrivate.
59 virtual PP_Var GetWindowObject(PP_Instance instance) = 0;
60 virtual PP_Var GetOwnerElementObject(PP_Instance instance) = 0;
61 virtual PP_Var ExecuteScript(PP_Instance instance,
62 PP_Var script,
63 PP_Var* exception) = 0;
65 // Audio.
66 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance) = 0;
67 virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance) = 0;
69 // CharSet.
70 virtual PP_Var GetDefaultCharSet(PP_Instance instance) = 0;
72 // Console.
73 virtual void Log(PP_Instance instance,
74 PP_LogLevel log_level,
75 PP_Var value) = 0;
76 virtual void LogWithSource(PP_Instance instance,
77 PP_LogLevel log_level,
78 PP_Var source,
79 PP_Var value) = 0;
81 // Find.
82 virtual void SetPluginToHandleFindRequests(PP_Instance instance) = 0;
83 virtual void NumberOfFindResultsChanged(PP_Instance instance,
84 int32_t total,
85 PP_Bool final_result) = 0;
86 virtual void SelectedFindResultChanged(PP_Instance instance,
87 int32_t index) = 0;
88 virtual void SetTickmarks(PP_Instance instance,
89 const PP_Rect* tickmarks,
90 uint32_t count) = 0;
92 // Fullscreen.
93 virtual PP_Bool IsFullscreen(PP_Instance instance) = 0;
94 virtual PP_Bool SetFullscreen(PP_Instance instance,
95 PP_Bool fullscreen) = 0;
96 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) = 0;
98 // This is an implementation-only function which grabs an instance of a
99 // "singleton resource". These are used to implement instance interfaces
100 // (functions which are associated with the instance itself as opposed to a
101 // resource).
102 virtual Resource* GetSingletonResource(
103 PP_Instance instance, SingletonResourceID id) = 0;
105 // InputEvent.
106 virtual int32_t RequestInputEvents(PP_Instance instance,
107 uint32_t event_classes) = 0;
108 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
109 uint32_t event_classes) = 0;
110 virtual void ClearInputEventRequest(PP_Instance instance,
111 uint32_t event_classes) = 0;
113 // InputEventPrivate.
114 virtual void StartTrackingLatency(PP_Instance instance) = 0;
116 // Messaging.
117 virtual void PostMessage(PP_Instance instance, PP_Var message) = 0;
118 virtual int32_t RegisterMessageHandler(PP_Instance instance,
119 void* user_data,
120 const PPP_MessageHandler_0_1* handler,
121 PP_Resource message_loop) = 0;
122 virtual void UnregisterMessageHandler(PP_Instance instance) = 0;
124 // Mouse cursor.
125 virtual PP_Bool SetCursor(PP_Instance instance,
126 PP_MouseCursor_Type type,
127 PP_Resource image,
128 const PP_Point* hot_spot) = 0;
130 // MouseLock.
131 virtual int32_t LockMouse(PP_Instance instance,
132 scoped_refptr<TrackedCallback> callback) = 0;
133 virtual void UnlockMouse(PP_Instance instance) = 0;
135 // TextInput.
136 virtual void SetTextInputType(PP_Instance instance,
137 PP_TextInput_Type type) = 0;
138 virtual void UpdateCaretPosition(PP_Instance instance,
139 const PP_Rect& caret,
140 const PP_Rect& bounding_box) = 0;
141 virtual void CancelCompositionText(PP_Instance instance) = 0;
142 virtual void SelectionChanged(PP_Instance instance) = 0;
143 virtual void UpdateSurroundingText(PP_Instance instance,
144 const char* text,
145 uint32_t caret,
146 uint32_t anchor) = 0;
148 // Zoom.
149 virtual void ZoomChanged(PP_Instance instance, double factor) = 0;
150 virtual void ZoomLimitsChanged(PP_Instance instance,
151 double minimum_factor,
152 double maximum_factor) = 0;
153 // Testing and URLUtil.
154 virtual PP_Var GetDocumentURL(PP_Instance instance,
155 PP_URLComponents_Dev* components) = 0;
156 #if !defined(OS_NACL)
157 // Content Decryptor.
158 virtual void PromiseResolved(PP_Instance instance, uint32 promise_id) = 0;
159 virtual void PromiseResolvedWithSession(PP_Instance instance,
160 uint32 promise_id,
161 PP_Var web_session_id_var) = 0;
162 virtual void PromiseRejected(PP_Instance instance,
163 uint32 promise_id,
164 PP_CdmExceptionCode exception_code,
165 uint32 system_code,
166 PP_Var error_description_var) = 0;
167 virtual void SessionMessage(PP_Instance instance,
168 PP_Var web_session_id_var,
169 PP_Var message_var,
170 PP_Var destination_url_var) = 0;
171 virtual void SessionReady(PP_Instance instance,
172 PP_Var web_session_id_var) = 0;
173 virtual void SessionClosed(PP_Instance instance,
174 PP_Var web_session_id_var) = 0;
175 virtual void SessionError(PP_Instance instance,
176 PP_Var web_session_id_var,
177 PP_CdmExceptionCode exception_code,
178 uint32 system_code,
179 PP_Var error_description_var) = 0;
180 virtual void DeliverBlock(PP_Instance instance,
181 PP_Resource decrypted_block,
182 const PP_DecryptedBlockInfo* block_info) = 0;
183 virtual void DecoderInitializeDone(PP_Instance instance,
184 PP_DecryptorStreamType decoder_type,
185 uint32_t request_id,
186 PP_Bool success) = 0;
187 virtual void DecoderDeinitializeDone(PP_Instance instance,
188 PP_DecryptorStreamType decoder_type,
189 uint32_t request_id) = 0;
190 virtual void DecoderResetDone(PP_Instance instance,
191 PP_DecryptorStreamType decoder_type,
192 uint32_t request_id) = 0;
193 virtual void DeliverFrame(PP_Instance instance,
194 PP_Resource decrypted_frame,
195 const PP_DecryptedFrameInfo* frame_info) = 0;
196 virtual void DeliverSamples(PP_Instance instance,
197 PP_Resource audio_frames,
198 const PP_DecryptedSampleInfo* sample_info) = 0;
200 // URLUtil.
201 virtual PP_Var ResolveRelativeToDocument(
202 PP_Instance instance,
203 PP_Var relative,
204 PP_URLComponents_Dev* components) = 0;
205 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) = 0;
206 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance,
207 PP_Instance target) = 0;
208 virtual PP_Var GetPluginInstanceURL(PP_Instance instance,
209 PP_URLComponents_Dev* components) = 0;
210 virtual PP_Var GetPluginReferrerURL(PP_Instance instance,
211 PP_URLComponents_Dev* components) = 0;
212 #endif // !defined(OS_NACL)
214 static const ApiID kApiID = API_ID_PPB_INSTANCE;
217 } // namespace thunk
218 } // namespace ppapi
220 #endif // PPAPI_THUNK_INSTANCE_API_H_