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
,
16 bool* message_was_ok
) {
19 IPC_BEGIN_MESSAGE_MAP_EX(PeerConnectionTrackerHost
, message
, *message_was_ok
)
20 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection
,
22 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection
,
23 OnRemovePeerConnection
)
24 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_UpdatePeerConnection
,
25 OnUpdatePeerConnection
)
26 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddStats
, OnAddStats
)
27 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_GetUserMedia
, OnGetUserMedia
)
28 IPC_MESSAGE_UNHANDLED(handled
= false)
29 IPC_END_MESSAGE_MAP_EX()
33 void PeerConnectionTrackerHost::OverrideThreadForMessage(
34 const IPC::Message
& message
, BrowserThread::ID
* thread
) {
35 if (IPC_MESSAGE_CLASS(message
) == PeerConnectionTrackerMsgStart
)
36 *thread
= BrowserThread::UI
;
39 PeerConnectionTrackerHost::~PeerConnectionTrackerHost() {
42 void PeerConnectionTrackerHost::OnAddPeerConnection(
43 const PeerConnectionInfo
& info
) {
44 WebRTCInternals::GetInstance()->OnAddPeerConnection(
53 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid
) {
54 WebRTCInternals::GetInstance()->OnRemovePeerConnection(peer_pid(), lid
);
57 void PeerConnectionTrackerHost::OnUpdatePeerConnection(
58 int lid
, const std::string
& type
, const std::string
& value
) {
59 WebRTCInternals::GetInstance()->OnUpdatePeerConnection(
66 void PeerConnectionTrackerHost::OnAddStats(int lid
,
67 const base::ListValue
& value
) {
68 WebRTCInternals::GetInstance()->OnAddStats(peer_pid(), lid
, value
);
71 void PeerConnectionTrackerHost::OnGetUserMedia(
72 const std::string
& origin
,
75 const std::string
& audio_constraints
,
76 const std::string
& video_constraints
) {
77 WebRTCInternals::GetInstance()->OnGetUserMedia(render_process_id_
,
86 } // namespace content