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