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

Unified Diff: content/browser/media/media_internals_handler.cc

Issue 68173025: Introduce new interface for MediaInternals updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix JavaScript test. Use non-exported base. Created 7 years, 1 month 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 | « content/browser/media/media_internals_handler.h ('k') | content/browser/media/media_internals_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/media_internals_handler.cc
diff --git a/content/browser/media/media_internals_handler.cc b/content/browser/media/media_internals_handler.cc
index 1715330e8e5f4720e3bbed80d1ffd2319630730a..a45dd4f51e40f5d646116c9bf8acde3433ae7501 100644
--- a/content/browser/media/media_internals_handler.cc
+++ b/content/browser/media/media_internals_handler.cc
@@ -16,7 +16,8 @@
namespace content {
MediaInternalsMessageHandler::MediaInternalsMessageHandler()
- : proxy_(new MediaInternalsProxy()) {}
+ : proxy_(new MediaInternalsProxy()),
+ page_load_complete_(false) {}
MediaInternalsMessageHandler::~MediaInternalsMessageHandler() {
proxy_->Detach();
@@ -33,13 +34,15 @@ void MediaInternalsMessageHandler::RegisterMessages() {
void MediaInternalsMessageHandler::OnGetEverything(
const base::ListValue* list) {
+ page_load_complete_ = true;
proxy_->GetEverything();
}
void MediaInternalsMessageHandler::OnUpdate(const string16& update) {
- // Don't try to execute JavaScript in a RenderView that no longer exists.
+ // Don't try to execute JavaScript in a RenderView that no longer exists nor
+ // if the chrome://media-internals page hasn't finished loading.
RenderViewHost* host = web_ui()->GetWebContents()->GetRenderViewHost();
- if (host)
+ if (host && page_load_complete_)
host->ExecuteJavascriptInWebFrame(string16(), update);
}
« no previous file with comments | « content/browser/media/media_internals_handler.h ('k') | content/browser/media/media_internals_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698