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

Unified Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h

Issue 11038031: Adding condition attributes for request headers to Declarative WebRequest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased (only). Created 8 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h
index 00f5eed77fd849b461ea3db52d0fc4b6bcf82197..bde449ccde52809fdfd1852a58fe0fc2c7e14ceb 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h
@@ -37,7 +37,8 @@ class WebRequestConditionAttribute {
CONDITION_RESOURCE_TYPE,
CONDITION_CONTENT_TYPE,
CONDITION_RESPONSE_HEADERS,
- CONDITION_THIRD_PARTY
+ CONDITION_THIRD_PARTY,
+ CONDITION_REQUEST_HEADERS
};
WebRequestConditionAttribute();
@@ -139,6 +140,40 @@ class WebRequestConditionAttributeContentType
DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeContentType);
};
+// Condition attribute for matching against request headers. Uses HeaderMatcher
+// to handle the actual tests, in connection with a boolean positiveness
+// flag. If that flag is set to true, then IsFulfilled() returns true iff
+// |header_matcher_| matches at least one header. Otherwise IsFulfilled()
+// returns true iff the |header_matcher_| matches no header.
+class WebRequestConditionAttributeRequestHeaders
+ : public WebRequestConditionAttribute {
+ public:
+ virtual ~WebRequestConditionAttributeRequestHeaders();
+
+ static bool IsMatchingType(const std::string& instance_type);
+
+ // Factory method, see WebRequestConditionAttribute::Create.
+ static scoped_ptr<WebRequestConditionAttribute> Create(
+ const std::string& name,
+ const base::Value* value,
+ std::string* error);
+
+ // Implementation of WebRequestConditionAttribute:
+ virtual int GetStages() const OVERRIDE;
+ virtual bool IsFulfilled(
+ const WebRequestRule::RequestData& request_data) const OVERRIDE;
+ virtual Type GetType() const OVERRIDE;
+
+ private:
+ WebRequestConditionAttributeRequestHeaders(
+ scoped_ptr<const HeaderMatcher> header_matcher, bool positive);
+
+ const scoped_ptr<const HeaderMatcher> header_matcher_;
+ const bool positive_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeRequestHeaders);
+};
+
// Condition attribute for matching against response headers. Uses HeaderMatcher
// to handle the actual tests, in connection with a boolean positiveness
// flag. If that flag is set to true, then IsFulfilled() returns true iff
@@ -165,7 +200,7 @@ class WebRequestConditionAttributeResponseHeaders
private:
WebRequestConditionAttributeResponseHeaders(
- scoped_ptr<const HeaderMatcher>* header_matcher, bool positive);
+ scoped_ptr<const HeaderMatcher> header_matcher, bool positive);
const scoped_ptr<const HeaderMatcher> header_matcher_;
const bool positive_;
« no previous file with comments | « no previous file | chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698