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

Unified Diff: chrome/browser/extensions/extension_info_map.cc

Issue 8312005: Ignore paths when matching patterns for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 2 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/browser/extensions/extension_info_map.cc
diff --git a/chrome/browser/extensions/extension_info_map.cc b/chrome/browser/extensions/extension_info_map.cc
index 401c72d0809cc5ab4c15e4f95304dd2a23895d55..ce35e725b830ea2e4e74ab69b8f2c563ab84a236 100644
--- a/chrome/browser/extensions/extension_info_map.cc
+++ b/chrome/browser/extensions/extension_info_map.cc
@@ -5,6 +5,8 @@
#include "chrome/browser/extensions/extension_info_map.h"
#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_set.h"
+#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
namespace {
@@ -122,3 +124,23 @@ bool ExtensionInfoMap::IsExtensionInProcess(
ExtensionProcessIDMap::value_type(extension_id, process_id)) !=
extension_process_ids_.end();
}
+
+bool ExtensionInfoMap::SecurityOriginHasAPIPermission(
+ const GURL& origin, int process_id,
+ ExtensionAPIPermission::ID permission) const {
+ if (origin.SchemeIs(chrome::kExtensionScheme)) {
+ const std::string& id = origin.host();
+ return extensions_.GetByID(id)->HasAPIPermission(permission) &&
+ IsExtensionInProcess(id, process_id);
+ }
+
+ ExtensionSet::ExtensionMap::const_iterator i = extensions_.begin();
+ for (; i != extensions_.end(); ++i) {
+ if (i->second->web_extent().MatchesSecurityOrigin(origin) &&
+ IsExtensionInProcess(i->first, process_id) &&
+ i->second->HasAPIPermission(permission)) {
+ return true;
+ }
+ }
+ return false;
+}
« no previous file with comments | « chrome/browser/extensions/extension_info_map.h ('k') | chrome/browser/renderer_host/chrome_render_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698