Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1702)

Unified Diff: chrome/browser/media/media_internals.cc

Issue 7602021: Make MediaInternals handle MediaLogEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing event recording. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/media_internals.cc
diff --git a/chrome/browser/media/media_internals.cc b/chrome/browser/media/media_internals.cc
index a563db36f399cb951e392e9e7aec3ae7cd0589f9..bec8ec852719b921a2b698668839cec480eb364f 100644
--- a/chrome/browser/media/media_internals.cc
+++ b/chrome/browser/media/media_internals.cc
@@ -10,11 +10,13 @@
#include "chrome/browser/media/media_internals_observer.h"
#include "content/browser/browser_thread.h"
#include "content/browser/webui/web_ui.h"
+#include "media/base/media_log.h"
#include "media/base/media_log_event.h"
// The names of the javascript functions to call with updates.
-static const char kDeleteItemFunction[] = "media.onItemDeleted";
static const char kAudioUpdateFunction[] = "media.addAudioStream";
+static const char kDeleteItemFunction[] = "media.onItemDeleted";
+static const char kMediaEventFunction[] = "media.onMediaEvent";
static const char kSendEverythingFunction[] = "media.onReceiveEverything";
MediaInternals::~MediaInternals() {}
@@ -50,8 +52,15 @@ void MediaInternals::OnSetAudioStreamVolume(
void MediaInternals::OnMediaEvent(
int render_process_id, const media::MediaLogEvent& event) {
DCHECK(CalledOnValidThread());
- // TODO(scottfr): Handle |event|. Record status information in data_ and pass
- // |event| along to observers.
+
+ // Notify observers that |event| has occured.
+ DictionaryValue dict;
+ dict.SetInteger("renderer", render_process_id);
+ dict.SetInteger("player", event.id);
+ dict.SetString("type", media::MediaLog::EventTypeToString(event.type));
+ dict.SetDouble("time", event.time.ToDoubleT());
+ dict.Set("params", event.params.DeepCopy());
+ SendUpdate(kMediaEventFunction, &dict);
}
void MediaInternals::AddObserver(MediaInternalsObserver* observer) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698