| 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 "content/renderer/pepper/pepper_media_device_manager.h" | 5 #include "content/renderer/pepper/pepper_media_device_manager.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 DCHECK(open_callbacks_.empty()); | 74 DCHECK(open_callbacks_.empty()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void PepperMediaDeviceManager::EnumerateDevices( | 77 void PepperMediaDeviceManager::EnumerateDevices( |
| 78 PP_DeviceType_Dev type, | 78 PP_DeviceType_Dev type, |
| 79 const GURL& document_url, | 79 const GURL& document_url, |
| 80 const DevicesCallback& callback) { | 80 const DevicesCallback& callback) { |
| 81 #if defined(ENABLE_WEBRTC) | 81 #if defined(ENABLE_WEBRTC) |
| 82 bool request_audio_input = type == PP_DEVICETYPE_DEV_AUDIOCAPTURE; | 82 bool request_audio_input = type == PP_DEVICETYPE_DEV_AUDIOCAPTURE; |
| 83 bool request_video_input = type == PP_DEVICETYPE_DEV_VIDEOCAPTURE; | 83 bool request_video_input = type == PP_DEVICETYPE_DEV_VIDEOCAPTURE; |
| 84 CHECK(request_audio_input || request_video_input); |
| 84 GetMediaDevicesDispatcher()->EnumerateDevices( | 85 GetMediaDevicesDispatcher()->EnumerateDevices( |
| 85 request_audio_input, request_video_input, false /* audio_output */, | 86 request_audio_input, request_video_input, false /* audio_output */, |
| 86 url::Origin(document_url.GetOrigin()), | 87 url::Origin(document_url.GetOrigin()), |
| 87 base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, AsWeakPtr(), | 88 base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, AsWeakPtr(), |
| 88 callback, ToMediaDeviceType(type))); | 89 callback, ToMediaDeviceType(type))); |
| 89 #else | 90 #else |
| 90 base::ThreadTaskRunnerHandle::Get()->PostTask( | 91 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 91 FROM_HERE, | 92 FROM_HERE, |
| 92 base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, AsWeakPtr(), | 93 base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, AsWeakPtr(), |
| 93 callback, ToMediaDeviceType(type), MediaDeviceInfoArray())); | 94 callback, ToMediaDeviceType(type), MediaDeviceInfoArray())); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 266 } |
| 266 | 267 |
| 267 return media_devices_dispatcher_; | 268 return media_devices_dispatcher_; |
| 268 } | 269 } |
| 269 | 270 |
| 270 void PepperMediaDeviceManager::OnDestruct() { | 271 void PepperMediaDeviceManager::OnDestruct() { |
| 271 delete this; | 272 delete this; |
| 272 } | 273 } |
| 273 | 274 |
| 274 } // namespace content | 275 } // namespace content |
| OLD | NEW |