Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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. |
| 4 | |
| 5 | #ifndef PPAPI_THUNK_INSTANCE_API_H_ |
| 6 | #define PPAPI_THUNK_INSTANCE_API_H_ |
| 7 | |
| 8 | #include "base/memory/ref_counted.h" |
| 9 | #include "base/memory/scoped_ptr.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 14 | #include "ppapi/c/ppb_audio_config.h" |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 15 | #include "ppapi/c/ppb_console.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 16 | #include "ppapi/c/ppb_gamepad.h" |
| 17 | #include "ppapi/c/ppb_instance.h" |
| 18 | #include "ppapi/c/ppb_mouse_cursor.h" |
Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 19 | #include "ppapi/c/ppb_text_input_controller.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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" |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 23 | #include "ppapi/shared_impl/resource.h" |
| 24 | #include "ppapi/shared_impl/singleton_resource_id.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 25 | |
| 26 | // Windows headers interfere with this file. |
| 27 | #ifdef PostMessage |
| 28 | #undef PostMessage |
| 29 | #endif |
| 30 | |
| 31 | struct PP_DecryptedBlockInfo; |
| 32 | struct PP_DecryptedFrameInfo; |
| 33 | |
| 34 | namespace ppapi { |
| 35 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 36 | class Resource; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 37 | class TrackedCallback; |
| 38 | struct ViewData; |
| 39 | |
| 40 | namespace thunk { |
| 41 | |
| 42 | class PPB_Flash_API; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 43 | |
| 44 | class PPB_Instance_API { |
| 45 | public: |
| 46 | virtual ~PPB_Instance_API() {} |
| 47 | |
| 48 | virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) = 0; |
| 49 | virtual PP_Bool IsFullFrame(PP_Instance instance) = 0; |
| 50 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 51 | // Unexposed PPAPI functions for proxying. |
| 52 | // Returns the internal view data struct. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 53 | virtual const ViewData* GetViewData(PP_Instance instance) = 0; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 54 | // Returns the flash fullscreen status. |
| 55 | virtual PP_Bool FlashIsFullscreen(PP_Instance instance) = 0; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 56 | |
| 57 | // InstancePrivate. |
| 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, |
| 61 | PP_Var script, |
| 62 | PP_Var* exception) = 0; |
| 63 | |
| 64 | // Audio. |
| 65 | virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance) = 0; |
| 66 | virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance) = 0; |
| 67 | |
| 68 | // CharSet. |
| 69 | virtual PP_Var GetDefaultCharSet(PP_Instance instance) = 0; |
| 70 | |
| 71 | // Console. |
| 72 | virtual void Log(PP_Instance instance, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 73 | PP_LogLevel log_level, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 74 | PP_Var value) = 0; |
| 75 | virtual void LogWithSource(PP_Instance instance, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 76 | PP_LogLevel log_level, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 77 | PP_Var source, |
| 78 | PP_Var value) = 0; |
| 79 | |
| 80 | // Find. |
| 81 | virtual void NumberOfFindResultsChanged(PP_Instance instance, |
| 82 | int32_t total, |
| 83 | PP_Bool final_result) = 0; |
| 84 | virtual void SelectedFindResultChanged(PP_Instance instance, |
| 85 | int32_t index) = 0; |
| 86 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 87 | // Fullscreen. |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 88 | virtual PP_Bool IsFullscreen(PP_Instance instance) = 0; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 89 | virtual PP_Bool SetFullscreen(PP_Instance instance, |
| 90 | PP_Bool fullscreen) = 0; |
| 91 | virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) = 0; |
| 92 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 93 | // This is an implementation-only function which grabs an instance of a |
| 94 | // "singleton resource". These are used to implement instance interfaces |
| 95 | // (functions which are associated with the instance itself as opposed to a |
| 96 | // resource). |
| 97 | virtual Resource* GetSingletonResource( |
| 98 | PP_Instance instance, SingletonResourceID id) = 0; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 99 | |
| 100 | // InputEvent. |
| 101 | virtual int32_t RequestInputEvents(PP_Instance instance, |
| 102 | uint32_t event_classes) = 0; |
| 103 | virtual int32_t RequestFilteringInputEvents(PP_Instance instance, |
| 104 | uint32_t event_classes) = 0; |
| 105 | virtual void ClearInputEventRequest(PP_Instance instance, |
| 106 | uint32_t event_classes) = 0; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 107 | |
| 108 | // Messaging. |
| 109 | virtual void PostMessage(PP_Instance instance, PP_Var message) = 0; |
| 110 | |
| 111 | // Mouse cursor. |
| 112 | virtual PP_Bool SetCursor(PP_Instance instance, |
| 113 | PP_MouseCursor_Type type, |
| 114 | PP_Resource image, |
| 115 | const PP_Point* hot_spot) = 0; |
| 116 | |
| 117 | // MouseLock. |
| 118 | virtual int32_t LockMouse(PP_Instance instance, |
| 119 | scoped_refptr<TrackedCallback> callback) = 0; |
| 120 | virtual void UnlockMouse(PP_Instance instance) = 0; |
| 121 | |
| 122 | // TextInput. |
| 123 | virtual void SetTextInputType(PP_Instance instance, |
| 124 | PP_TextInput_Type type) = 0; |
| 125 | virtual void UpdateCaretPosition(PP_Instance instance, |
| 126 | const PP_Rect& caret, |
| 127 | const PP_Rect& bounding_box) = 0; |
| 128 | virtual void CancelCompositionText(PP_Instance instance) = 0; |
| 129 | virtual void SelectionChanged(PP_Instance instance) = 0; |
| 130 | virtual void UpdateSurroundingText(PP_Instance instance, |
| 131 | const char* text, |
| 132 | uint32_t caret, |
| 133 | uint32_t anchor) = 0; |
| 134 | |
| 135 | // Zoom. |
| 136 | virtual void ZoomChanged(PP_Instance instance, double factor) = 0; |
| 137 | virtual void ZoomLimitsChanged(PP_Instance instance, |
| 138 | double minimum_factor, |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 139 | double maximum_factor) = 0; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 140 | // Testing and URLUtil. |
| 141 | virtual PP_Var GetDocumentURL(PP_Instance instance, |
| 142 | PP_URLComponents_Dev* components) = 0; |
| 143 | #if !defined(OS_NACL) |
| 144 | // Content Decryptor. |
| 145 | virtual void NeedKey(PP_Instance instance, |
| 146 | PP_Var key_system, |
| 147 | PP_Var session_id, |
| 148 | PP_Var init_data) = 0; |
| 149 | virtual void KeyAdded(PP_Instance instance, |
| 150 | PP_Var key_system, |
| 151 | PP_Var session_id) = 0; |
| 152 | virtual void KeyMessage(PP_Instance instance, |
| 153 | PP_Var key_system, |
| 154 | PP_Var session_id, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 155 | PP_Var message, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 156 | PP_Var default_url) = 0; |
| 157 | virtual void KeyError(PP_Instance instance, |
| 158 | PP_Var key_system, |
| 159 | PP_Var session_id, |
| 160 | int32_t media_error, |
| 161 | int32_t system_error) = 0; |
| 162 | virtual void DeliverBlock(PP_Instance instance, |
| 163 | PP_Resource decrypted_block, |
| 164 | const PP_DecryptedBlockInfo* block_info) = 0; |
| 165 | virtual void DecoderInitializeDone(PP_Instance instance, |
| 166 | PP_DecryptorStreamType decoder_type, |
| 167 | uint32_t request_id, |
| 168 | PP_Bool success) = 0; |
| 169 | virtual void DecoderDeinitializeDone(PP_Instance instance, |
| 170 | PP_DecryptorStreamType decoder_type, |
| 171 | uint32_t request_id) = 0; |
| 172 | virtual void DecoderResetDone(PP_Instance instance, |
| 173 | PP_DecryptorStreamType decoder_type, |
| 174 | uint32_t request_id) = 0; |
| 175 | virtual void DeliverFrame(PP_Instance instance, |
| 176 | PP_Resource decrypted_frame, |
| 177 | const PP_DecryptedFrameInfo* frame_info) = 0; |
| 178 | virtual void DeliverSamples(PP_Instance instance, |
| 179 | PP_Resource audio_frames, |
| 180 | const PP_DecryptedBlockInfo* block_info) = 0; |
| 181 | |
| 182 | // URLUtil. |
| 183 | virtual PP_Var ResolveRelativeToDocument( |
| 184 | PP_Instance instance, |
| 185 | PP_Var relative, |
| 186 | PP_URLComponents_Dev* components) = 0; |
| 187 | virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) = 0; |
| 188 | virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, |
| 189 | PP_Instance target) = 0; |
| 190 | virtual PP_Var GetPluginInstanceURL(PP_Instance instance, |
| 191 | PP_URLComponents_Dev* components) = 0; |
| 192 | #endif // !defined(OS_NACL) |
| 193 | |
| 194 | static const ApiID kApiID = API_ID_PPB_INSTANCE; |
| 195 | }; |
| 196 | |
| 197 | } // namespace thunk |
| 198 | } // namespace ppapi |
| 199 | |
| 200 | #endif // PPAPI_THUNK_INSTANCE_API_H_ |