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

Unified Diff: chrome/common/extensions/extension_set.cc

Issue 8827013: Move/replace/rename URL-based extension getters from ExtensionService to/in ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: origins Created 9 years 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/common/extensions/extension_set.cc
diff --git a/chrome/common/extensions/extension_set.cc b/chrome/common/extensions/extension_set.cc
index c99220b407214057e8ff24164a8cd11dcf6c51f7..38d0c4a4ee264f5c164650ee68bf612a5d11f968 100644
--- a/chrome/common/extensions/extension_set.cc
+++ b/chrome/common/extensions/extension_set.cc
@@ -74,10 +74,26 @@ const Extension* ExtensionSet::GetByURL(const ExtensionURLInfo& info) const {
if (info.url().SchemeIs(chrome::kExtensionScheme))
return GetByID(info.url().host());
- ExtensionMap::const_iterator i = extensions_.begin();
- for (; i != extensions_.end(); ++i) {
- if (i->second->web_extent().MatchesURL(info.url()))
- return i->second.get();
+ return GetByWebExtent(info);
+}
+
+const Extension* ExtensionSet::GetByWebExtent(
+ const ExtensionURLInfo& info) const {
+ for (ExtensionMap::const_iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
+ if (iter->second->web_extent().MatchesURL(info.url()))
+ return iter->second.get();
+ }
+
+ return NULL;
+}
+
+const Extension* ExtensionSet::GetByOverlappingWebExtent(
+ const URLPatternSet& extent) const {
+ for (ExtensionMap::const_iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
+ if (iter->second->web_extent().OverlapsWith(extent))
+ return iter->second.get();
}
return NULL;

Powered by Google App Engine
This is Rietveld 408576698