// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_ATTRIBUTE_H_ #define EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_ATTRIBUTE_H_ #include <stdint.h> #include <memory> #include <string> #include <vector> #include "base/memory/ref_counted.h" #include "extensions/browser/api/declarative_webrequest/request_stage.h" #include "extensions/common/api/events.h" namespace base { class Value; } namespace extensions { enum class WebRequestResourceType : uint8_t; class HeaderMatcher; struct WebRequestData; // Base class for all condition attributes of the declarative Web Request API // except for condition attribute to test URLPatterns. class WebRequestConditionAttribute : public base::RefCounted<WebRequestConditionAttribute> { … }; WebRequestConditionAttributes; // // The following are concrete condition attributes. // // Condition that checks whether a request is for a specific resource type. class WebRequestConditionAttributeResourceType : public WebRequestConditionAttribute { … }; // Condition that checks whether a response's Content-Type header has a // certain MIME media type. class WebRequestConditionAttributeContentType : public WebRequestConditionAttribute { … }; // 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 { … }; // 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 // |header_matcher_| matches at least one header. Otherwise IsFulfilled() // returns true iff the |header_matcher_| matches no header. class WebRequestConditionAttributeResponseHeaders : public WebRequestConditionAttribute { … }; // This condition is used as a filter for request stages. It is true exactly in // stages specified on construction. class WebRequestConditionAttributeStages : public WebRequestConditionAttribute { … }; } // namespace extensions #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_ATTRIBUTE_H_