[email protected] | 0a424af | 2012-01-10 19:24:28 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 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 | |
[email protected] | aed9653 | 2012-06-23 14:27:42 | [diff] [blame] | 8 | #include "base/memory/ref_counted.h" |
| 9 | #include "base/memory/scoped_ptr.h" |
[email protected] | a9b16dd | 2012-01-31 05:00:26 | [diff] [blame] | 10 | #include "ppapi/c/dev/ppb_console_dev.h" |
[email protected] | 4c44183a | 2012-04-27 16:52:23 | [diff] [blame] | 11 | #include "ppapi/c/dev/ppb_text_input_dev.h" |
[email protected] | 0346023 | 2011-10-10 17:23:57 | [diff] [blame] | 12 | #include "ppapi/c/dev/ppb_url_util_dev.h" |
[email protected] | 3b98ced7 | 2012-03-09 02:08:33 | [diff] [blame] | 13 | #include "ppapi/c/pp_bool.h" |
[email protected] | 18d871f | 2011-09-08 16:56:34 | [diff] [blame] | 14 | #include "ppapi/c/pp_completion_callback.h" |
[email protected] | 3b98ced7 | 2012-03-09 02:08:33 | [diff] [blame] | 15 | #include "ppapi/c/pp_size.h" |
| 16 | #include "ppapi/c/pp_time.h" |
[email protected] | c59ed589 | 2012-02-18 01:10:19 | [diff] [blame] | 17 | #include "ppapi/c/ppb_audio_config.h" |
[email protected] | d5cc719 | 2012-03-07 16:53:16 | [diff] [blame] | 18 | #include "ppapi/c/ppb_gamepad.h" |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 19 | #include "ppapi/c/ppb_instance.h" |
[email protected] | 33ec5056 | 2012-04-08 20:28:43 | [diff] [blame] | 20 | #include "ppapi/c/ppb_mouse_cursor.h" |
[email protected] | 23de8745 | 2012-10-12 07:03:09 | [diff] [blame^] | 21 | #include "ppapi/c/private/pp_content_decryptor.h" |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 22 | #include "ppapi/c/private/ppb_instance_private.h" |
[email protected] | ac4b54d | 2011-10-20 23:09:28 | [diff] [blame] | 23 | #include "ppapi/shared_impl/api_id.h" |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 24 | |
[email protected] | 0f41c01 | 2011-10-21 19:49:20 | [diff] [blame] | 25 | // Windows headers interfere with this file. |
| 26 | #ifdef PostMessage |
| 27 | #undef PostMessage |
| 28 | #endif |
| 29 | |
[email protected] | 98ad978 | 2012-08-22 04:06:22 | [diff] [blame] | 30 | struct PP_DecryptedBlockInfo; |
[email protected] | 181d9c1 | 2012-10-03 22:53:48 | [diff] [blame] | 31 | struct PP_DecryptedFrameInfo; |
[email protected] | 98ad978 | 2012-08-22 04:06:22 | [diff] [blame] | 32 | |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 33 | namespace ppapi { |
[email protected] | e8f07ac | 2012-01-03 17:43:36 | [diff] [blame] | 34 | |
[email protected] | aed9653 | 2012-06-23 14:27:42 | [diff] [blame] | 35 | class TrackedCallback; |
[email protected] | e8f07ac | 2012-01-03 17:43:36 | [diff] [blame] | 36 | struct ViewData; |
| 37 | |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 38 | namespace thunk { |
| 39 | |
[email protected] | a085aed7 | 2012-04-24 05:32:04 | [diff] [blame] | 40 | class PPB_Flash_API; |
[email protected] | 11d0c36 | 2012-10-11 02:02:11 | [diff] [blame] | 41 | class PPB_Flash_Functions_API; |
[email protected] | f511881 | 2012-08-24 19:54:30 | [diff] [blame] | 42 | class PPB_Gamepad_API; |
[email protected] | a085aed7 | 2012-04-24 05:32:04 | [diff] [blame] | 43 | |
[email protected] | 4f200612 | 2012-04-30 05:13:17 | [diff] [blame] | 44 | class PPB_Instance_API { |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 45 | public: |
[email protected] | 4f200612 | 2012-04-30 05:13:17 | [diff] [blame] | 46 | virtual ~PPB_Instance_API() {} |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 47 | |
| 48 | virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) = 0; |
| 49 | virtual PP_Bool IsFullFrame(PP_Instance instance) = 0; |
| 50 | |
[email protected] | e8f07ac | 2012-01-03 17:43:36 | [diff] [blame] | 51 | // Not an exposed PPAPI function, this returns the internal view data struct. |
| 52 | virtual const ViewData* GetViewData(PP_Instance instance) = 0; |
| 53 | |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 54 | // InstancePrivate. |
| 55 | virtual PP_Var GetWindowObject(PP_Instance instance) = 0; |
| 56 | virtual PP_Var GetOwnerElementObject(PP_Instance instance) = 0; |
| 57 | virtual PP_Var ExecuteScript(PP_Instance instance, |
| 58 | PP_Var script, |
| 59 | PP_Var* exception) = 0; |
| 60 | |
[email protected] | c59ed589 | 2012-02-18 01:10:19 | [diff] [blame] | 61 | // Audio. |
| 62 | virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance) = 0; |
| 63 | virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance) = 0; |
| 64 | |
[email protected] | 8d770e49 | 2011-10-11 04:54:31 | [diff] [blame] | 65 | // CharSet. |
| 66 | virtual PP_Var GetDefaultCharSet(PP_Instance instance) = 0; |
| 67 | |
[email protected] | 5c96602 | 2011-09-13 18:09:37 | [diff] [blame] | 68 | // Console. |
| 69 | virtual void Log(PP_Instance instance, |
[email protected] | a9b16dd | 2012-01-31 05:00:26 | [diff] [blame] | 70 | PP_LogLevel_Dev log_level, |
[email protected] | 5c96602 | 2011-09-13 18:09:37 | [diff] [blame] | 71 | PP_Var value) = 0; |
| 72 | virtual void LogWithSource(PP_Instance instance, |
[email protected] | a9b16dd | 2012-01-31 05:00:26 | [diff] [blame] | 73 | PP_LogLevel_Dev log_level, |
[email protected] | 5c96602 | 2011-09-13 18:09:37 | [diff] [blame] | 74 | PP_Var source, |
| 75 | PP_Var value) = 0; |
| 76 | |
[email protected] | 59cf702 | 2011-09-14 22:44:19 | [diff] [blame] | 77 | // Find. |
| 78 | virtual void NumberOfFindResultsChanged(PP_Instance instance, |
| 79 | int32_t total, |
| 80 | PP_Bool final_result) = 0; |
| 81 | virtual void SelectedFindResultChanged(PP_Instance instance, |
| 82 | int32_t index) = 0; |
| 83 | |
[email protected] | 7a26d92e | 2012-02-17 20:15:25 | [diff] [blame] | 84 | // Font. |
| 85 | virtual PP_Var GetFontFamilies(PP_Instance instance) = 0; |
| 86 | |
[email protected] | 557730a | 2011-10-05 18:03:38 | [diff] [blame] | 87 | // Fullscreen. |
[email protected] | 06e0a34 | 2011-09-27 04:24:30 | [diff] [blame] | 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; |
| 91 | |
[email protected] | 11d0c36 | 2012-10-11 02:02:11 | [diff] [blame] | 92 | // Flash (Deprecated for Flash_Functions). |
[email protected] | a085aed7 | 2012-04-24 05:32:04 | [diff] [blame] | 93 | virtual PPB_Flash_API* GetFlashAPI() = 0; |
[email protected] | 11d0c36 | 2012-10-11 02:02:11 | [diff] [blame] | 94 | // Flash_Functions |
| 95 | virtual PPB_Flash_Functions_API* GetFlashFunctionsAPI( |
| 96 | PP_Instance instance) = 0; |
[email protected] | cb4fdad | 2011-06-27 22:25:29 | [diff] [blame] | 97 | |
[email protected] | 0a424af | 2012-01-10 19:24:28 | [diff] [blame] | 98 | // Gamepad. |
[email protected] | f511881 | 2012-08-24 19:54:30 | [diff] [blame] | 99 | virtual PPB_Gamepad_API* GetGamepadAPI(PP_Instance instance) = 0; |
[email protected] | 0a424af | 2012-01-10 19:24:28 | [diff] [blame] | 100 | |
[email protected] | 493d1421 | 2011-07-07 15:38:48 | [diff] [blame] | 101 | // InputEvent. |
| 102 | virtual int32_t RequestInputEvents(PP_Instance instance, |
| 103 | uint32_t event_classes) = 0; |
| 104 | virtual int32_t RequestFilteringInputEvents(PP_Instance instance, |
| 105 | uint32_t event_classes) = 0; |
| 106 | virtual void ClearInputEventRequest(PP_Instance instance, |
| 107 | uint32_t event_classes) = 0; |
[email protected] | 3b98ced7 | 2012-03-09 02:08:33 | [diff] [blame] | 108 | virtual void ClosePendingUserGesture(PP_Instance instance, |
| 109 | PP_TimeTicks timestamp) = 0; |
[email protected] | 493d1421 | 2011-07-07 15:38:48 | [diff] [blame] | 110 | |
[email protected] | 55a5a52 | 2011-07-06 22:52:40 | [diff] [blame] | 111 | // Messaging. |
| 112 | virtual void PostMessage(PP_Instance instance, PP_Var message) = 0; |
| 113 | |
[email protected] | 33ec5056 | 2012-04-08 20:28:43 | [diff] [blame] | 114 | // Mouse cursor. |
| 115 | virtual PP_Bool SetCursor(PP_Instance instance, |
| 116 | PP_MouseCursor_Type type, |
[email protected] | c6da0bcc | 2012-04-11 23:10:36 | [diff] [blame] | 117 | PP_Resource image, |
| 118 | const PP_Point* hot_spot) = 0; |
[email protected] | 33ec5056 | 2012-04-08 20:28:43 | [diff] [blame] | 119 | |
[email protected] | 18d871f | 2011-09-08 16:56:34 | [diff] [blame] | 120 | // MouseLock. |
| 121 | virtual int32_t LockMouse(PP_Instance instance, |
[email protected] | aed9653 | 2012-06-23 14:27:42 | [diff] [blame] | 122 | scoped_refptr<TrackedCallback> callback) = 0; |
[email protected] | 18d871f | 2011-09-08 16:56:34 | [diff] [blame] | 123 | virtual void UnlockMouse(PP_Instance instance) = 0; |
| 124 | |
[email protected] | 4c44183a | 2012-04-27 16:52:23 | [diff] [blame] | 125 | // TextInput. |
| 126 | virtual void SetTextInputType(PP_Instance instance, |
| 127 | PP_TextInput_Type type) = 0; |
| 128 | virtual void UpdateCaretPosition(PP_Instance instance, |
| 129 | const PP_Rect& caret, |
| 130 | const PP_Rect& bounding_box) = 0; |
| 131 | virtual void CancelCompositionText(PP_Instance instance) = 0; |
| 132 | virtual void SelectionChanged(PP_Instance instance) = 0; |
| 133 | virtual void UpdateSurroundingText(PP_Instance instance, |
| 134 | const char* text, |
| 135 | uint32_t caret, |
| 136 | uint32_t anchor) = 0; |
| 137 | |
[email protected] | 1523794 | 2011-07-30 04:24:19 | [diff] [blame] | 138 | // Zoom. |
[email protected] | 55a5a52 | 2011-07-06 22:52:40 | [diff] [blame] | 139 | virtual void ZoomChanged(PP_Instance instance, double factor) = 0; |
| 140 | virtual void ZoomLimitsChanged(PP_Instance instance, |
| 141 | double minimum_factor, |
| 142 | double maximium_factor) = 0; |
[email protected] | c962f86 | 2012-04-12 00:02:04 | [diff] [blame] | 143 | #if !defined(OS_NACL) |
[email protected] | e5aeef0 | 2012-08-17 00:18:43 | [diff] [blame] | 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, |
| 155 | PP_Resource message, |
| 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, |
[email protected] | 98ad978 | 2012-08-22 04:06:22 | [diff] [blame] | 164 | const PP_DecryptedBlockInfo* block_info) = 0; |
[email protected] | e9d3a102 | 2012-10-11 23:43:55 | [diff] [blame] | 165 | virtual void DecoderInitialized(PP_Instance instance, |
| 166 | PP_Bool success, |
| 167 | uint32_t request_id) = 0; |
[email protected] | 23de8745 | 2012-10-12 07:03:09 | [diff] [blame^] | 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; |
[email protected] | e5aeef0 | 2012-08-17 00:18:43 | [diff] [blame] | 174 | virtual void DeliverFrame(PP_Instance instance, |
| 175 | PP_Resource decrypted_frame, |
[email protected] | 181d9c1 | 2012-10-03 22:53:48 | [diff] [blame] | 176 | const PP_DecryptedFrameInfo* frame_info) = 0; |
[email protected] | e5aeef0 | 2012-08-17 00:18:43 | [diff] [blame] | 177 | virtual void DeliverSamples(PP_Instance instance, |
| 178 | PP_Resource decrypted_samples, |
[email protected] | 98ad978 | 2012-08-22 04:06:22 | [diff] [blame] | 179 | const PP_DecryptedBlockInfo* block_info) = 0; |
[email protected] | e5aeef0 | 2012-08-17 00:18:43 | [diff] [blame] | 180 | |
[email protected] | 0346023 | 2011-10-10 17:23:57 | [diff] [blame] | 181 | // URLUtil. |
| 182 | virtual PP_Var ResolveRelativeToDocument( |
| 183 | PP_Instance instance, |
| 184 | PP_Var relative, |
| 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 GetDocumentURL(PP_Instance instance, |
| 190 | PP_URLComponents_Dev* components) = 0; |
| 191 | virtual PP_Var GetPluginInstanceURL(PP_Instance instance, |
| 192 | PP_URLComponents_Dev* components) = 0; |
[email protected] | c962f86 | 2012-04-12 00:02:04 | [diff] [blame] | 193 | #endif // !defined(OS_NACL) |
[email protected] | 0346023 | 2011-10-10 17:23:57 | [diff] [blame] | 194 | |
[email protected] | ac4b54d | 2011-10-20 23:09:28 | [diff] [blame] | 195 | static const ApiID kApiID = API_ID_PPB_INSTANCE; |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 196 | }; |
| 197 | |
| 198 | } // namespace thunk |
| 199 | } // namespace ppapi |
| 200 | |
| 201 | #endif // PPAPI_THUNK_INSTANCE_API_H_ |