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

Unified Diff: extensions/renderer/script_context_set.cc

Issue 1293673002: Create thread-safe RendererExtensionRegistry from ExtensionSet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « extensions/renderer/script_context_set.h ('k') | extensions/renderer/script_context_set_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/script_context_set.cc
diff --git a/extensions/renderer/script_context_set.cc b/extensions/renderer/script_context_set.cc
index 096ea70ac881cbaaa13089ea55fb84ec20b38192..a9877dd9ea5ed83cd60082bfc2a402472494f78d 100644
--- a/extensions/renderer/script_context_set.cc
+++ b/extensions/renderer/script_context_set.cc
@@ -22,9 +22,8 @@ namespace {
ScriptContextSet* g_context_set = nullptr;
}
-ScriptContextSet::ScriptContextSet(ExtensionSet* extensions,
- ExtensionIdSet* active_extension_ids)
- : extensions_(extensions), active_extension_ids_(active_extension_ids) {
+ScriptContextSet::ScriptContextSet(ExtensionIdSet* active_extension_ids)
+ : active_extension_ids_(active_extension_ids) {
DCHECK(!g_context_set);
g_context_set = this;
}
@@ -146,13 +145,15 @@ const Extension* ScriptContextSet::GetExtensionFromFrameAndWorld(
GURL frame_url = ScriptContext::GetDataSourceURLForFrame(frame);
frame_url = ScriptContext::GetEffectiveDocumentURL(frame, frame_url,
use_effective_url);
- extension_id = extensions_->GetExtensionOrAppIDByURL(frame_url);
+ extension_id =
+ RendererExtensionRegistry::Get()->GetExtensionOrAppIDByURL(frame_url);
}
// There are conditions where despite a context being associated with an
// extension, no extension actually gets found. Ignore "invalid" because CSP
// blocks extension page loading by switching the extension ID to "invalid".
- const Extension* extension = extensions_->GetByID(extension_id);
+ const Extension* extension =
+ RendererExtensionRegistry::Get()->GetByID(extension_id);
if (!extension && !extension_id.empty() && extension_id != "invalid") {
// TODO(kalman): Do something here?
}
@@ -182,7 +183,7 @@ Feature::Context ScriptContextSet::ClassifyJavaScriptContext(
// before the SecurityContext is updated with the sandbox flags (after
// reading the CSP header), so the caller can't check if the context's
// security origin is unique yet.
- if (ScriptContext::IsSandboxedPage(*extensions_, url))
+ if (ScriptContext::IsSandboxedPage(url))
return Feature::WEB_PAGE_CONTEXT;
if (extension && active_extension_ids_->count(extension->id()) > 0) {
@@ -199,7 +200,8 @@ Feature::Context ScriptContextSet::ClassifyJavaScriptContext(
// TODO(kalman): This isUnique() check is wrong, it should be performed as
// part of ScriptContext::IsSandboxedPage().
- if (!origin.isUnique() && extensions_->ExtensionBindingsAllowed(url)) {
+ if (!origin.isUnique() &&
+ RendererExtensionRegistry::Get()->ExtensionBindingsAllowed(url)) {
if (!extension) // TODO(kalman): when does this happen?
return Feature::UNSPECIFIED_CONTEXT;
return extension->is_hosted_app() ? Feature::BLESSED_WEB_PAGE_CONTEXT
« no previous file with comments | « extensions/renderer/script_context_set.h ('k') | extensions/renderer/script_context_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698