OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "ppapi/c/pp_array_output.h" | 6 #include "ppapi/c/pp_array_output.h" |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/private/ppb_flash.h" | 8 #include "ppapi/c/private/ppb_flash.h" |
9 #include "ppapi/shared_impl/ppapi_globals.h" | 9 #include "ppapi/shared_impl/ppapi_globals.h" |
10 #include "ppapi/shared_impl/proxy_lock.h" | 10 #include "ppapi/shared_impl/proxy_lock.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 const PP_Point* position, | 34 const PP_Point* position, |
35 const PP_Rect* clip, | 35 const PP_Rect* clip, |
36 const float transformation[3][3], | 36 const float transformation[3][3], |
37 PP_Bool allow_subpixel_aa, | 37 PP_Bool allow_subpixel_aa, |
38 uint32_t glyph_count, | 38 uint32_t glyph_count, |
39 const uint16_t glyph_indices[], | 39 const uint16_t glyph_indices[], |
40 const PP_Point glyph_advances[]) { | 40 const PP_Point glyph_advances[]) { |
41 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); | 41 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
42 if (enter.failed()) | 42 if (enter.failed()) |
43 return PP_FALSE; | 43 return PP_FALSE; |
44 return enter.functions()->DrawGlyphs( | 44 return enter.functions()->DrawGlyphs(instance, |
45 instance, pp_image_data, font_desc, color, position, clip, transformation, | 45 pp_image_data, |
46 allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances); | 46 font_desc, |
| 47 color, |
| 48 position, |
| 49 clip, |
| 50 transformation, |
| 51 allow_subpixel_aa, |
| 52 glyph_count, |
| 53 glyph_indices, |
| 54 glyph_advances); |
47 } | 55 } |
48 | 56 |
49 PP_Var GetProxyForURL(PP_Instance instance, const char* url) { | 57 PP_Var GetProxyForURL(PP_Instance instance, const char* url) { |
50 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); | 58 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
51 if (enter.failed()) | 59 if (enter.failed()) |
52 return PP_MakeUndefined(); | 60 return PP_MakeUndefined(); |
53 return enter.functions()->GetProxyForURL(instance, url); | 61 return enter.functions()->GetProxyForURL(instance, url); |
54 } | 62 } |
55 | 63 |
56 int32_t Navigate(PP_Resource request_id, | 64 int32_t Navigate(PP_Resource request_id, |
57 const char* target, | 65 const char* target, |
58 PP_Bool from_user_action) { | 66 PP_Bool from_user_action) { |
59 // TODO(brettw): this function should take an instance. | 67 // TODO(brettw): this function should take an instance. |
60 // To work around this, use the PP_Instance from the resource. | 68 // To work around this, use the PP_Instance from the resource. |
61 PP_Instance instance; | 69 PP_Instance instance; |
62 { | 70 { |
63 EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); | 71 EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); |
64 if (enter.failed()) | 72 if (enter.failed()) |
65 return PP_ERROR_BADRESOURCE; | 73 return PP_ERROR_BADRESOURCE; |
66 instance = enter.resource()->pp_instance(); | 74 instance = enter.resource()->pp_instance(); |
67 } | 75 } |
68 | 76 |
69 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); | 77 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
70 if (enter.failed()) | 78 if (enter.failed()) |
71 return PP_ERROR_BADARGUMENT; | 79 return PP_ERROR_BADARGUMENT; |
72 return enter.functions()->Navigate(instance, request_id, target, | 80 return enter.functions()->Navigate( |
73 from_user_action); | 81 instance, request_id, target, from_user_action); |
74 } | 82 } |
75 | 83 |
76 void RunMessageLoop(PP_Instance instance) { | 84 void RunMessageLoop(PP_Instance instance) { |
77 // Deprecated. | 85 // Deprecated. |
78 NOTREACHED(); | 86 NOTREACHED(); |
79 return; | 87 return; |
80 } | 88 } |
81 | 89 |
82 void QuitMessageLoop(PP_Instance instance) { | 90 void QuitMessageLoop(PP_Instance instance) { |
83 // Deprecated. | 91 // Deprecated. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return -1; | 144 return -1; |
137 } | 145 } |
138 | 146 |
139 PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) { | 147 PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) { |
140 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); | 148 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
141 if (enter.failed()) | 149 if (enter.failed()) |
142 return PP_MakeUndefined(); | 150 return PP_MakeUndefined(); |
143 return enter.functions()->GetSetting(instance, setting); | 151 return enter.functions()->GetSetting(instance, setting); |
144 } | 152 } |
145 | 153 |
146 PP_Bool SetCrashData(PP_Instance instance, | 154 PP_Bool SetCrashData(PP_Instance instance, PP_FlashCrashKey key, PP_Var value) { |
147 PP_FlashCrashKey key, | |
148 PP_Var value) { | |
149 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); | 155 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
150 if (enter.failed()) | 156 if (enter.failed()) |
151 return PP_FALSE; | 157 return PP_FALSE; |
152 return enter.functions()->SetCrashData(instance, key, value); | 158 return enter.functions()->SetCrashData(instance, key, value); |
153 } | 159 } |
154 | 160 |
155 int32_t EnumerateVideoCaptureDevices(PP_Instance instance, | 161 int32_t EnumerateVideoCaptureDevices(PP_Instance instance, |
156 PP_Resource video_capture, | 162 PP_Resource video_capture, |
157 PP_ArrayOutput devices) { | 163 PP_ArrayOutput devices) { |
158 EnterResource<PPB_VideoCapture_API> enter(video_capture, true); | 164 EnterResource<PPB_VideoCapture_API> enter(video_capture, true); |
159 if (enter.failed()) | 165 if (enter.failed()) |
160 return enter.retval(); | 166 return enter.retval(); |
161 return enter.object()->EnumerateDevicesSync(devices); | 167 return enter.object()->EnumerateDevicesSync(devices); |
162 } | 168 } |
163 | 169 |
164 const PPB_Flash_12_4 g_ppb_flash_12_4_thunk = { | 170 const PPB_Flash_12_4 g_ppb_flash_12_4_thunk = { |
165 &SetInstanceAlwaysOnTop, | 171 &SetInstanceAlwaysOnTop, &DrawGlyphs, &GetProxyForURL, |
166 &DrawGlyphs, | 172 &Navigate, &RunMessageLoop, &QuitMessageLoop, |
167 &GetProxyForURL, | 173 &GetLocalTimeZoneOffset, &GetCommandLineArgs, &PreLoadFontWin, |
168 &Navigate, | 174 &IsRectTopmost, &InvokePrinting, &UpdateActivity, |
169 &RunMessageLoop, | 175 &GetDeviceID, &GetSettingInt, &GetSetting}; |
170 &QuitMessageLoop, | |
171 &GetLocalTimeZoneOffset, | |
172 &GetCommandLineArgs, | |
173 &PreLoadFontWin, | |
174 &IsRectTopmost, | |
175 &InvokePrinting, | |
176 &UpdateActivity, | |
177 &GetDeviceID, | |
178 &GetSettingInt, | |
179 &GetSetting | |
180 }; | |
181 | 176 |
182 const PPB_Flash_12_5 g_ppb_flash_12_5_thunk = { | 177 const PPB_Flash_12_5 g_ppb_flash_12_5_thunk = { |
183 &SetInstanceAlwaysOnTop, | 178 &SetInstanceAlwaysOnTop, &DrawGlyphs, &GetProxyForURL, |
184 &DrawGlyphs, | 179 &Navigate, &RunMessageLoop, &QuitMessageLoop, |
185 &GetProxyForURL, | 180 &GetLocalTimeZoneOffset, &GetCommandLineArgs, &PreLoadFontWin, |
186 &Navigate, | 181 &IsRectTopmost, &InvokePrinting, &UpdateActivity, |
187 &RunMessageLoop, | 182 &GetDeviceID, &GetSettingInt, &GetSetting, |
188 &QuitMessageLoop, | 183 &SetCrashData}; |
189 &GetLocalTimeZoneOffset, | |
190 &GetCommandLineArgs, | |
191 &PreLoadFontWin, | |
192 &IsRectTopmost, | |
193 &InvokePrinting, | |
194 &UpdateActivity, | |
195 &GetDeviceID, | |
196 &GetSettingInt, | |
197 &GetSetting, | |
198 &SetCrashData | |
199 }; | |
200 | 184 |
201 const PPB_Flash_12_6 g_ppb_flash_12_6_thunk = { | 185 const PPB_Flash_12_6 g_ppb_flash_12_6_thunk = { |
202 &SetInstanceAlwaysOnTop, | 186 &SetInstanceAlwaysOnTop, &DrawGlyphs, &GetProxyForURL, |
203 &DrawGlyphs, | 187 &Navigate, &RunMessageLoop, &QuitMessageLoop, |
204 &GetProxyForURL, | 188 &GetLocalTimeZoneOffset, &GetCommandLineArgs, &PreLoadFontWin, |
205 &Navigate, | 189 &IsRectTopmost, &InvokePrinting, &UpdateActivity, |
206 &RunMessageLoop, | 190 &GetDeviceID, &GetSettingInt, &GetSetting, |
207 &QuitMessageLoop, | 191 &SetCrashData, &EnumerateVideoCaptureDevices}; |
208 &GetLocalTimeZoneOffset, | |
209 &GetCommandLineArgs, | |
210 &PreLoadFontWin, | |
211 &IsRectTopmost, | |
212 &InvokePrinting, | |
213 &UpdateActivity, | |
214 &GetDeviceID, | |
215 &GetSettingInt, | |
216 &GetSetting, | |
217 &SetCrashData, | |
218 &EnumerateVideoCaptureDevices | |
219 }; | |
220 | 192 |
221 const PPB_Flash_13_0 g_ppb_flash_13_0_thunk = { | 193 const PPB_Flash_13_0 g_ppb_flash_13_0_thunk = { |
222 &SetInstanceAlwaysOnTop, | 194 &SetInstanceAlwaysOnTop, &DrawGlyphs, |
223 &DrawGlyphs, | 195 &GetProxyForURL, &Navigate, |
224 &GetProxyForURL, | 196 &GetLocalTimeZoneOffset, &GetCommandLineArgs, |
225 &Navigate, | 197 &PreLoadFontWin, &IsRectTopmost, |
226 &GetLocalTimeZoneOffset, | 198 &UpdateActivity, &GetSetting, |
227 &GetCommandLineArgs, | 199 &SetCrashData, &EnumerateVideoCaptureDevices}; |
228 &PreLoadFontWin, | |
229 &IsRectTopmost, | |
230 &UpdateActivity, | |
231 &GetSetting, | |
232 &SetCrashData, | |
233 &EnumerateVideoCaptureDevices | |
234 }; | |
235 | 200 |
236 } // namespace | 201 } // namespace |
237 | 202 |
238 const PPB_Flash_12_4* GetPPB_Flash_12_4_Thunk() { | 203 const PPB_Flash_12_4* GetPPB_Flash_12_4_Thunk() { |
239 return &g_ppb_flash_12_4_thunk; | 204 return &g_ppb_flash_12_4_thunk; |
240 } | 205 } |
241 | 206 |
242 const PPB_Flash_12_5* GetPPB_Flash_12_5_Thunk() { | 207 const PPB_Flash_12_5* GetPPB_Flash_12_5_Thunk() { |
243 return &g_ppb_flash_12_5_thunk; | 208 return &g_ppb_flash_12_5_thunk; |
244 } | 209 } |
245 | 210 |
246 const PPB_Flash_12_6* GetPPB_Flash_12_6_Thunk() { | 211 const PPB_Flash_12_6* GetPPB_Flash_12_6_Thunk() { |
247 return &g_ppb_flash_12_6_thunk; | 212 return &g_ppb_flash_12_6_thunk; |
248 } | 213 } |
249 | 214 |
250 const PPB_Flash_13_0* GetPPB_Flash_13_0_Thunk() { | 215 const PPB_Flash_13_0* GetPPB_Flash_13_0_Thunk() { |
251 return &g_ppb_flash_13_0_thunk; | 216 return &g_ppb_flash_13_0_thunk; |
252 } | 217 } |
253 | 218 |
254 } // namespace thunk | 219 } // namespace thunk |
255 } // namespace ppapi | 220 } // namespace ppapi |
OLD | NEW |