| 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_manager.h" | 5 #include "content/browser/renderer_host/media/media_devices_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 518 |
| 519 media_stream_manager_->NotifyDevicesChanged(type, new_snapshot); | 519 media_stream_manager_->NotifyDevicesChanged(type, new_snapshot); |
| 520 } | 520 } |
| 521 | 521 |
| 522 void MediaDevicesManager::NotifyDeviceChangeSubscribers( | 522 void MediaDevicesManager::NotifyDeviceChangeSubscribers( |
| 523 MediaDeviceType type, | 523 MediaDeviceType type, |
| 524 const MediaDeviceInfoArray& snapshot) { | 524 const MediaDeviceInfoArray& snapshot) { |
| 525 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 525 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 526 DCHECK(IsValidMediaDeviceType(type)); | 526 DCHECK(IsValidMediaDeviceType(type)); |
| 527 | 527 |
| 528 // TODO(guidou): Use device types instead of stream types, and remove the | |
| 529 // call to MediaStreamManager once handling of device-change subscriptions | |
| 530 // is removed from MediaStreamManager. See http://crbug.com/334244. | |
| 531 // |permission_type| is used by MediaStreamManager to decide which permission | |
| 532 // to check before forwarding the event to the renderer process. Since there | |
| 533 // is no separate permission for audio output devices yet, use | |
| 534 // MEDIA_DEVICE_AUDIO_CAPTURE for both audio input and output. | |
| 535 MediaStreamType permission_type = type == MEDIA_DEVICE_TYPE_VIDEO_INPUT | |
| 536 ? MEDIA_DEVICE_VIDEO_CAPTURE | |
| 537 : MEDIA_DEVICE_AUDIO_CAPTURE; | |
| 538 if (media_stream_manager_) | |
| 539 media_stream_manager_->NotifyDeviceChangeSubscribers(permission_type); | |
| 540 | |
| 541 for (const auto& subscriber : device_change_subscribers_[type]) { | 528 for (const auto& subscriber : device_change_subscribers_[type]) { |
| 542 subscriber->OnDevicesChanged(type, snapshot); | 529 subscriber->OnDevicesChanged(type, snapshot); |
| 543 } | 530 } |
| 544 } | 531 } |
| 545 | 532 |
| 546 } // namespace content | 533 } // namespace content |
| OLD | NEW |