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
3 // found in the LICENSE file.
4 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h"
6 #include "content/browser/media/webrtc_internals.h"
7 #include "content/common/media/peer_connection_tracker_messages.h"
11 PeerConnectionTrackerHost::PeerConnectionTrackerHost(int render_process_id
)
12 : BrowserMessageFilter(PeerConnectionTrackerMsgStart
),
13 render_process_id_(render_process_id
) {}
15 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message
& message
) {
18 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTrackerHost
, message
)
19 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection
,
21 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection
,
22 OnRemovePeerConnection
)
23 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_UpdatePeerConnection
,
24 OnUpdatePeerConnection
)
25 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddStats
, OnAddStats
)
26 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_GetUserMedia
, OnGetUserMedia
)
27 IPC_MESSAGE_UNHANDLED(handled
= false)
32 void PeerConnectionTrackerHost::OverrideThreadForMessage(
33 const IPC::Message
& message
, BrowserThread::ID
* thread
) {
34 if (IPC_MESSAGE_CLASS(message
) == PeerConnectionTrackerMsgStart
)
35 *thread
= BrowserThread::UI
;
38 PeerConnectionTrackerHost::~PeerConnectionTrackerHost() {
41 void PeerConnectionTrackerHost::OnAddPeerConnection(
42 const PeerConnectionInfo
& info
) {
43 WebRTCInternals::GetInstance()->OnAddPeerConnection(
48 info
.rtc_configuration
,
52 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid
) {
53 WebRTCInternals::GetInstance()->OnRemovePeerConnection(peer_pid(), lid
);
56 void PeerConnectionTrackerHost::OnUpdatePeerConnection(
57 int lid
, const std::string
& type
, const std::string
& value
) {
58 WebRTCInternals::GetInstance()->OnUpdatePeerConnection(
65 void PeerConnectionTrackerHost::OnAddStats(int lid
,
66 const base::ListValue
& value
) {
67 WebRTCInternals::GetInstance()->OnAddStats(peer_pid(), lid
, value
);
70 void PeerConnectionTrackerHost::OnGetUserMedia(
71 const std::string
& origin
,
74 const std::string
& audio_constraints
,
75 const std::string
& video_constraints
) {
76 WebRTCInternals::GetInstance()->OnGetUserMedia(render_process_id_
,
85 } // namespace content