| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 CHECK(request_audio_input || request_video_input); |
| 85 GetMediaDevicesDispatcher()->EnumerateDevices( | 85 GetMediaDevicesDispatcher()->EnumerateDevices( |
| 86 request_audio_input, request_video_input, false /* audio_output */, | 86 request_audio_input, request_video_input, false /* audio_output */, |
| 87 url::Origin(document_url.GetOrigin()), | 87 url::Origin(document_url.GetOrigin()), |
| 88 base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, AsWeakPtr(), | 88 base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, AsWeakPtr(), |
| 89 callback, ToMediaDeviceType(type))); | 89 callback, ToMediaDeviceType(type))); |
| 90 #else | 90 #else |
| 91 base::ThreadTaskRunnerHandle::Get()->PostTask( | 91 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 92 FROM_HERE, | 92 FROM_HERE, base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, |
| 93 base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, AsWeakPtr(), | 93 AsWeakPtr(), callback, ToMediaDeviceType(type), |
| 94 callback, ToMediaDeviceType(type), MediaDeviceInfoArray())); | 94 std::vector<MediaDeviceInfoArray>())); |
| 95 #endif | 95 #endif |
| 96 } | 96 } |
| 97 | 97 |
| 98 uint32_t PepperMediaDeviceManager::StartMonitoringDevices( | 98 uint32_t PepperMediaDeviceManager::StartMonitoringDevices( |
| 99 PP_DeviceType_Dev type, | 99 PP_DeviceType_Dev type, |
| 100 const GURL& document_url, | 100 const GURL& document_url, |
| 101 const DevicesCallback& callback) { | 101 const DevicesCallback& callback) { |
| 102 #if defined(ENABLE_WEBRTC) | 102 #if defined(ENABLE_WEBRTC) |
| 103 base::WeakPtr<MediaDevicesEventDispatcher> event_dispatcher = | 103 base::WeakPtr<MediaDevicesEventDispatcher> event_dispatcher = |
| 104 MediaDevicesEventDispatcher::GetForRenderFrame(render_frame()); | 104 MediaDevicesEventDispatcher::GetForRenderFrame(render_frame()); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 | 267 |
| 268 return media_devices_dispatcher_; | 268 return media_devices_dispatcher_; |
| 269 } | 269 } |
| 270 | 270 |
| 271 void PepperMediaDeviceManager::OnDestruct() { | 271 void PepperMediaDeviceManager::OnDestruct() { |
| 272 delete this; | 272 delete this; |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace content | 275 } // namespace content |
| OLD | NEW |