Chromium Code Reviews| 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()); |
| } |