Chromium Code Reviews| 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_MEDIA_WEBRTC_INTERNALS_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ |
| 7 | 7 |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/public/browser/webrtc_internals_interface.h" |
| 13 | 13 |
| 14 struct PeerConnectionInfo; | 14 namespace media { |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 class WebRTCInternalsUIObserver; | 15 class WebRTCInternalsUIObserver; |
| 19 | 16 |
| 20 // This is a singleton class running in the browser process. | 17 // This is a singleton class running in the browser process. |
| 21 // It collects peer connection infomation from the renderers, | 18 // It collects peer connection infomation from the renderers, |
| 22 // forwards the data to WebRTCInternalsUIObserver and | 19 // forwards the data to WebRTCInternalsUIObserver and |
| 23 // sends data collecting commands to the renderers. | 20 // sends data collecting commands to the renderers. |
| 24 class CONTENT_EXPORT WebRTCInternals { | 21 class WebRTCInternals : public content::WebRTCInternalsInterface { |
|
jam
2013/01/16 19:36:05
(this is a continution of my previous comment)
th
jiayl
2013/01/17 19:14:11
Done. WebRTCInternalsInterface --> WebRTCInternals
| |
| 25 public: | 22 public: |
| 26 static WebRTCInternals* GetInstance(); | 23 static WebRTCInternals* GetInstance(); |
| 27 | 24 |
| 28 // Methods called when peer connection status changes. | 25 // Methods called when peer connection status changes. |
|
jam
2013/01/16 19:36:05
nit: don't comment methods from parent interface
jiayl
2013/01/17 19:14:11
Done.
| |
| 29 void AddPeerConnection(base::ProcessId pid, const PeerConnectionInfo& info); | 26 virtual void AddPeerConnection(base::ProcessId pid, |
| 30 void RemovePeerConnection(base::ProcessId pid, int lid); | 27 int lid, |
| 28 const std::string& url, | |
| 29 const std::string& servers, | |
| 30 const std::string& constraints) OVERRIDE; | |
| 31 virtual void RemovePeerConnection(base::ProcessId pid, int lid) OVERRIDE; | |
| 31 | 32 |
| 32 // Methods for adding or removing WebRTCInternalsUIObserver. | 33 // Methods for adding or removing WebRTCInternalsUIObserver. |
| 33 void AddObserver(WebRTCInternalsUIObserver *observer); | 34 void AddObserver(WebRTCInternalsUIObserver *observer); |
| 34 void RemoveObserver(WebRTCInternalsUIObserver *observer); | 35 void RemoveObserver(WebRTCInternalsUIObserver *observer); |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 friend struct DefaultSingletonTraits<WebRTCInternals>; | 38 friend struct DefaultSingletonTraits<WebRTCInternals>; |
| 38 | 39 |
| 39 WebRTCInternals(); | 40 WebRTCInternals(); |
| 40 virtual ~WebRTCInternals(); | 41 virtual ~WebRTCInternals(); |
| 41 | 42 |
| 42 // Send updates to observers on UI thread. | 43 // Send updates to observers on UI thread. |
| 43 void SendUpdate(const std::string& command, base::Value* value); | 44 void SendUpdate(const std::string& command, base::Value* value); |
| 44 | 45 |
| 45 // Only the IO thread should access these fields. | 46 // Only the IO thread should access these fields. |
| 46 ObserverList<WebRTCInternalsUIObserver> observers_; | 47 ObserverList<WebRTCInternalsUIObserver> observers_; |
| 47 base::ListValue peer_connection_data_; | 48 base::ListValue peer_connection_data_; |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 } // namespace content | 51 } // namespace media |
| 51 | 52 #endif // CHROME_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ |
| 52 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ | |
| OLD | NEW |