| Index: chrome/browser/media/webrtc_internals.cc
|
| diff --git a/content/browser/media/webrtc_internals.cc b/chrome/browser/media/webrtc_internals.cc
|
| similarity index 64%
|
| rename from content/browser/media/webrtc_internals.cc
|
| rename to chrome/browser/media/webrtc_internals.cc
|
| index afd9d12641b30244b2c286481b92a70cf8faa964..747f7ed7b102052463247736aa1fd097665ea0e2 100644
|
| --- a/content/browser/media/webrtc_internals.cc
|
| +++ b/chrome/browser/media/webrtc_internals.cc
|
| @@ -2,16 +2,17 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/browser/media/webrtc_internals.h"
|
| +#include "chrome/browser/media/webrtc_internals.h"
|
|
|
| -#include "content/browser/media/webrtc_internals_ui_observer.h"
|
| -#include "content/common/media/peer_connection_tracker_messages.h"
|
| +#include "chrome/browser/media/webrtc_internals_ui_observer.h"
|
| #include "content/public/browser/browser_thread.h"
|
|
|
| using base::DictionaryValue;
|
| using base::ProcessId;
|
| +using content::BrowserThread;
|
| +using std::string;
|
|
|
| -namespace content{
|
| +namespace media {
|
|
|
| WebRTCInternals::WebRTCInternals() {
|
| }
|
| @@ -24,18 +25,21 @@ WebRTCInternals* WebRTCInternals::GetInstance() {
|
| }
|
|
|
| void WebRTCInternals::AddPeerConnection(ProcessId pid,
|
| - const PeerConnectionInfo& info) {
|
| + int lid,
|
| + const string& url,
|
| + const string& servers,
|
| + const string& constraints) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| if (observers_.size()) {
|
| DictionaryValue* dict = new DictionaryValue();
|
| if (dict != NULL) {
|
| dict->SetInteger("pid", static_cast<int>(pid));
|
| - dict->SetInteger("lid", info.lid);
|
| - dict->SetString("servers", info.servers);
|
| - dict->SetString("constraints", info.constraints);
|
| - dict->SetString("url", info.url);
|
| + dict->SetInteger("lid", lid);
|
| + dict->SetString("servers", servers);
|
| + dict->SetString("constraints", constraints);
|
| + dict->SetString("url", url);
|
|
|
| - SendUpdate("updatePeerConnectionAdded", dict);
|
| + SendUpdate("addPeerConnection", dict);
|
| peer_connection_data_.Append(dict);
|
| }
|
| }
|
| @@ -44,11 +48,6 @@ void WebRTCInternals::AddPeerConnection(ProcessId pid,
|
| void WebRTCInternals::RemovePeerConnection(ProcessId pid, int lid) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| if (observers_.size()) {
|
| - DictionaryValue dict;
|
| - dict.SetInteger("pid", static_cast<int>(pid));
|
| - dict.SetInteger("lid", lid);
|
| - SendUpdate("updatePeerConnectionRemoved", &dict);
|
| -
|
| for (size_t i = 0; i < peer_connection_data_.GetSize(); ++i) {
|
| DictionaryValue* dict = NULL;
|
| peer_connection_data_.GetDictionary(i, &dict);
|
| @@ -57,8 +56,16 @@ void WebRTCInternals::RemovePeerConnection(ProcessId pid, int lid) {
|
| int this_lid = 0;
|
| dict->GetInteger("pid", &this_pid);
|
| dict->GetInteger("lid", &this_lid);
|
| - if (this_pid == static_cast<int>(pid) && this_lid == lid)
|
| + if (this_pid == static_cast<int>(pid) && this_lid == lid) {
|
| peer_connection_data_.Remove(i, NULL);
|
| +
|
| + DictionaryValue dict;
|
| + dict.SetInteger("pid", static_cast<int>(pid));
|
| + dict.SetInteger("lid", lid);
|
| + SendUpdate("removePeerConnection", &dict);
|
| +
|
| + break;
|
| + }
|
| }
|
| }
|
| }
|
| @@ -73,7 +80,7 @@ void WebRTCInternals::RemoveObserver(WebRTCInternalsUIObserver *observer) {
|
| observers_.RemoveObserver(observer);
|
| }
|
|
|
| -void WebRTCInternals::SendUpdate(const std::string& command, Value* value) {
|
| +void WebRTCInternals::SendUpdate(const string& command, Value* value) {
|
| DCHECK(observers_.size());
|
|
|
| FOR_EACH_OBSERVER(WebRTCInternalsUIObserver,
|
| @@ -81,4 +88,4 @@ void WebRTCInternals::SendUpdate(const std::string& command, Value* value) {
|
| OnUpdate(command, value));
|
| }
|
|
|
| -} // namespace content
|
| +} // namespace media
|
|
|