summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc18
-rw-r--r--chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h16
2 files changed, 20 insertions, 14 deletions
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc
index bd95cec..a0ca0d9 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc
@@ -293,7 +293,8 @@ WebRequestConditionAttributeResponseHeaders::Create(
return scoped_ptr<WebRequestConditionAttribute>(NULL);
}
- scoped_ptr<const HeaderMatchTest> header_test(CreateTests(tests, error));
+ scoped_ptr<const HeaderMatchTest> header_test(
+ CreateHeaderMatchTest(tests, error));
if (header_test.get() == NULL)
return scoped_ptr<WebRequestConditionAttribute>(NULL);
header_tests.push_back(header_test.release());
@@ -343,7 +344,7 @@ bool WebRequestConditionAttributeResponseHeaders::IsFulfilled(
WebRequestConditionAttribute::Type
WebRequestConditionAttributeResponseHeaders::GetType() const {
- return CONDITION_REQUEST_HEADERS;
+ return CONDITION_RESPONSE_HEADERS;
}
bool WebRequestConditionAttributeResponseHeaders::StringMatchTest::Matches(
@@ -382,7 +383,7 @@ bool WebRequestConditionAttributeResponseHeaders::HeaderMatchTest::Matches(
// static
scoped_ptr<const WebRequestConditionAttributeResponseHeaders::HeaderMatchTest>
-WebRequestConditionAttributeResponseHeaders::CreateTests(
+WebRequestConditionAttributeResponseHeaders::CreateHeaderMatchTest(
const DictionaryValue* tests,
std::string* error) {
ScopedVector<const StringMatchTest> name;
@@ -429,14 +430,15 @@ WebRequestConditionAttributeResponseHeaders::CreateTests(
for (ListValue::const_iterator it = list->begin();
it != list->end(); ++it) {
ScopedVector<const StringMatchTest>* tests = is_name ? &name : &value;
- tests->push_back(CreateMatchTest(*it, is_name, match_type).release());
+ tests->push_back(
+ CreateStringMatchTest(*it, is_name, match_type).release());
}
break;
}
case Value::TYPE_STRING: {
ScopedVector<const StringMatchTest>* tests = is_name ? &name : &value;
tests->push_back(
- CreateMatchTest(content, is_name, match_type).release());
+ CreateStringMatchTest(content, is_name, match_type).release());
break;
}
default: {
@@ -452,8 +454,10 @@ WebRequestConditionAttributeResponseHeaders::CreateTests(
// static
scoped_ptr<const WebRequestConditionAttributeResponseHeaders::StringMatchTest>
-WebRequestConditionAttributeResponseHeaders::CreateMatchTest(
- const Value* content, bool is_name_test, MatchType match_type) {
+WebRequestConditionAttributeResponseHeaders::CreateStringMatchTest(
+ const Value* content,
+ bool is_name_test,
+ MatchType match_type) {
std::string str;
CHECK(content->GetAsString(&str));
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 8ee69d5..a8ead5a 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h
@@ -34,7 +34,7 @@ class WebRequestConditionAttribute {
enum Type {
CONDITION_RESOURCE_TYPE,
CONDITION_CONTENT_TYPE,
- CONDITION_REQUEST_HEADERS
+ CONDITION_RESPONSE_HEADERS
};
WebRequestConditionAttribute();
@@ -180,7 +180,7 @@ class WebRequestConditionAttributeResponseHeaders
public:
// Takes ownership of the content of both |name| and |value|.
HeaderMatchTest(ScopedVector<const StringMatchTest>* name,
- ScopedVector<const StringMatchTest>* value);
+ ScopedVector<const StringMatchTest>* value);
~HeaderMatchTest();
// Does the header |name|: |value| match all tests in this header test?
bool Matches(const std::string& name, const std::string& value) const;
@@ -198,13 +198,15 @@ class WebRequestConditionAttributeResponseHeaders
// Gets the tests' description in |tests| and creates the corresponding
// HeaderMatchTest. Returns NULL on failure.
- static scoped_ptr<const HeaderMatchTest> CreateTests(
+ static scoped_ptr<const HeaderMatchTest> CreateHeaderMatchTest(
const base::DictionaryValue* tests,
std::string* error);
- // Helper to CreateTests. Never returns NULL, except for memory failures.
- static scoped_ptr<const StringMatchTest> CreateMatchTest(const Value* content,
- bool is_name_test,
- MatchType match_type);
+ // Helper to CreateHeaderMatchTest. Never returns NULL, except for memory
+ // failures.
+ static scoped_ptr<const StringMatchTest> CreateStringMatchTest(
+ const Value* content,
+ bool is_name_test,
+ MatchType match_type);
// The condition is satisfied if there is a header and its value such that for
// some |i| the header passes all the tests from |tests_[i]|.