Create an initial chrome://supervised-user-internals page
[chromium-blink-merge.git] / ppapi / thunk / ppb_instance_api.h
blobf4c9d0d9079fb9b9107d3ba6c113d95fe694e302
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/pp_time.h"
15 #include "ppapi/c/ppb_audio_config.h"
16 #include "ppapi/c/ppb_console.h"
17 #include "ppapi/c/ppb_gamepad.h"
18 #include "ppapi/c/ppb_instance.h"
19 #include "ppapi/c/ppb_mouse_cursor.h"
20 #include "ppapi/c/ppb_text_input_controller.h"
21 #include "ppapi/c/private/pp_content_decryptor.h"
22 #include "ppapi/c/private/ppb_instance_private.h"
23 #include "ppapi/shared_impl/api_id.h"
24 #include "ppapi/shared_impl/resource.h"
25 #include "ppapi/shared_impl/singleton_resource_id.h"
27 // Windows headers interfere with this file.
28 #ifdef PostMessage
29 #undef PostMessage
30 #endif
32 struct PP_DecryptedBlockInfo;
33 struct PP_DecryptedFrameInfo;
34 struct PPP_MessageHandler_0_2;
36 namespace ppapi {
38 class Resource;
39 class TrackedCallback;
40 struct ViewData;
42 namespace thunk {
44 class PPB_Flash_API;
46 class PPB_Instance_API {
47 public:
48 virtual ~PPB_Instance_API() {}
50 virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) = 0;
51 virtual PP_Bool IsFullFrame(PP_Instance instance) = 0;
53 // Unexposed PPAPI functions for proxying.
54 // Returns the internal view data struct.
55 virtual const ViewData* GetViewData(PP_Instance instance) = 0;
56 // Returns the flash fullscreen status.
57 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) = 0;
59 // InstancePrivate.
60 virtual PP_Var GetWindowObject(PP_Instance instance) = 0;
61 virtual PP_Var GetOwnerElementObject(PP_Instance instance) = 0;
62 virtual PP_Var ExecuteScript(PP_Instance instance,
63 PP_Var script,
64 PP_Var* exception) = 0;
66 // Audio.
67 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance) = 0;
68 virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance) = 0;
70 // CharSet.
71 virtual PP_Var GetDefaultCharSet(PP_Instance instance) = 0;
73 // Console.
74 virtual void Log(PP_Instance instance,
75 PP_LogLevel log_level,
76 PP_Var value) = 0;
77 virtual void LogWithSource(PP_Instance instance,
78 PP_LogLevel log_level,
79 PP_Var source,
80 PP_Var value) = 0;
82 // Find.
83 virtual void SetPluginToHandleFindRequests(PP_Instance instance) = 0;
84 virtual void NumberOfFindResultsChanged(PP_Instance instance,
85 int32_t total,
86 PP_Bool final_result) = 0;
87 virtual void SelectedFindResultChanged(PP_Instance instance,
88 int32_t index) = 0;
89 virtual void SetTickmarks(PP_Instance instance,
90 const PP_Rect* tickmarks,
91 uint32_t count) = 0;
93 // Fullscreen.
94 virtual PP_Bool IsFullscreen(PP_Instance instance) = 0;
95 virtual PP_Bool SetFullscreen(PP_Instance instance,
96 PP_Bool fullscreen) = 0;
97 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) = 0;
99 // This is an implementation-only function which grabs an instance of a
100 // "singleton resource". These are used to implement instance interfaces
101 // (functions which are associated with the instance itself as opposed to a
102 // resource).
103 virtual Resource* GetSingletonResource(
104 PP_Instance instance, SingletonResourceID id) = 0;
106 // InputEvent.
107 virtual int32_t RequestInputEvents(PP_Instance instance,
108 uint32_t event_classes) = 0;
109 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
110 uint32_t event_classes) = 0;
111 virtual void ClearInputEventRequest(PP_Instance instance,
112 uint32_t event_classes) = 0;
114 // Messaging.
115 virtual void PostMessage(PP_Instance instance, PP_Var message) = 0;
116 virtual int32_t RegisterMessageHandler(PP_Instance instance,
117 void* user_data,
118 const PPP_MessageHandler_0_2* handler,
119 PP_Resource message_loop) = 0;
120 virtual void UnregisterMessageHandler(PP_Instance instance) = 0;
122 // Mouse cursor.
123 virtual PP_Bool SetCursor(PP_Instance instance,
124 PP_MouseCursor_Type type,
125 PP_Resource image,
126 const PP_Point* hot_spot) = 0;
128 // MouseLock.
129 virtual int32_t LockMouse(PP_Instance instance,
130 scoped_refptr<TrackedCallback> callback) = 0;
131 virtual void UnlockMouse(PP_Instance instance) = 0;
133 // TextInput.
134 virtual void SetTextInputType(PP_Instance instance,
135 PP_TextInput_Type type) = 0;
136 virtual void UpdateCaretPosition(PP_Instance instance,
137 const PP_Rect& caret,
138 const PP_Rect& bounding_box) = 0;
139 virtual void CancelCompositionText(PP_Instance instance) = 0;
140 virtual void SelectionChanged(PP_Instance instance) = 0;
141 virtual void UpdateSurroundingText(PP_Instance instance,
142 const char* text,
143 uint32_t caret,
144 uint32_t anchor) = 0;
146 // Testing and URLUtil.
147 virtual PP_Var GetDocumentURL(PP_Instance instance,
148 PP_URLComponents_Dev* components) = 0;
149 #if !defined(OS_NACL)
150 // Content Decryptor.
151 virtual void PromiseResolved(PP_Instance instance, uint32 promise_id) = 0;
152 virtual void PromiseResolvedWithSession(PP_Instance instance,
153 uint32 promise_id,
154 PP_Var session_id_var) = 0;
155 virtual void PromiseRejected(PP_Instance instance,
156 uint32 promise_id,
157 PP_CdmExceptionCode exception_code,
158 uint32 system_code,
159 PP_Var error_description_var) = 0;
160 virtual void SessionMessage(PP_Instance instance,
161 PP_Var session_id_var,
162 PP_CdmMessageType message_type,
163 PP_Var message_var,
164 PP_Var legacy_destination_url_var) = 0;
165 virtual void SessionKeysChange(
166 PP_Instance instance,
167 PP_Var session_id_var,
168 PP_Bool has_additional_usable_key,
169 uint32_t key_count,
170 const struct PP_KeyInformation key_information[]) = 0;
171 virtual void SessionExpirationChange(PP_Instance instance,
172 PP_Var session_id_var,
173 PP_Time new_expiry_time) = 0;
174 virtual void SessionClosed(PP_Instance instance, PP_Var session_id_var) = 0;
175 virtual void LegacySessionError(PP_Instance instance,
176 PP_Var 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_