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

Unified Diff: extensions/browser/process_map.cc

Issue 427983003: Change the default implementation of ExtensionFunction::HasPermission to use (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix failures 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..b07d2da5553c01863bd1b203c3966bfa882e6c5a 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,31 @@ 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;
+ }
+
+ return (extension->is_hosted_app() &&
Ken Rockot(use gerrit already) 2014/08/06 21:44:45 I think it would be better to make more explicit t
not at google - send to devlin 2014/08/06 23:03:32 Done.
+ extension->location() != Manifest::COMPONENT)
+ ? Feature::BLESSED_WEB_PAGE_CONTEXT
+ : 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