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

Unified Diff: chrome/browser/extensions/api/messaging/message_service.cc

Issue 791343003: Fix Native Messaging to handle missing caller RenderWidgetHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | chrome/browser/extensions/api/messaging/native_process_launcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/messaging/message_service.cc
diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc
index d52997437acc70f5e2c69d466309f7ee3d59bd95..3678b0029234a1119b660681387980c30b5679da 100644
--- a/chrome/browser/extensions/api/messaging/message_service.cc
+++ b/chrome/browser/extensions/api/messaging/message_service.cc
@@ -403,9 +403,11 @@ void MessageService::OpenChannelToNativeApp(
source_extension_id));
// Get handle of the native view and pass it to the native messaging host.
+ content::RenderWidgetHost* render_widget_host =
+ content::RenderWidgetHost::FromID(source_process_id, source_routing_id);
gfx::NativeView native_view =
- content::RenderWidgetHost::FromID(source_process_id, source_routing_id)->
- GetView()->GetNativeView();
+ render_widget_host ? render_widget_host->GetView()->GetNativeView()
+ : nullptr;
std::string error = kReceivingEndDoesntExistError;
scoped_ptr<NativeMessageHost> native_host = NativeMessageHost::Create(
@@ -418,8 +420,7 @@ void MessageService::OpenChannelToNativeApp(
// Abandon the channel.
if (!native_host.get()) {
LOG(ERROR) << "Failed to create native process.";
- DispatchOnDisconnect(
- source, receiver_port_id, error);
+ DispatchOnDisconnect(source, receiver_port_id, error);
return;
}
channel->receiver.reset(new NativeMessagePort(
« no previous file with comments | « no previous file | chrome/browser/extensions/api/messaging/native_process_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698