summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/dispatcher.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/extensions/dispatcher.cc')
-rw-r--r--chrome/renderer/extensions/dispatcher.cc27
1 files changed, 7 insertions, 20 deletions
diff --git a/chrome/renderer/extensions/dispatcher.cc b/chrome/renderer/extensions/dispatcher.cc
index bc3aad0..3a21e8e 100644
--- a/chrome/renderer/extensions/dispatcher.cc
+++ b/chrome/renderer/extensions/dispatcher.cc
@@ -732,7 +732,6 @@ void Dispatcher::AddOrRemoveBindingsForContext(ChromeV8Context* context) {
}
case Feature::BLESSED_EXTENSION_CONTEXT:
- case Feature::BLESSED_WEB_PAGE_CONTEXT:
case Feature::UNBLESSED_EXTENSION_CONTEXT:
case Feature::CONTENT_SCRIPT_CONTEXT: {
// Extension context; iterate through all the APIs and bind the available
@@ -1114,8 +1113,7 @@ void Dispatcher::DidCreateScriptContext(
}
Feature::Context context_type = ClassifyJavaScriptContext(
- extension,
- extension_group,
+ extension_id, extension_group,
UserScriptSlave::GetDataSourceURLForFrame(frame),
frame->document().securityOrigin());
@@ -1530,13 +1528,13 @@ bool Dispatcher::IsSandboxedPage(const GURL& url) const {
}
Feature::Context Dispatcher::ClassifyJavaScriptContext(
- const Extension* extension,
+ const std::string& extension_id,
int extension_group,
const GURL& url,
const blink::WebSecurityOrigin& origin) {
DCHECK_GE(extension_group, 0);
if (extension_group == EXTENSION_GROUP_CONTENT_SCRIPTS) {
- return extension ? // TODO(kalman): when does this happen?
+ return extensions_.Contains(extension_id) ?
Feature::CONTENT_SCRIPT_CONTEXT : Feature::UNSPECIFIED_CONTEXT;
}
@@ -1551,25 +1549,14 @@ Feature::Context Dispatcher::ClassifyJavaScriptContext(
if (IsSandboxedPage(url))
return Feature::WEB_PAGE_CONTEXT;
- if (extension && IsExtensionActive(extension->id())) {
- // |extension| is active in this process, but it could be either a true
- // extension process or within the extent of a hosted app. In the latter
- // case this would usually be considered a (blessed) web page context,
- // unless the extension in question is a component extension, in which case
- // we cheat and call it blessed.
- return (extension->is_hosted_app() &&
- extension->location() != Manifest::COMPONENT) ?
- Feature::BLESSED_WEB_PAGE_CONTEXT : Feature::BLESSED_EXTENSION_CONTEXT;
- }
+ if (IsExtensionActive(extension_id))
+ return Feature::BLESSED_EXTENSION_CONTEXT;
// TODO(kalman): This isUnique() check is wrong, it should be performed as
// part of IsSandboxedPage().
if (!origin.isUnique() && extensions_.ExtensionBindingsAllowed(url)) {
- if (!extension) // TODO(kalman): when does this happen?
- return Feature::UNSPECIFIED_CONTEXT;
- return extension->is_hosted_app() ?
- Feature::BLESSED_WEB_PAGE_CONTEXT :
- Feature::UNBLESSED_EXTENSION_CONTEXT;
+ return extensions_.Contains(extension_id) ?
+ Feature::UNBLESSED_EXTENSION_CONTEXT : Feature::UNSPECIFIED_CONTEXT;
}
if (url.is_valid())