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

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

Issue 9403006: Extensions: run "custom bindings" v8-extensions in content scripts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final comments Created 8 years, 10 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/schema_generated_bindings.cc
diff --git a/chrome/renderer/extensions/schema_generated_bindings.cc b/chrome/renderer/extensions/schema_generated_bindings.cc
index c05d797b90293538442d892660875c1ff4630e29..a8a5f758e172c071053ee14b4975a14858766e5c 100644
--- a/chrome/renderer/extensions/schema_generated_bindings.cc
+++ b/chrome/renderer/extensions/schema_generated_bindings.cc
@@ -160,7 +160,13 @@ class ExtensionImpl : public ChromeV8Extension {
size_t api_index = 0;
for (ExtensionAPI::SchemaMap::iterator it = schemas.begin();
it != schemas.end(); ++it) {
- api->Set(api_index, GetV8SchemaForAPI(self, context, it->first));
+ std::string api_name = it->first;
+ // For content scripts, only allow APIs that have unprivileged components.
+ if (v8_context->context_type() == ChromeV8Context::CONTENT_SCRIPT &&
+ ExtensionAPI::GetInstance()->IsWholeAPIPrivileged(api_name)) {
+ continue;
+ }
+ api->Set(api_index, GetV8SchemaForAPI(self, context, api_name));
++api_index;
}
« no previous file with comments | « chrome/renderer/extensions/extension_dispatcher.cc ('k') | chrome/renderer/resources/extensions/schema_generated_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698