OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/device_request_message_filter.h" | 5 #include "content/browser/renderer_host/media/device_request_message_filter.h" |
6 | 6 |
7 #include "content/browser/browser_main_loop.h" | 7 #include "content/browser/browser_main_loop.h" |
8 #include "content/browser/child_process_security_policy_impl.h" | 8 #include "content/browser/child_process_security_policy_impl.h" |
9 #include "content/browser/renderer_host/media/media_stream_manager.h" | 9 #include "content/browser/renderer_host/media/media_stream_manager.h" |
10 #include "content/common/media/media_stream_messages.h" | 10 #include "content/common/media/media_stream_messages.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 all_devices.insert( | 109 all_devices.insert( |
110 all_devices.end(), video_devices->begin(), video_devices->end()); | 110 all_devices.end(), video_devices->begin(), video_devices->end()); |
111 | 111 |
112 Send(new MediaStreamMsg_GetSourcesACK(request_it->request_id, all_devices)); | 112 Send(new MediaStreamMsg_GetSourcesACK(request_it->request_id, all_devices)); |
113 | 113 |
114 media_stream_manager_->CancelRequest(request_it->audio_devices_label); | 114 media_stream_manager_->CancelRequest(request_it->audio_devices_label); |
115 media_stream_manager_->CancelRequest(request_it->video_devices_label); | 115 media_stream_manager_->CancelRequest(request_it->video_devices_label); |
116 requests_.erase(request_it); | 116 requests_.erase(request_it); |
117 } | 117 } |
118 | 118 |
119 bool DeviceRequestMessageFilter::OnMessageReceived(const IPC::Message& message, | 119 bool DeviceRequestMessageFilter::OnMessageReceived( |
120 bool* message_was_ok) { | 120 const IPC::Message& message) { |
121 bool handled = true; | 121 bool handled = true; |
122 IPC_BEGIN_MESSAGE_MAP_EX(DeviceRequestMessageFilter, message, *message_was_ok) | 122 IPC_BEGIN_MESSAGE_MAP(DeviceRequestMessageFilter, message) |
123 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_GetSources, OnGetSources) | 123 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_GetSources, OnGetSources) |
124 IPC_MESSAGE_UNHANDLED(handled = false) | 124 IPC_MESSAGE_UNHANDLED(handled = false) |
125 IPC_END_MESSAGE_MAP_EX() | 125 IPC_END_MESSAGE_MAP() |
126 return handled; | 126 return handled; |
127 } | 127 } |
128 | 128 |
129 void DeviceRequestMessageFilter::OnChannelClosing() { | 129 void DeviceRequestMessageFilter::OnChannelClosing() { |
130 // Since the IPC channel is gone, cancel outstanding device requests. | 130 // Since the IPC channel is gone, cancel outstanding device requests. |
131 for (DeviceRequestList::iterator request_it = requests_.begin(); | 131 for (DeviceRequestList::iterator request_it = requests_.begin(); |
132 request_it != requests_.end(); ++request_it) { | 132 request_it != requests_.end(); ++request_it) { |
133 media_stream_manager_->CancelRequest(request_it->audio_devices_label); | 133 media_stream_manager_->CancelRequest(request_it->audio_devices_label); |
134 media_stream_manager_->CancelRequest(request_it->video_devices_label); | 134 media_stream_manager_->CancelRequest(request_it->video_devices_label); |
135 } | 135 } |
(...skipping 18 matching lines...) Expand all Loading... |
154 const std::string& video_label = media_stream_manager_->EnumerateDevices( | 154 const std::string& video_label = media_stream_manager_->EnumerateDevices( |
155 this, -1, -1, resource_context_->GetMediaDeviceIDSalt(), -1, | 155 this, -1, -1, resource_context_->GetMediaDeviceIDSalt(), -1, |
156 MEDIA_DEVICE_VIDEO_CAPTURE, security_origin); | 156 MEDIA_DEVICE_VIDEO_CAPTURE, security_origin); |
157 DCHECK(!video_label.empty()); | 157 DCHECK(!video_label.empty()); |
158 | 158 |
159 requests_.push_back(DeviceRequest( | 159 requests_.push_back(DeviceRequest( |
160 request_id, security_origin, audio_label, video_label)); | 160 request_id, security_origin, audio_label, video_label)); |
161 } | 161 } |
162 | 162 |
163 } // namespace content | 163 } // namespace content |
OLD | NEW |