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

Unified Diff: chrome/browser/extensions/api/declarative/url_matcher.h

Issue 10012004: Implemented proper support for checking schemes and requested resource types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed 'scheme' to 'schemes' Created 8 years, 8 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 | « no previous file | chrome/browser/extensions/api/declarative/url_matcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/declarative/url_matcher.h
diff --git a/chrome/browser/extensions/api/declarative/url_matcher.h b/chrome/browser/extensions/api/declarative/url_matcher.h
index 51b244a863f5d5046a7ae6ebd56c86c61d47e3cb..5fdacb256a582a9d71f197d3c0424732d9c26a32 100644
--- a/chrome/browser/extensions/api/declarative/url_matcher.h
+++ b/chrome/browser/extensions/api/declarative/url_matcher.h
@@ -179,6 +179,21 @@ class URLMatcherConditionFactory {
DISALLOW_COPY_AND_ASSIGN(URLMatcherConditionFactory);
};
+// This class represents a filter for the URL scheme to be hooked up into a
+// URLMatcherConditionSet.
+class URLMatcherSchemeFilter {
+ public:
+ explicit URLMatcherSchemeFilter(const std::string& filter);
+ explicit URLMatcherSchemeFilter(const std::vector<std::string>& filters);
+ ~URLMatcherSchemeFilter();
+ bool IsMatch(const GURL& url) const;
+
+ private:
+ std::vector<std::string> filters_;
+
+ DISALLOW_COPY_AND_ASSIGN(URLMatcherSchemeFilter);
+};
+
// This class represents a set of conditions that all need to match on a
// given URL in order to be considered a match.
class URLMatcherConditionSet : public base::RefCounted<URLMatcherConditionSet> {
@@ -187,8 +202,15 @@ class URLMatcherConditionSet : public base::RefCounted<URLMatcherConditionSet> {
typedef std::set<URLMatcherCondition> Conditions;
typedef std::vector<scoped_refptr<URLMatcherConditionSet> > Vector;
+ // Matches if all conditions in |conditions| are fulfilled.
URLMatcherConditionSet(ID id, const Conditions& conditions);
+ // Matches if all conditions in |conditions| and |scheme_filter| are
+ // fulfilled. |scheme_filter| may be NULL, in which case, no restrictions
+ // are imposed on the scheme of a URL.
+ URLMatcherConditionSet(ID id, const Conditions& conditions,
+ scoped_ptr<URLMatcherSchemeFilter> scheme_filter);
+
ID id() const { return id_; }
const Conditions& conditions() const { return conditions_; }
@@ -201,6 +223,7 @@ class URLMatcherConditionSet : public base::RefCounted<URLMatcherConditionSet> {
~URLMatcherConditionSet();
ID id_;
Conditions conditions_;
+ scoped_ptr<URLMatcherSchemeFilter> scheme_filter_;
DISALLOW_COPY_AND_ASSIGN(URLMatcherConditionSet);
};
« no previous file with comments | « no previous file | chrome/browser/extensions/api/declarative/url_matcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698