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

Unified Diff: chrome/browser/extensions/api/mdns/mdns_api.cc

Issue 1200503002: [Extensions] Kill off ExtensionMsg_AddMessageToConsole (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
Index: chrome/browser/extensions/api/mdns/mdns_api.cc
diff --git a/chrome/browser/extensions/api/mdns/mdns_api.cc b/chrome/browser/extensions/api/mdns/mdns_api.cc
index 1dfa4ffe61c14ba94aa404724415c5514762eca4..a3c3b6eefbe155905d93afc440038c7bb8aea6bf 100644
--- a/chrome/browser/extensions/api/mdns/mdns_api.cc
+++ b/chrome/browser/extensions/api/mdns/mdns_api.cc
@@ -7,13 +7,14 @@
#include <vector>
#include "base/lazy_instance.h"
+#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/common/extensions/api/mdns.h"
+#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
-#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_registry.h"
-#include "extensions/common/extension_messages.h"
namespace extensions {
@@ -207,19 +208,17 @@ void MDnsAPI::WriteToConsole(const std::string& service_type,
std::string logged_message(std::string("[chrome.mdns] ") + message);
// Log to the consoles of the background pages for those extensions.
+ // TODO(devlin): It's a little weird to log to the background pages,
+ // especially when it might be dormant. We should probably just log to a place
+ // like the ErrorConsole instead.
for (const std::string& extension_id : extension_ids) {
extensions::ExtensionHost* host =
extensions::ProcessManager::Get(browser_context_)
->GetBackgroundHostForExtension(extension_id);
- if (!host)
- continue;
- content::RenderViewHost* rvh = host->render_view_host();
- if (!rvh)
- continue;
- rvh->Send(new ExtensionMsg_AddMessageToConsole(
- rvh->GetRoutingID(),
- level,
- logged_message));
+ content::RenderFrameHost* rfh =
+ host ? host->host_contents()->GetMainFrame() : nullptr;
+ if (rfh)
+ rfh->AddMessageToConsole(level, logged_message);
}
}

Powered by Google App Engine
This is Rietveld 408576698