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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_
8 #include "base/power_monitor/power_observer.h"
9 #include "content/public/browser/browser_message_filter.h"
11 struct PeerConnectionInfo
;
19 // This class is the host for PeerConnectionTracker in the browser process
20 // managed by RenderProcessHostImpl. It receives PeerConnection events from
21 // PeerConnectionTracker as IPC messages that it forwards to WebRTCInternals.
22 // It also forwards browser process events to PeerConnectionTracker via IPC.
23 class PeerConnectionTrackerHost
: public BrowserMessageFilter
,
24 public base::PowerObserver
{
26 explicit PeerConnectionTrackerHost(int render_process_id
);
28 // content::BrowserMessageFilter override.
29 bool OnMessageReceived(const IPC::Message
& message
) override
;
30 void OverrideThreadForMessage(const IPC::Message
& message
,
31 BrowserThread::ID
* thread
) override
;
32 void OnChannelConnected(int32 peer_pid
) override
;
33 void OnChannelClosing() override
;
35 // base::PowerObserver override.
36 void OnSuspend() override
;
39 ~PeerConnectionTrackerHost() override
;
42 // Handlers for peer connection messages coming from the renderer.
43 void OnAddPeerConnection(const PeerConnectionInfo
& info
);
44 void OnRemovePeerConnection(int lid
);
45 void OnUpdatePeerConnection(
46 int lid
, const std::string
& type
, const std::string
& value
);
47 void OnAddStats(int lid
, const base::ListValue
& value
);
48 void OnGetUserMedia(const std::string
& origin
,
51 const std::string
& audio_constraints
,
52 const std::string
& video_constraints
);
53 void SendOnSuspendOnUIThread();
55 int render_process_id_
;
57 DISALLOW_COPY_AND_ASSIGN(PeerConnectionTrackerHost
);
60 } // namespace content
62 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_