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