Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / content / browser / renderer_host / media / peer_connection_tracker_host.cc
blobac863e7eb898e825ed504abcb11b8dc7a83adb9a
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"
9 namespace content {
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 handled = true;
18 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTrackerHost, message)
19 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection,
20 OnAddPeerConnection)
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)
28 IPC_END_MESSAGE_MAP()
29 return handled;
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(
44 render_process_id_,
45 peer_pid(),
46 info.lid,
47 info.url,
48 info.rtc_configuration,
49 info.constraints);
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(
59 peer_pid(),
60 lid,
61 type,
62 value);
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,
72 bool audio,
73 bool video,
74 const std::string& audio_constraints,
75 const std::string& video_constraints) {
76 WebRTCInternals::GetInstance()->OnGetUserMedia(render_process_id_,
77 peer_pid(),
78 origin,
79 audio,
80 video,
81 audio_constraints,
82 video_constraints);
85 } // namespace content