OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "extensions/browser/api/declarative_webrequest/webrequest_condition_att
ribute.h" | 5 #include "extensions/browser/api/declarative_webrequest/webrequest_condition_att
ribute.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 request_data.original_response_headers; | 687 request_data.original_response_headers; |
688 if (headers == NULL) { | 688 if (headers == NULL) { |
689 // Each header of an empty set satisfies (the negation of) everything; | 689 // Each header of an empty set satisfies (the negation of) everything; |
690 // OTOH, there is no header to satisfy even the most permissive test. | 690 // OTOH, there is no header to satisfy even the most permissive test. |
691 return !positive_; | 691 return !positive_; |
692 } | 692 } |
693 | 693 |
694 bool passed = false; // Did some header pass TestNameValue? | 694 bool passed = false; // Did some header pass TestNameValue? |
695 std::string name; | 695 std::string name; |
696 std::string value; | 696 std::string value; |
697 void* iter = NULL; | 697 size_t iter = 0; |
698 while (!passed && headers->EnumerateHeaderLines(&iter, &name, &value)) { | 698 while (!passed && headers->EnumerateHeaderLines(&iter, &name, &value)) { |
699 passed |= header_matcher_->TestNameValue(name, value); | 699 passed |= header_matcher_->TestNameValue(name, value); |
700 } | 700 } |
701 | 701 |
702 return (positive_ ? passed : !passed); | 702 return (positive_ ? passed : !passed); |
703 } | 703 } |
704 | 704 |
705 WebRequestConditionAttribute::Type | 705 WebRequestConditionAttribute::Type |
706 WebRequestConditionAttributeResponseHeaders::GetType() const { | 706 WebRequestConditionAttributeResponseHeaders::GetType() const { |
707 return CONDITION_RESPONSE_HEADERS; | 707 return CONDITION_RESPONSE_HEADERS; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 bool WebRequestConditionAttributeStages::Equals( | 876 bool WebRequestConditionAttributeStages::Equals( |
877 const WebRequestConditionAttribute* other) const { | 877 const WebRequestConditionAttribute* other) const { |
878 if (!WebRequestConditionAttribute::Equals(other)) | 878 if (!WebRequestConditionAttribute::Equals(other)) |
879 return false; | 879 return false; |
880 const WebRequestConditionAttributeStages* casted_other = | 880 const WebRequestConditionAttributeStages* casted_other = |
881 static_cast<const WebRequestConditionAttributeStages*>(other); | 881 static_cast<const WebRequestConditionAttributeStages*>(other); |
882 return allowed_stages_ == casted_other->allowed_stages_; | 882 return allowed_stages_ == casted_other->allowed_stages_; |
883 } | 883 } |
884 | 884 |
885 } // namespace extensions | 885 } // namespace extensions |
OLD | NEW |