| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" | 4 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" |
| 5 | 5 |
| 6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
| 7 #include "content/browser/media/webrtc_internals.h" | |
| 8 #include "content/common/media/peer_connection_tracker_messages.h" | 7 #include "content/common/media/peer_connection_tracker_messages.h" |
| 9 #include "content/public/browser/content_browser_client.h" | 8 #include "content/public/browser/content_browser_client.h" |
| 9 #include "content/public/browser/webrtc_internals.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 PeerConnectionTrackerHost::PeerConnectionTrackerHost() { | 13 PeerConnectionTrackerHost::PeerConnectionTrackerHost() { |
| 14 } | 14 } |
| 15 | 15 |
| 16 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message, | 16 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message, |
| 17 bool* message_was_ok) { | 17 bool* message_was_ok) { |
| 18 bool handled = true; | 18 bool handled = true; |
| 19 IPC_BEGIN_MESSAGE_MAP_EX(PeerConnectionTrackerHost, message, *message_was_ok) | 19 IPC_BEGIN_MESSAGE_MAP_EX(PeerConnectionTrackerHost, message, *message_was_ok) |
| 20 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection, | 20 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection, |
| 21 OnAddPeerConnection) | 21 OnAddPeerConnection) |
| 22 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection, | 22 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection, |
| 23 OnRemovePeerConnection) | 23 OnRemovePeerConnection) |
| 24 IPC_MESSAGE_UNHANDLED(handled = false) | 24 IPC_MESSAGE_UNHANDLED(handled = false) |
| 25 IPC_END_MESSAGE_MAP_EX() | 25 IPC_END_MESSAGE_MAP_EX() |
| 26 return handled; | 26 return handled; |
| 27 } | 27 } |
| 28 | 28 |
| 29 void PeerConnectionTrackerHost::OverrideThreadForMessage( |
| 30 const IPC::Message& message, BrowserThread::ID* thread) { |
| 31 if (IPC_MESSAGE_CLASS(message) == PeerConnectionTrackerMsgStart) |
| 32 *thread = BrowserThread::UI; |
| 33 } |
| 34 |
| 29 PeerConnectionTrackerHost::~PeerConnectionTrackerHost() { | 35 PeerConnectionTrackerHost::~PeerConnectionTrackerHost() { |
| 30 } | 36 } |
| 31 | 37 |
| 32 void PeerConnectionTrackerHost::OnAddPeerConnection( | 38 void PeerConnectionTrackerHost::OnAddPeerConnection( |
| 33 const PeerConnectionInfo& info) { | 39 const PeerConnectionInfo& info) { |
| 34 WebRTCInternals::GetInstance()->AddPeerConnection( | 40 GetContentClient()->browser()->GetWebRTCInternals()-> |
| 35 base::GetProcId(peer_handle()), info); | 41 AddPeerConnection(base::GetProcId(peer_handle()), |
| 42 info.lid, |
| 43 info.url, |
| 44 info.servers, |
| 45 info.constraints); |
| 36 } | 46 } |
| 37 | 47 |
| 38 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { | 48 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { |
| 39 WebRTCInternals::GetInstance()->RemovePeerConnection( | 49 GetContentClient()->browser()->GetWebRTCInternals()-> |
| 40 base::GetProcId(peer_handle()), lid); | 50 RemovePeerConnection(base::GetProcId(peer_handle()), lid); |
| 41 } | 51 } |
| 42 | 52 |
| 43 } // namespace content | 53 } // namespace content |
| OLD | NEW |