| 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 "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/common/media/media_stream_messages.h" | 9 #include "content/common/media/media_stream_messages.h" |
| 10 #include "content/common/media/media_stream_options.h" | 10 #include "content/common/media/media_stream_options.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 const std::string& label, | 84 const std::string& label, |
| 85 const StreamDeviceInfo& video_device) { | 85 const StreamDeviceInfo& video_device) { |
| 86 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 86 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 87 DVLOG(1) << "MediaStreamDispatcherHost::DeviceOpened(" | 87 DVLOG(1) << "MediaStreamDispatcherHost::DeviceOpened(" |
| 88 << ", {page_request_id = " << page_request_id << "})"; | 88 << ", {page_request_id = " << page_request_id << "})"; |
| 89 | 89 |
| 90 Send(new MediaStreamMsg_DeviceOpened( | 90 Send(new MediaStreamMsg_DeviceOpened( |
| 91 render_view_id, page_request_id, label, video_device)); | 91 render_view_id, page_request_id, label, video_device)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool MediaStreamDispatcherHost::OnMessageReceived( | 94 bool MediaStreamDispatcherHost::OnMessageReceived(const IPC::Message& message) { |
| 95 const IPC::Message& message, bool* message_was_ok) { | |
| 96 bool handled = true; | 95 bool handled = true; |
| 97 IPC_BEGIN_MESSAGE_MAP_EX(MediaStreamDispatcherHost, message, *message_was_ok) | 96 IPC_BEGIN_MESSAGE_MAP(MediaStreamDispatcherHost, message) |
| 98 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_GenerateStream, OnGenerateStream) | 97 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_GenerateStream, OnGenerateStream) |
| 99 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CancelGenerateStream, | 98 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CancelGenerateStream, |
| 100 OnCancelGenerateStream) | 99 OnCancelGenerateStream) |
| 101 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_StopStreamDevice, | 100 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_StopStreamDevice, |
| 102 OnStopStreamDevice) | 101 OnStopStreamDevice) |
| 103 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_EnumerateDevices, | 102 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_EnumerateDevices, |
| 104 OnEnumerateDevices) | 103 OnEnumerateDevices) |
| 105 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CancelEnumerateDevices, | 104 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CancelEnumerateDevices, |
| 106 OnCancelEnumerateDevices) | 105 OnCancelEnumerateDevices) |
| 107 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_OpenDevice, | 106 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_OpenDevice, |
| 108 OnOpenDevice) | 107 OnOpenDevice) |
| 109 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CloseDevice, | 108 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CloseDevice, |
| 110 OnCloseDevice) | 109 OnCloseDevice) |
| 111 IPC_MESSAGE_UNHANDLED(handled = false) | 110 IPC_MESSAGE_UNHANDLED(handled = false) |
| 112 IPC_END_MESSAGE_MAP_EX() | 111 IPC_END_MESSAGE_MAP() |
| 113 return handled; | 112 return handled; |
| 114 } | 113 } |
| 115 | 114 |
| 116 void MediaStreamDispatcherHost::OnChannelClosing() { | 115 void MediaStreamDispatcherHost::OnChannelClosing() { |
| 117 DVLOG(1) << "MediaStreamDispatcherHost::OnChannelClosing"; | 116 DVLOG(1) << "MediaStreamDispatcherHost::OnChannelClosing"; |
| 118 | 117 |
| 119 // Since the IPC channel is gone, close all requesting/requested streams. | 118 // Since the IPC channel is gone, close all requesting/requested streams. |
| 120 media_stream_manager_->CancelAllRequests(render_process_id_); | 119 media_stream_manager_->CancelAllRequests(render_process_id_); |
| 121 } | 120 } |
| 122 | 121 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( | 228 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( |
| 230 render_process_id_, url)) { | 229 render_process_id_, url)) { |
| 231 LOG(ERROR) << "MSDH: Renderer requested a URL it's not allowed to use."; | 230 LOG(ERROR) << "MSDH: Renderer requested a URL it's not allowed to use."; |
| 232 return false; | 231 return false; |
| 233 } | 232 } |
| 234 | 233 |
| 235 return true; | 234 return true; |
| 236 } | 235 } |
| 237 | 236 |
| 238 } // namespace content | 237 } // namespace content |
| OLD | NEW |