[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] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 21 | #include "ppapi/c/private/ppb_instance_private.h" |
[email protected] | ac4b54d | 2011-10-20 23:09:28 | [diff] [blame] | 22 | #include "ppapi/shared_impl/api_id.h" |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 23 | |
[email protected] | 0f41c01 | 2011-10-21 19:49:20 | [diff] [blame] | 24 | // Windows headers interfere with this file. |
| 25 | #ifdef PostMessage |
| 26 | #undef PostMessage |
| 27 | #endif |
| 28 | |
[email protected] | 98ad978 | 2012-08-22 04:06:22 | [diff] [blame] | 29 | struct PP_DecryptedBlockInfo; |
[email protected] | 181d9c1 | 2012-10-03 22:53:48 | [diff] [blame] | 30 | struct PP_DecryptedFrameInfo; |
[email protected] | 98ad978 | 2012-08-22 04:06:22 | [diff] [blame] | 31 | |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 32 | namespace ppapi { |
[email protected] | e8f07ac | 2012-01-03 17:43:36 | [diff] [blame] | 33 | |
[email protected] | aed9653 | 2012-06-23 14:27:42 | [diff] [blame] | 34 | class TrackedCallback; |
[email protected] | e8f07ac | 2012-01-03 17:43:36 | [diff] [blame] | 35 | struct ViewData; |
| 36 | |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 37 | namespace thunk { |
| 38 | |
[email protected] | a085aed7 | 2012-04-24 05:32:04 | [diff] [blame] | 39 | class PPB_Flash_API; |
[email protected] | 11d0c36 | 2012-10-11 02:02:11 | [diff] [blame^] | 40 | class PPB_Flash_Functions_API; |
[email protected] | f511881 | 2012-08-24 19:54:30 | [diff] [blame] | 41 | class PPB_Gamepad_API; |
[email protected] | a085aed7 | 2012-04-24 05:32:04 | [diff] [blame] | 42 | |
[email protected] | 4f200612 | 2012-04-30 05:13:17 | [diff] [blame] | 43 | class PPB_Instance_API { |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 44 | public: |
[email protected] | 4f200612 | 2012-04-30 05:13:17 | [diff] [blame] | 45 | virtual ~PPB_Instance_API() {} |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 46 | |
| 47 | virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) = 0; |
| 48 | virtual PP_Bool IsFullFrame(PP_Instance instance) = 0; |
| 49 | |
[email protected] | e8f07ac | 2012-01-03 17:43:36 | [diff] [blame] | 50 | // Not an exposed PPAPI function, this returns the internal view data struct. |
| 51 | virtual const ViewData* GetViewData(PP_Instance instance) = 0; |
| 52 | |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 53 | // InstancePrivate. |
| 54 | virtual PP_Var GetWindowObject(PP_Instance instance) = 0; |
| 55 | virtual PP_Var GetOwnerElementObject(PP_Instance instance) = 0; |
| 56 | virtual PP_Var ExecuteScript(PP_Instance instance, |
| 57 | PP_Var script, |
| 58 | PP_Var* exception) = 0; |
| 59 | |
[email protected] | c59ed589 | 2012-02-18 01:10:19 | [diff] [blame] | 60 | // Audio. |
| 61 | virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance) = 0; |
| 62 | virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance) = 0; |
| 63 | |
[email protected] | 8d770e49 | 2011-10-11 04:54:31 | [diff] [blame] | 64 | // CharSet. |
| 65 | virtual PP_Var GetDefaultCharSet(PP_Instance instance) = 0; |
| 66 | |
[email protected] | 5c96602 | 2011-09-13 18:09:37 | [diff] [blame] | 67 | // Console. |
| 68 | virtual void Log(PP_Instance instance, |
[email protected] | a9b16dd | 2012-01-31 05:00:26 | [diff] [blame] | 69 | PP_LogLevel_Dev log_level, |
[email protected] | 5c96602 | 2011-09-13 18:09:37 | [diff] [blame] | 70 | PP_Var value) = 0; |
| 71 | virtual void LogWithSource(PP_Instance instance, |
[email protected] | a9b16dd | 2012-01-31 05:00:26 | [diff] [blame] | 72 | PP_LogLevel_Dev log_level, |
[email protected] | 5c96602 | 2011-09-13 18:09:37 | [diff] [blame] | 73 | PP_Var source, |
| 74 | PP_Var value) = 0; |
| 75 | |
[email protected] | 59cf702 | 2011-09-14 22:44:19 | [diff] [blame] | 76 | // Find. |
| 77 | virtual void NumberOfFindResultsChanged(PP_Instance instance, |
| 78 | int32_t total, |
| 79 | PP_Bool final_result) = 0; |
| 80 | virtual void SelectedFindResultChanged(PP_Instance instance, |
| 81 | int32_t index) = 0; |
| 82 | |
[email protected] | 7a26d92e | 2012-02-17 20:15:25 | [diff] [blame] | 83 | // Font. |
| 84 | virtual PP_Var GetFontFamilies(PP_Instance instance) = 0; |
| 85 | |
[email protected] | 557730a | 2011-10-05 18:03:38 | [diff] [blame] | 86 | // Fullscreen. |
[email protected] | 06e0a34 | 2011-09-27 04:24:30 | [diff] [blame] | 87 | virtual PP_Bool SetFullscreen(PP_Instance instance, |
| 88 | PP_Bool fullscreen) = 0; |
| 89 | virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) = 0; |
| 90 | |
[email protected] | 11d0c36 | 2012-10-11 02:02:11 | [diff] [blame^] | 91 | // Flash (Deprecated for Flash_Functions). |
[email protected] | a085aed7 | 2012-04-24 05:32:04 | [diff] [blame] | 92 | virtual PPB_Flash_API* GetFlashAPI() = 0; |
[email protected] | 11d0c36 | 2012-10-11 02:02:11 | [diff] [blame^] | 93 | // Flash_Functions |
| 94 | virtual PPB_Flash_Functions_API* GetFlashFunctionsAPI( |
| 95 | PP_Instance instance) = 0; |
[email protected] | cb4fdad | 2011-06-27 22:25:29 | [diff] [blame] | 96 | |
[email protected] | 0a424af | 2012-01-10 19:24:28 | [diff] [blame] | 97 | // Gamepad. |
[email protected] | f511881 | 2012-08-24 19:54:30 | [diff] [blame] | 98 | virtual PPB_Gamepad_API* GetGamepadAPI(PP_Instance instance) = 0; |
[email protected] | 0a424af | 2012-01-10 19:24:28 | [diff] [blame] | 99 | |
[email protected] | 493d1421 | 2011-07-07 15:38:48 | [diff] [blame] | 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; |
[email protected] | 3b98ced7 | 2012-03-09 02:08:33 | [diff] [blame] | 107 | virtual void ClosePendingUserGesture(PP_Instance instance, |
| 108 | PP_TimeTicks timestamp) = 0; |
[email protected] | 493d1421 | 2011-07-07 15:38:48 | [diff] [blame] | 109 | |
[email protected] | 55a5a52 | 2011-07-06 22:52:40 | [diff] [blame] | 110 | // Messaging. |
| 111 | virtual void PostMessage(PP_Instance instance, PP_Var message) = 0; |
| 112 | |
[email protected] | 33ec5056 | 2012-04-08 20:28:43 | [diff] [blame] | 113 | // Mouse cursor. |
| 114 | virtual PP_Bool SetCursor(PP_Instance instance, |
| 115 | PP_MouseCursor_Type type, |
[email protected] | c6da0bcc | 2012-04-11 23:10:36 | [diff] [blame] | 116 | PP_Resource image, |
| 117 | const PP_Point* hot_spot) = 0; |
[email protected] | 33ec5056 | 2012-04-08 20:28:43 | [diff] [blame] | 118 | |
[email protected] | 18d871f | 2011-09-08 16:56:34 | [diff] [blame] | 119 | // MouseLock. |
| 120 | virtual int32_t LockMouse(PP_Instance instance, |
[email protected] | aed9653 | 2012-06-23 14:27:42 | [diff] [blame] | 121 | scoped_refptr<TrackedCallback> callback) = 0; |
[email protected] | 18d871f | 2011-09-08 16:56:34 | [diff] [blame] | 122 | virtual void UnlockMouse(PP_Instance instance) = 0; |
| 123 | |
[email protected] | 4c44183a | 2012-04-27 16:52:23 | [diff] [blame] | 124 | // TextInput. |
| 125 | virtual void SetTextInputType(PP_Instance instance, |
| 126 | PP_TextInput_Type type) = 0; |
| 127 | virtual void UpdateCaretPosition(PP_Instance instance, |
| 128 | const PP_Rect& caret, |
| 129 | const PP_Rect& bounding_box) = 0; |
| 130 | virtual void CancelCompositionText(PP_Instance instance) = 0; |
| 131 | virtual void SelectionChanged(PP_Instance instance) = 0; |
| 132 | virtual void UpdateSurroundingText(PP_Instance instance, |
| 133 | const char* text, |
| 134 | uint32_t caret, |
| 135 | uint32_t anchor) = 0; |
| 136 | |
[email protected] | 1523794 | 2011-07-30 04:24:19 | [diff] [blame] | 137 | // Zoom. |
[email protected] | 55a5a52 | 2011-07-06 22:52:40 | [diff] [blame] | 138 | virtual void ZoomChanged(PP_Instance instance, double factor) = 0; |
| 139 | virtual void ZoomLimitsChanged(PP_Instance instance, |
| 140 | double minimum_factor, |
| 141 | double maximium_factor) = 0; |
[email protected] | c962f86 | 2012-04-12 00:02:04 | [diff] [blame] | 142 | #if !defined(OS_NACL) |
[email protected] | e5aeef0 | 2012-08-17 00:18:43 | [diff] [blame] | 143 | // Content Decryptor. |
| 144 | virtual void NeedKey(PP_Instance instance, |
| 145 | PP_Var key_system, |
| 146 | PP_Var session_id, |
| 147 | PP_Var init_data) = 0; |
| 148 | virtual void KeyAdded(PP_Instance instance, |
| 149 | PP_Var key_system, |
| 150 | PP_Var session_id) = 0; |
| 151 | virtual void KeyMessage(PP_Instance instance, |
| 152 | PP_Var key_system, |
| 153 | PP_Var session_id, |
| 154 | PP_Resource message, |
| 155 | PP_Var default_url) = 0; |
| 156 | virtual void KeyError(PP_Instance instance, |
| 157 | PP_Var key_system, |
| 158 | PP_Var session_id, |
| 159 | int32_t media_error, |
| 160 | int32_t system_error) = 0; |
| 161 | virtual void DeliverBlock(PP_Instance instance, |
| 162 | PP_Resource decrypted_block, |
[email protected] | 98ad978 | 2012-08-22 04:06:22 | [diff] [blame] | 163 | const PP_DecryptedBlockInfo* block_info) = 0; |
[email protected] | e5aeef0 | 2012-08-17 00:18:43 | [diff] [blame] | 164 | virtual void DeliverFrame(PP_Instance instance, |
| 165 | PP_Resource decrypted_frame, |
[email protected] | 181d9c1 | 2012-10-03 22:53:48 | [diff] [blame] | 166 | const PP_DecryptedFrameInfo* frame_info) = 0; |
[email protected] | e5aeef0 | 2012-08-17 00:18:43 | [diff] [blame] | 167 | virtual void DeliverSamples(PP_Instance instance, |
| 168 | PP_Resource decrypted_samples, |
[email protected] | 98ad978 | 2012-08-22 04:06:22 | [diff] [blame] | 169 | const PP_DecryptedBlockInfo* block_info) = 0; |
[email protected] | e5aeef0 | 2012-08-17 00:18:43 | [diff] [blame] | 170 | |
[email protected] | 0346023 | 2011-10-10 17:23:57 | [diff] [blame] | 171 | // URLUtil. |
| 172 | virtual PP_Var ResolveRelativeToDocument( |
| 173 | PP_Instance instance, |
| 174 | PP_Var relative, |
| 175 | PP_URLComponents_Dev* components) = 0; |
| 176 | virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) = 0; |
| 177 | virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, |
| 178 | PP_Instance target) = 0; |
| 179 | virtual PP_Var GetDocumentURL(PP_Instance instance, |
| 180 | PP_URLComponents_Dev* components) = 0; |
| 181 | virtual PP_Var GetPluginInstanceURL(PP_Instance instance, |
| 182 | PP_URLComponents_Dev* components) = 0; |
[email protected] | c962f86 | 2012-04-12 00:02:04 | [diff] [blame] | 183 | #endif // !defined(OS_NACL) |
[email protected] | 0346023 | 2011-10-10 17:23:57 | [diff] [blame] | 184 | |
[email protected] | ac4b54d | 2011-10-20 23:09:28 | [diff] [blame] | 185 | static const ApiID kApiID = API_ID_PPB_INSTANCE; |
[email protected] | ceadc39 | 2011-06-15 23:04:24 | [diff] [blame] | 186 | }; |
| 187 | |
| 188 | } // namespace thunk |
| 189 | } // namespace ppapi |
| 190 | |
| 191 | #endif // PPAPI_THUNK_INSTANCE_API_H_ |