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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 for (base::ListValue::const_iterator it = tests->begin(); | 378 for (base::ListValue::const_iterator it = tests->begin(); |
379 it != tests->end(); ++it) { | 379 it != tests->end(); ++it) { |
380 const base::DictionaryValue* tests = NULL; | 380 const base::DictionaryValue* tests = NULL; |
381 if (!(*it)->GetAsDictionary(&tests)) | 381 if (!(*it)->GetAsDictionary(&tests)) |
382 return scoped_ptr<const HeaderMatcher>(); | 382 return scoped_ptr<const HeaderMatcher>(); |
383 | 383 |
384 scoped_ptr<const HeaderMatchTest> header_test( | 384 scoped_ptr<const HeaderMatchTest> header_test( |
385 HeaderMatchTest::Create(tests)); | 385 HeaderMatchTest::Create(tests)); |
386 if (header_test.get() == NULL) | 386 if (header_test.get() == NULL) |
387 return scoped_ptr<const HeaderMatcher>(); | 387 return scoped_ptr<const HeaderMatcher>(); |
388 header_tests.push_back(header_test.release()); | 388 header_tests.push_back(header_test.Pass()); |
389 } | 389 } |
390 | 390 |
391 return scoped_ptr<const HeaderMatcher>(new HeaderMatcher(&header_tests)); | 391 return scoped_ptr<const HeaderMatcher>(new HeaderMatcher(&header_tests)); |
392 } | 392 } |
393 | 393 |
394 bool HeaderMatcher::TestNameValue(const std::string& name, | 394 bool HeaderMatcher::TestNameValue(const std::string& name, |
395 const std::string& value) const { | 395 const std::string& value) const { |
396 for (size_t i = 0; i < tests_.size(); ++i) { | 396 for (size_t i = 0; i < tests_.size(); ++i) { |
397 if (tests_[i]->Matches(name, value)) | 397 if (tests_[i]->Matches(name, value)) |
398 return true; | 398 return true; |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 bool WebRequestConditionAttributeStages::Equals( | 869 bool WebRequestConditionAttributeStages::Equals( |
870 const WebRequestConditionAttribute* other) const { | 870 const WebRequestConditionAttribute* other) const { |
871 if (!WebRequestConditionAttribute::Equals(other)) | 871 if (!WebRequestConditionAttribute::Equals(other)) |
872 return false; | 872 return false; |
873 const WebRequestConditionAttributeStages* casted_other = | 873 const WebRequestConditionAttributeStages* casted_other = |
874 static_cast<const WebRequestConditionAttributeStages*>(other); | 874 static_cast<const WebRequestConditionAttributeStages*>(other); |
875 return allowed_stages_ == casted_other->allowed_stages_; | 875 return allowed_stages_ == casted_other->allowed_stages_; |
876 } | 876 } |
877 | 877 |
878 } // namespace extensions | 878 } // namespace extensions |
OLD | NEW |