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