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 "webkit/plugins/ppapi/ppb_video_capture_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 int32_t PPB_VideoCapture_Impl::InternalEnumerateDevices( | 178 int32_t PPB_VideoCapture_Impl::InternalEnumerateDevices( |
179 PP_Resource* devices, | 179 PP_Resource* devices, |
180 scoped_refptr<TrackedCallback> callback) { | 180 scoped_refptr<TrackedCallback> callback) { |
181 PluginInstance* instance = ResourceHelper::GetPluginInstance(this); | 181 PluginInstance* instance = ResourceHelper::GetPluginInstance(this); |
182 if (!instance) | 182 if (!instance) |
183 return PP_ERROR_FAILED; | 183 return PP_ERROR_FAILED; |
184 | 184 |
185 devices_ = devices; | 185 devices_ = devices; |
186 enumerate_devices_callback_ = callback; | 186 enumerate_devices_callback_ = callback; |
187 instance->delegate()->EnumerateDevices( | 187 enumeration_request_id_ = instance->delegate()->EnumerateDevices( |
188 PP_DEVICETYPE_DEV_VIDEOCAPTURE, | 188 PP_DEVICETYPE_DEV_VIDEOCAPTURE, |
189 base::Bind(&PPB_VideoCapture_Impl::EnumerateDevicesCallbackFunc, | 189 base::Bind(&PPB_VideoCapture_Impl::EnumerateDevicesCallbackFunc, |
190 AsWeakPtr())); | 190 AsWeakPtr())); |
191 return PP_OK_COMPLETIONPENDING; | 191 return PP_OK_COMPLETIONPENDING; |
192 } | 192 } |
193 | 193 |
| 194 int32_t PPB_VideoCapture_Impl::InternalStopEnumerateDevices( |
| 195 PP_Resource* devices) { |
| 196 PluginInstance* instance = ResourceHelper::GetPluginInstance(this); |
| 197 if (!instance) |
| 198 return PP_ERROR_FAILED; |
| 199 |
| 200 if (devices_ == devices) { |
| 201 instance->delegate()->StopEnumerateDevices(enumeration_request_id_); |
| 202 } |
| 203 return PP_OK; |
| 204 } |
| 205 |
194 int32_t PPB_VideoCapture_Impl::InternalOpen( | 206 int32_t PPB_VideoCapture_Impl::InternalOpen( |
195 const std::string& device_id, | 207 const std::string& device_id, |
196 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 208 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
197 uint32_t buffer_count, | 209 uint32_t buffer_count, |
198 scoped_refptr<TrackedCallback> callback) { | 210 scoped_refptr<TrackedCallback> callback) { |
199 // It is able to complete synchronously if the default device is used. | 211 // It is able to complete synchronously if the default device is used. |
200 bool sync_completion = device_id.empty(); | 212 bool sync_completion = device_id.empty(); |
201 | 213 |
202 PluginInstance* instance = ResourceHelper::GetPluginInstance(this); | 214 PluginInstance* instance = ResourceHelper::GetPluginInstance(this); |
203 if (!instance) | 215 if (!instance) |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 : in_use(false), | 331 : in_use(false), |
320 data(NULL), | 332 data(NULL), |
321 buffer() { | 333 buffer() { |
322 } | 334 } |
323 | 335 |
324 PPB_VideoCapture_Impl::BufferInfo::~BufferInfo() { | 336 PPB_VideoCapture_Impl::BufferInfo::~BufferInfo() { |
325 } | 337 } |
326 | 338 |
327 } // namespace ppapi | 339 } // namespace ppapi |
328 } // namespace webkit | 340 } // namespace webkit |
OLD | NEW |