| 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);
|
| }
|
| }
|
|
|
|
|