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_text_input_dev.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/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/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.
31 struct PP_DecryptedBlockInfo
;
32 struct PP_DecryptedFrameInfo
;
37 class TrackedCallback
;
44 class PPB_Instance_API
{
46 virtual ~PPB_Instance_API() {}
48 virtual PP_Bool
BindGraphics(PP_Instance instance
, PP_Resource device
) = 0;
49 virtual PP_Bool
IsFullFrame(PP_Instance instance
) = 0;
51 // Unexposed PPAPI functions for proxying.
52 // Returns the internal view data struct.
53 virtual const ViewData
* GetViewData(PP_Instance instance
) = 0;
54 // Returns the flash fullscreen status.
55 virtual PP_Bool
FlashIsFullscreen(PP_Instance instance
) = 0;
58 virtual PP_Var
GetWindowObject(PP_Instance instance
) = 0;
59 virtual PP_Var
GetOwnerElementObject(PP_Instance instance
) = 0;
60 virtual PP_Var
ExecuteScript(PP_Instance instance
,
62 PP_Var
* exception
) = 0;
65 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance
) = 0;
66 virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance
) = 0;
69 virtual PP_Var
GetDefaultCharSet(PP_Instance instance
) = 0;
72 virtual void Log(PP_Instance instance
,
73 PP_LogLevel log_level
,
75 virtual void LogWithSource(PP_Instance instance
,
76 PP_LogLevel log_level
,
81 virtual void NumberOfFindResultsChanged(PP_Instance instance
,
83 PP_Bool final_result
) = 0;
84 virtual void SelectedFindResultChanged(PP_Instance instance
,
88 virtual PP_Bool
SetFullscreen(PP_Instance instance
,
89 PP_Bool fullscreen
) = 0;
90 virtual PP_Bool
GetScreenSize(PP_Instance instance
, PP_Size
* size
) = 0;
92 // This is an implementation-only function which grabs an instance of a
93 // "singleton resource". These are used to implement instance interfaces
94 // (functions which are associated with the instance itself as opposed to a
96 virtual Resource
* GetSingletonResource(
97 PP_Instance instance
, SingletonResourceID id
) = 0;
100 virtual int32_t RequestInputEvents(PP_Instance instance
,
101 uint32_t event_classes
) = 0;
102 virtual int32_t RequestFilteringInputEvents(PP_Instance instance
,
103 uint32_t event_classes
) = 0;
104 virtual void ClearInputEventRequest(PP_Instance instance
,
105 uint32_t event_classes
) = 0;
108 virtual void PostMessage(PP_Instance instance
, PP_Var message
) = 0;
111 virtual PP_Bool
SetCursor(PP_Instance instance
,
112 PP_MouseCursor_Type type
,
114 const PP_Point
* hot_spot
) = 0;
117 virtual int32_t LockMouse(PP_Instance instance
,
118 scoped_refptr
<TrackedCallback
> callback
) = 0;
119 virtual void UnlockMouse(PP_Instance instance
) = 0;
122 virtual void SetTextInputType(PP_Instance instance
,
123 PP_TextInput_Type type
) = 0;
124 virtual void UpdateCaretPosition(PP_Instance instance
,
125 const PP_Rect
& caret
,
126 const PP_Rect
& bounding_box
) = 0;
127 virtual void CancelCompositionText(PP_Instance instance
) = 0;
128 virtual void SelectionChanged(PP_Instance instance
) = 0;
129 virtual void UpdateSurroundingText(PP_Instance instance
,
132 uint32_t anchor
) = 0;
135 virtual void ZoomChanged(PP_Instance instance
, double factor
) = 0;
136 virtual void ZoomLimitsChanged(PP_Instance instance
,
137 double minimum_factor
,
138 double maximium_factor
) = 0;
139 // Testing and URLUtil.
140 virtual PP_Var
GetDocumentURL(PP_Instance instance
,
141 PP_URLComponents_Dev
* components
) = 0;
142 #if !defined(OS_NACL)
143 // Content Decryptor.
144 virtual void NeedKey(PP_Instance instance
,
147 PP_Var init_data
) = 0;
148 virtual void KeyAdded(PP_Instance instance
,
150 PP_Var session_id
) = 0;
151 virtual void KeyMessage(PP_Instance instance
,
155 PP_Var default_url
) = 0;
156 virtual void KeyError(PP_Instance instance
,
160 int32_t system_error
) = 0;
161 virtual void DeliverBlock(PP_Instance instance
,
162 PP_Resource decrypted_block
,
163 const PP_DecryptedBlockInfo
* block_info
) = 0;
164 virtual void DecoderInitializeDone(PP_Instance instance
,
165 PP_DecryptorStreamType decoder_type
,
167 PP_Bool success
) = 0;
168 virtual void DecoderDeinitializeDone(PP_Instance instance
,
169 PP_DecryptorStreamType decoder_type
,
170 uint32_t request_id
) = 0;
171 virtual void DecoderResetDone(PP_Instance instance
,
172 PP_DecryptorStreamType decoder_type
,
173 uint32_t request_id
) = 0;
174 virtual void DeliverFrame(PP_Instance instance
,
175 PP_Resource decrypted_frame
,
176 const PP_DecryptedFrameInfo
* frame_info
) = 0;
177 virtual void DeliverSamples(PP_Instance instance
,
178 PP_Resource audio_frames
,
179 const PP_DecryptedBlockInfo
* block_info
) = 0;
182 virtual PP_Var
ResolveRelativeToDocument(
183 PP_Instance instance
,
185 PP_URLComponents_Dev
* components
) = 0;
186 virtual PP_Bool
DocumentCanRequest(PP_Instance instance
, PP_Var url
) = 0;
187 virtual PP_Bool
DocumentCanAccessDocument(PP_Instance instance
,
188 PP_Instance target
) = 0;
189 virtual PP_Var
GetPluginInstanceURL(PP_Instance instance
,
190 PP_URLComponents_Dev
* components
) = 0;
191 #endif // !defined(OS_NACL)
193 static const ApiID kApiID
= API_ID_PPB_INSTANCE
;
199 #endif // PPAPI_THUNK_INSTANCE_API_H_