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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 void PPB_VideoCapture_Impl::OnInitialized(media::VideoCapture* capture, | 167 void PPB_VideoCapture_Impl::OnInitialized(media::VideoCapture* capture, |
168 bool succeeded) { | 168 bool succeeded) { |
169 DCHECK(capture == platform_video_capture_.get()); | 169 DCHECK(capture == platform_video_capture_.get()); |
170 | 170 |
171 OnOpenComplete(succeeded ? PP_OK : PP_ERROR_FAILED); | 171 OnOpenComplete(succeeded ? PP_OK : PP_ERROR_FAILED); |
172 } | 172 } |
173 | 173 |
174 int32_t PPB_VideoCapture_Impl::InternalEnumerateDevices( | 174 int32_t PPB_VideoCapture_Impl::InternalEnumerateDevices( |
175 PP_Resource* devices, | 175 PP_Resource* devices, |
176 PP_CompletionCallback callback) { | 176 const PP_CompletionCallback& callback) { |
177 PluginInstance* instance = ResourceHelper::GetPluginInstance(this); | 177 PluginInstance* instance = ResourceHelper::GetPluginInstance(this); |
178 if (!instance) | 178 if (!instance) |
179 return PP_ERROR_FAILED; | 179 return PP_ERROR_FAILED; |
180 | 180 |
181 devices_ = devices; | 181 devices_ = devices; |
182 enumerate_devices_callback_ = new TrackedCallback(this, callback); | 182 enumerate_devices_callback_ = new TrackedCallback(this, callback); |
183 instance->delegate()->EnumerateDevices( | 183 instance->delegate()->EnumerateDevices( |
184 PP_DEVICETYPE_DEV_VIDEOCAPTURE, | 184 PP_DEVICETYPE_DEV_VIDEOCAPTURE, |
185 base::Bind(&PPB_VideoCapture_Impl::EnumerateDevicesCallbackFunc, | 185 base::Bind(&PPB_VideoCapture_Impl::EnumerateDevicesCallbackFunc, |
186 AsWeakPtr())); | 186 AsWeakPtr())); |
187 return PP_OK_COMPLETIONPENDING; | 187 return PP_OK_COMPLETIONPENDING; |
188 } | 188 } |
189 | 189 |
190 int32_t PPB_VideoCapture_Impl::InternalOpen( | 190 int32_t PPB_VideoCapture_Impl::InternalOpen( |
191 const std::string& device_id, | 191 const std::string& device_id, |
192 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 192 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
193 uint32_t buffer_count, | 193 uint32_t buffer_count, |
194 PP_CompletionCallback callback) { | 194 const PP_CompletionCallback& callback) { |
195 // It is able to complete synchronously if the default device is used. | 195 // It is able to complete synchronously if the default device is used. |
196 bool sync_completion = device_id.empty(); | 196 bool sync_completion = device_id.empty(); |
197 | 197 |
198 if (!callback.func && !sync_completion) | 198 if (!callback.func && !sync_completion) |
199 return PP_ERROR_BLOCKS_MAIN_THREAD; | 199 return PP_ERROR_BLOCKS_MAIN_THREAD; |
200 | 200 |
201 PluginInstance* instance = ResourceHelper::GetPluginInstance(this); | 201 PluginInstance* instance = ResourceHelper::GetPluginInstance(this); |
202 if (!instance) | 202 if (!instance) |
203 return PP_ERROR_FAILED; | 203 return PP_ERROR_FAILED; |
204 | 204 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 : in_use(false), | 318 : in_use(false), |
319 data(NULL), | 319 data(NULL), |
320 buffer() { | 320 buffer() { |
321 } | 321 } |
322 | 322 |
323 PPB_VideoCapture_Impl::BufferInfo::~BufferInfo() { | 323 PPB_VideoCapture_Impl::BufferInfo::~BufferInfo() { |
324 } | 324 } |
325 | 325 |
326 } // namespace ppapi | 326 } // namespace ppapi |
327 } // namespace webkit | 327 } // namespace webkit |
OLD | NEW |