Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/renderer_host/media/media_devices_dispatcher_host.h" | 5 #include "content/browser/renderer_host/media/media_devices_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 group_id_salt_(ResourceContext::CreateRandomMediaDeviceIDSalt()), | 89 group_id_salt_(ResourceContext::CreateRandomMediaDeviceIDSalt()), |
| 90 media_stream_manager_(media_stream_manager), | 90 media_stream_manager_(media_stream_manager), |
| 91 permission_checker_(base::MakeUnique<MediaDevicesPermissionChecker>()), | 91 permission_checker_(base::MakeUnique<MediaDevicesPermissionChecker>()), |
| 92 weak_factory_(this) { | 92 weak_factory_(this) { |
| 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 94 } | 94 } |
| 95 | 95 |
| 96 MediaDevicesDispatcherHost::~MediaDevicesDispatcherHost() { | 96 MediaDevicesDispatcherHost::~MediaDevicesDispatcherHost() { |
| 97 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 97 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 98 for (size_t i = 0; i < NUM_MEDIA_DEVICE_TYPES; ++i) { | 98 for (size_t i = 0; i < NUM_MEDIA_DEVICE_TYPES; ++i) { |
| 99 if (!device_change_subscriptions_[i].empty()) { | 99 if (media_stream_manager_->media_devices_manager() && |
|
tommi (sloooow) - chröme
2017/01/03 13:13:20
would it make sense to do this check outside the f
Guido Urdaneta
2017/01/03 13:27:17
Done.
| |
| 100 !device_change_subscriptions_[i].empty()) { | |
| 100 media_stream_manager_->media_devices_manager() | 101 media_stream_manager_->media_devices_manager() |
| 101 ->UnsubscribeDeviceChangeNotifications( | 102 ->UnsubscribeDeviceChangeNotifications( |
| 102 static_cast<MediaDeviceType>(i), this); | 103 static_cast<MediaDeviceType>(i), this); |
| 103 } | 104 } |
| 104 } | 105 } |
| 105 } | 106 } |
| 106 | 107 |
| 107 void MediaDevicesDispatcherHost::EnumerateDevices( | 108 void MediaDevicesDispatcherHost::EnumerateDevices( |
| 108 bool request_audio_input, | 109 bool request_audio_input, |
| 109 bool request_video_input, | 110 bool request_video_input, |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 for (const auto& device_info : enumeration[i]) { | 288 for (const auto& device_info : enumeration[i]) { |
| 288 result[i].push_back(TranslateDeviceInfo(has_permissions[i], | 289 result[i].push_back(TranslateDeviceInfo(has_permissions[i], |
| 289 device_id_salt_, group_id_salt_, | 290 device_id_salt_, group_id_salt_, |
| 290 security_origin, device_info)); | 291 security_origin, device_info)); |
| 291 } | 292 } |
| 292 } | 293 } |
| 293 client_callback.Run(result); | 294 client_callback.Run(result); |
| 294 } | 295 } |
| 295 | 296 |
| 296 } // namespace content | 297 } // namespace content |
| OLD | NEW |