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 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_ |
7 | 7 |
8 #include "base/power_monitor/power_observer.h" | |
9 #include "content/public/browser/browser_message_filter.h" | 8 #include "content/public/browser/browser_message_filter.h" |
10 | 9 |
11 struct PeerConnectionInfo; | 10 struct PeerConnectionInfo; |
12 | 11 |
13 namespace base { | 12 namespace base { |
14 class ListValue; | 13 class ListValue; |
15 } // namespace base | 14 } // namespace base |
16 | 15 |
17 namespace content { | 16 namespace content { |
18 | 17 |
19 // This class is the host for PeerConnectionTracker in the browser process | 18 // This class is the host for PeerConnectionTracker in the browser process |
20 // managed by RenderProcessHostImpl. It receives PeerConnection events from | 19 // managed by RenderProcessHostImpl. It passes IPC messages between |
21 // PeerConnectionTracker as IPC messages that it forwards to WebRTCInternals. | 20 // WebRTCInternals and PeerConnectionTracker. |
22 // It also forwards browser process events to PeerConnectionTracker via IPC. | 21 class PeerConnectionTrackerHost : public BrowserMessageFilter { |
23 class PeerConnectionTrackerHost : public BrowserMessageFilter, | |
24 public base::PowerObserver { | |
25 public: | 22 public: |
26 PeerConnectionTrackerHost(int render_process_id); | 23 PeerConnectionTrackerHost(int render_process_id); |
27 | 24 |
28 // content::BrowserMessageFilter override. | 25 // content::BrowserMessageFilter override. |
29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 26 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
30 virtual void OverrideThreadForMessage(const IPC::Message& message, | 27 virtual void OverrideThreadForMessage(const IPC::Message& message, |
31 BrowserThread::ID* thread) OVERRIDE; | 28 BrowserThread::ID* thread) OVERRIDE; |
32 | 29 |
33 // base::PowerObserver override. | |
34 virtual void OnSuspend() OVERRIDE; | |
35 | |
36 protected: | 30 protected: |
37 virtual ~PeerConnectionTrackerHost(); | 31 virtual ~PeerConnectionTrackerHost(); |
38 | 32 |
39 private: | 33 private: |
40 // Handlers for peer connection messages coming from the renderer. | 34 // Handlers for peer connection messages coming from the renderer. |
41 void OnAddPeerConnection(const PeerConnectionInfo& info); | 35 void OnAddPeerConnection(const PeerConnectionInfo& info); |
42 void OnRemovePeerConnection(int lid); | 36 void OnRemovePeerConnection(int lid); |
43 void OnUpdatePeerConnection( | 37 void OnUpdatePeerConnection( |
44 int lid, const std::string& type, const std::string& value); | 38 int lid, const std::string& type, const std::string& value); |
45 void OnAddStats(int lid, const base::ListValue& value); | 39 void OnAddStats(int lid, const base::ListValue& value); |
46 void OnGetUserMedia(const std::string& origin, | 40 void OnGetUserMedia(const std::string& origin, |
47 bool audio, | 41 bool audio, |
48 bool video, | 42 bool video, |
49 const std::string& audio_constraints, | 43 const std::string& audio_constraints, |
50 const std::string& video_constraints); | 44 const std::string& video_constraints); |
51 | 45 |
52 int render_process_id_; | 46 int render_process_id_; |
53 | 47 |
54 DISALLOW_COPY_AND_ASSIGN(PeerConnectionTrackerHost); | 48 DISALLOW_COPY_AND_ASSIGN(PeerConnectionTrackerHost); |
55 }; | 49 }; |
56 | 50 |
57 } // namespace content | 51 } // namespace content |
58 | 52 |
59 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_ | 53 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_ |
OLD | NEW |