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

Unified Diff: extensions/browser/process_map.cc

Issue 444133003: Try run for https://codereview.chromium.org/426593007. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: app view fix Created 6 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/browser/process_map.h ('k') | extensions/common/api/_api_features.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/process_map.cc
diff --git a/extensions/browser/process_map.cc b/extensions/browser/process_map.cc
index 3651f8af524fcc673756056ab1e3ce726addb210..12fb5380916ba3c9863254741fe19e545e78556e 100644
--- a/extensions/browser/process_map.cc
+++ b/extensions/browser/process_map.cc
@@ -4,7 +4,11 @@
#include "extensions/browser/process_map.h"
+#include "content/public/browser/child_process_security_policy.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/process_map_factory.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/features/feature.h"
namespace extensions {
@@ -119,4 +123,33 @@ std::set<std::string> ProcessMap::GetExtensionsInProcess(int process_id) const {
return result;
}
+Feature::Context ProcessMap::GuessContextType(const Extension* extension,
+ int process_id) const {
+ // WARNING: This logic must match Dispatcher::ClassifyJavaScriptContext, as
+ // much as possible.
+
+ if (content::ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(
+ process_id)) {
+ return Feature::WEBUI_CONTEXT;
+ }
+
+ if (!extension) {
+ return Feature::WEB_PAGE_CONTEXT;
+ }
+
+ if (!Contains(extension->id(), process_id)) {
+ // This could equally be UNBLESSED_EXTENSION_CONTEXT, but we don't record
+ // which processes have extension frames in them.
+ // TODO(kalman): Investigate this.
+ return Feature::CONTENT_SCRIPT_CONTEXT;
+ }
+
+ if (extension->is_hosted_app() &&
+ extension->location() != Manifest::COMPONENT) {
+ return Feature::BLESSED_WEB_PAGE_CONTEXT;
+ }
+
+ return Feature::BLESSED_EXTENSION_CONTEXT;
+}
+
} // namespace extensions
« no previous file with comments | « extensions/browser/process_map.h ('k') | extensions/common/api/_api_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698