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

Unified Diff: chrome/renderer/extensions/runtime_custom_bindings.cc

Issue 114803007: Register bindings for blessed web contexts (aka hosted app contexts) by hand (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more Created 6 years, 11 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 | « chrome/renderer/extensions/dispatcher.cc ('k') | extensions/common/extension_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/runtime_custom_bindings.cc
diff --git a/chrome/renderer/extensions/runtime_custom_bindings.cc b/chrome/renderer/extensions/runtime_custom_bindings.cc
index fd92526eb77f99d76d92c3425090a2366a41d10d..ac244b15a947e06744ebf986de45169c1a54a43d 100644
--- a/chrome/renderer/extensions/runtime_custom_bindings.cc
+++ b/chrome/renderer/extensions/runtime_custom_bindings.cc
@@ -58,7 +58,13 @@ void RuntimeCustomBindings::OpenChannelToExtension(
CHECK(args[0]->IsString() && args[1]->IsString() && args[2]->IsBoolean());
ExtensionMsg_ExternalConnectionInfo info;
- info.source_id = context()->GetExtensionID();
+
+ // For messaging APIs, hosted apps should be considered a web page so hide
+ // its extension ID.
+ const Extension* extension = context()->extension();
+ if (extension && !extension->is_hosted_app())
+ info.source_id = extension->id();
+
info.target_id = *v8::String::Utf8Value(args[0]->ToString());
info.source_url = context()->GetURL();
std::string channel_name = *v8::String::Utf8Value(args[1]->ToString());
« no previous file with comments | « chrome/renderer/extensions/dispatcher.cc ('k') | extensions/common/extension_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698