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/browser/renderer_host/media/media_stream_dispatcher_host.h" | 5 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "content/browser/bad_message.h" |
11 #include "content/browser/browser_main_loop.h" | 12 #include "content/browser/browser_main_loop.h" |
12 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" | 13 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
13 #include "content/common/media/media_stream_messages.h" | 14 #include "content/common/media/media_stream_messages.h" |
14 #include "content/common/media/media_stream_options.h" | 15 #include "content/common/media/media_stream_options.h" |
15 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
16 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 | 21 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 void MediaStreamDispatcherHost::OnCancelDeviceChangeNotifications( | 269 void MediaStreamDispatcherHost::OnCancelDeviceChangeNotifications( |
269 int render_frame_id) { | 270 int render_frame_id) { |
270 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 271 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
271 DVLOG(1) << "MediaStreamDispatcherHost::CancelDeviceChangeNotifications(" | 272 DVLOG(1) << "MediaStreamDispatcherHost::CancelDeviceChangeNotifications(" |
272 << render_frame_id << ")"; | 273 << render_frame_id << ")"; |
273 auto it = std::find_if( | 274 auto it = std::find_if( |
274 device_change_subscribers_.begin(), device_change_subscribers_.end(), | 275 device_change_subscribers_.begin(), device_change_subscribers_.end(), |
275 [render_frame_id](const DeviceChangeSubscriberInfo& subscriber_info) { | 276 [render_frame_id](const DeviceChangeSubscriberInfo& subscriber_info) { |
276 return subscriber_info.render_frame_id == render_frame_id; | 277 return subscriber_info.render_frame_id == render_frame_id; |
277 }); | 278 }); |
278 CHECK(it != device_change_subscribers_.end()); | 279 if (it == device_change_subscribers_.end()) { |
| 280 bad_message::ReceivedBadMessage(this, bad_message::MSDH_INVALID_FRAME_ID); |
| 281 return; |
| 282 } |
279 device_change_subscribers_.erase(it); | 283 device_change_subscribers_.erase(it); |
280 if (device_change_subscribers_.empty()) | 284 if (device_change_subscribers_.empty()) |
281 media_stream_manager_->CancelDeviceChangeNotifications(this); | 285 media_stream_manager_->CancelDeviceChangeNotifications(this); |
282 } | 286 } |
283 | 287 |
284 std::unique_ptr<MediaStreamUIProxy> | 288 std::unique_ptr<MediaStreamUIProxy> |
285 MediaStreamDispatcherHost::CreateMediaStreamUIProxy() { | 289 MediaStreamDispatcherHost::CreateMediaStreamUIProxy() { |
286 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 290 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
287 if (use_fake_ui_ || | 291 if (use_fake_ui_ || |
288 base::CommandLine::ForCurrentProcess()->HasSwitch( | 292 base::CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 16 matching lines...) Expand all Loading... |
305 void MediaStreamDispatcherHost::OnSetCapturingLinkSecured(int session_id, | 309 void MediaStreamDispatcherHost::OnSetCapturingLinkSecured(int session_id, |
306 MediaStreamType type, | 310 MediaStreamType type, |
307 bool is_secure) { | 311 bool is_secure) { |
308 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 312 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
309 | 313 |
310 media_stream_manager_->SetCapturingLinkSecured(render_process_id_, session_id, | 314 media_stream_manager_->SetCapturingLinkSecured(render_process_id_, session_id, |
311 type, is_secure); | 315 type, is_secure); |
312 } | 316 } |
313 | 317 |
314 } // namespace content | 318 } // namespace content |
OLD | NEW |