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

Unified Diff: chrome/renderer/extensions/chrome_v8_context.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: rebase, small change 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
Index: chrome/renderer/extensions/chrome_v8_context.cc
diff --git a/chrome/renderer/extensions/chrome_v8_context.cc b/chrome/renderer/extensions/chrome_v8_context.cc
index 8fb43360767d02f70ce0cd9d80e1e0425aa4a425..631a8b2c252ffe020efb7b83aa170f107333bd47 100644
--- a/chrome/renderer/extensions/chrome_v8_context.cc
+++ b/chrome/renderer/extensions/chrome_v8_context.cc
@@ -104,8 +104,17 @@ bool ChromeV8Context::IsAnyFeatureAvailableToContext(const Feature& api) {
Feature::Availability ChromeV8Context::GetAvailability(
const std::string& api_name) {
+ // Hack: Hosted apps should have the availability of messaging APIs based on
+ // the URL of the page (which might have access depending on some extension
+ // with externally_connectable), not whether the app has access to messaging
+ // (which it won't).
+ const Extension* extension = extension_.get();
+ if (extension && extension->is_hosted_app() &&
+ (api_name == "runtime.connect" || api_name == "runtime.sendMessage")) {
+ extension = NULL;
+ }
return ExtensionAPI::GetSharedInstance()->IsAvailable(api_name,
Jeffrey Yasskin 2014/01/08 23:42:03 Could you improve the ExtensionAPI::IsAvailable co
not at google - send to devlin 2014/01/09 00:56:16 Done.
- extension_.get(),
+ extension,
context_type_,
GetURL());
}

Powered by Google App Engine
This is Rietveld 408576698