| 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/media/media_stream_dispatcher.h" | 5 #include "content/renderer/media/media_stream_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "content/common/media/media_stream_messages.h" | 9 #include "content/common/media/media_stream_messages.h" |
| 10 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" | 10 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 DCHECK(device_found); | 127 DCHECK(device_found); |
| 128 | 128 |
| 129 Send(new MediaStreamHostMsg_StopStreamDevice(routing_id(), | 129 Send(new MediaStreamHostMsg_StopStreamDevice(routing_id(), |
| 130 device_info.device.id)); | 130 device_info.device.id)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void MediaStreamDispatcher::EnumerateDevices( | 133 void MediaStreamDispatcher::EnumerateDevices( |
| 134 int request_id, | 134 int request_id, |
| 135 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | 135 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, |
| 136 MediaStreamType type, | 136 MediaStreamType type, |
| 137 const GURL& security_origin) { | 137 const GURL& security_origin, |
| 138 bool hide_labels_if_no_access) { |
| 138 DCHECK(main_loop_->BelongsToCurrentThread()); | 139 DCHECK(main_loop_->BelongsToCurrentThread()); |
| 139 DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE || | 140 DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE || |
| 140 type == MEDIA_DEVICE_VIDEO_CAPTURE || | 141 type == MEDIA_DEVICE_VIDEO_CAPTURE || |
| 141 type == MEDIA_DEVICE_AUDIO_OUTPUT); | 142 type == MEDIA_DEVICE_AUDIO_OUTPUT); |
| 142 DVLOG(1) << "MediaStreamDispatcher::EnumerateDevices(" | 143 DVLOG(1) << "MediaStreamDispatcher::EnumerateDevices(" |
| 143 << request_id << ")"; | 144 << request_id << ")"; |
| 144 | 145 |
| 145 for (RequestList::iterator it = requests_.begin(); it != requests_.end(); | 146 for (RequestList::iterator it = requests_.begin(); it != requests_.end(); |
| 146 ++it) { | 147 ++it) { |
| 147 DCHECK(!it->IsThisRequest(request_id, event_handler)); | 148 DCHECK(!it->IsThisRequest(request_id, event_handler)); |
| 148 } | 149 } |
| 149 | 150 |
| 150 requests_.push_back(Request(event_handler, request_id, next_ipc_id_)); | 151 requests_.push_back(Request(event_handler, request_id, next_ipc_id_)); |
| 151 Send(new MediaStreamHostMsg_EnumerateDevices(routing_id(), | 152 Send(new MediaStreamHostMsg_EnumerateDevices(routing_id(), |
| 152 next_ipc_id_++, | 153 next_ipc_id_++, |
| 153 type, | 154 type, |
| 154 security_origin)); | 155 security_origin, |
| 156 hide_labels_if_no_access)); |
| 155 } | 157 } |
| 156 | 158 |
| 157 void MediaStreamDispatcher::StopEnumerateDevices( | 159 void MediaStreamDispatcher::StopEnumerateDevices( |
| 158 int request_id, | 160 int request_id, |
| 159 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler) { | 161 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler) { |
| 160 DCHECK(main_loop_->BelongsToCurrentThread()); | 162 DCHECK(main_loop_->BelongsToCurrentThread()); |
| 161 DVLOG(1) << "MediaStreamDispatcher::StopEnumerateDevices(" | 163 DVLOG(1) << "MediaStreamDispatcher::StopEnumerateDevices(" |
| 162 << request_id << ")"; | 164 << request_id << ")"; |
| 163 for (RequestList::iterator it = requests_.begin(); it != requests_.end(); | 165 for (RequestList::iterator it = requests_.begin(); it != requests_.end(); |
| 164 ++it) { | 166 ++it) { |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 int index) { | 393 int index) { |
| 392 LabelStreamMap::iterator it = label_stream_map_.find(label); | 394 LabelStreamMap::iterator it = label_stream_map_.find(label); |
| 393 if (it == label_stream_map_.end() || | 395 if (it == label_stream_map_.end() || |
| 394 it->second.video_array.size() <= static_cast<size_t>(index)) { | 396 it->second.video_array.size() <= static_cast<size_t>(index)) { |
| 395 return StreamDeviceInfo::kNoId; | 397 return StreamDeviceInfo::kNoId; |
| 396 } | 398 } |
| 397 return it->second.video_array[index].session_id; | 399 return it->second.video_array[index].session_id; |
| 398 } | 400 } |
| 399 | 401 |
| 400 } // namespace content | 402 } // namespace content |
| OLD | NEW |