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 "ppapi/c/pp_array_output.h" | 5 #include "ppapi/c/pp_array_output.h" |
6 #include "ppapi/c/pp_errors.h" | 6 #include "ppapi/c/pp_errors.h" |
7 #include "ppapi/c/private/ppb_flash.h" | 7 #include "ppapi/c/private/ppb_flash.h" |
8 #include "ppapi/shared_impl/ppapi_globals.h" | 8 #include "ppapi/shared_impl/ppapi_globals.h" |
9 #include "ppapi/shared_impl/proxy_lock.h" | 9 #include "ppapi/shared_impl/proxy_lock.h" |
10 #include "ppapi/shared_impl/var.h" | 10 #include "ppapi/shared_impl/var.h" |
11 #include "ppapi/thunk/enter.h" | 11 #include "ppapi/thunk/enter.h" |
12 #include "ppapi/thunk/ppb_flash_api.h" | 12 #include "ppapi/thunk/ppb_flash_api.h" |
13 #include "ppapi/thunk/ppb_flash_functions_api.h" | 13 #include "ppapi/thunk/ppb_flash_functions_api.h" |
14 #include "ppapi/thunk/ppb_instance_api.h" | 14 #include "ppapi/thunk/ppb_instance_api.h" |
| 15 #include "ppapi/thunk/ppb_video_capture_api.h" |
15 #include "ppapi/thunk/thunk.h" | 16 #include "ppapi/thunk/thunk.h" |
16 | 17 |
17 namespace ppapi { | 18 namespace ppapi { |
18 namespace thunk { | 19 namespace thunk { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) { | 23 void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) { |
23 EnterInstance enter(instance); | 24 EnterInstance enter(instance); |
24 if (enter.failed()) | 25 if (enter.failed()) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 PP_Var value) { | 152 PP_Var value) { |
152 EnterInstance enter(instance); | 153 EnterInstance enter(instance); |
153 if (enter.failed()) | 154 if (enter.failed()) |
154 return PP_FALSE; | 155 return PP_FALSE; |
155 return enter.functions()->GetFlashAPI()->SetCrashData(instance, key, value); | 156 return enter.functions()->GetFlashAPI()->SetCrashData(instance, key, value); |
156 } | 157 } |
157 | 158 |
158 int32_t EnumerateVideoCaptureDevices(PP_Instance instance, | 159 int32_t EnumerateVideoCaptureDevices(PP_Instance instance, |
159 PP_Resource video_capture, | 160 PP_Resource video_capture, |
160 PP_ArrayOutput devices) { | 161 PP_ArrayOutput devices) { |
161 EnterInstance enter(instance); | 162 thunk::EnterResource<thunk::PPB_VideoCapture_API> enter(video_capture, true); |
162 if (enter.succeeded()) { | 163 if (enter.failed()) |
163 PPB_Flash_Functions_API* api = | 164 return enter.retval(); |
164 enter.functions()->GetFlashFunctionsAPI(instance); | 165 return enter.object()->EnumerateDevicesSync(devices); |
165 if (api) { | |
166 return api->EnumerateVideoCaptureDevices(instance, video_capture, | |
167 devices); | |
168 } else { | |
169 return PP_ERROR_NOINTERFACE; | |
170 } | |
171 } | |
172 return PP_ERROR_BADRESOURCE; | |
173 } | 166 } |
174 | 167 |
175 const PPB_Flash_12_0 g_ppb_flash_12_0_thunk = { | 168 const PPB_Flash_12_0 g_ppb_flash_12_0_thunk = { |
176 &SetInstanceAlwaysOnTop, | 169 &SetInstanceAlwaysOnTop, |
177 &DrawGlyphs, | 170 &DrawGlyphs, |
178 &GetProxyForURL, | 171 &GetProxyForURL, |
179 &Navigate, | 172 &Navigate, |
180 &RunMessageLoop, | 173 &RunMessageLoop, |
181 &QuitMessageLoop, | 174 &QuitMessageLoop, |
182 &GetLocalTimeZoneOffset, | 175 &GetLocalTimeZoneOffset, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 const PPB_Flash_12_5* GetPPB_Flash_12_5_Thunk() { | 307 const PPB_Flash_12_5* GetPPB_Flash_12_5_Thunk() { |
315 return &g_ppb_flash_12_5_thunk; | 308 return &g_ppb_flash_12_5_thunk; |
316 } | 309 } |
317 | 310 |
318 const PPB_Flash_12_6* GetPPB_Flash_12_6_Thunk() { | 311 const PPB_Flash_12_6* GetPPB_Flash_12_6_Thunk() { |
319 return &g_ppb_flash_12_6_thunk; | 312 return &g_ppb_flash_12_6_thunk; |
320 } | 313 } |
321 | 314 |
322 } // namespace thunk | 315 } // namespace thunk |
323 } // namespace ppapi | 316 } // namespace ppapi |
OLD | NEW |