| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/declarative_rule.h" | 5 #include "extensions/browser/api/declarative/declarative_rule.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/test/values_test_util.h" | 9 #include "base/test/values_test_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 void GetURLMatcherConditionSets( | 115 void GetURLMatcherConditionSets( |
| 116 URLMatcherConditionSet::Vector* condition_sets) const { | 116 URLMatcherConditionSet::Vector* condition_sets) const { |
| 117 if (condition_set.get()) | 117 if (condition_set.get()) |
| 118 condition_sets->push_back(condition_set); | 118 condition_sets->push_back(condition_set); |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool IsFulfilled(const MatchData& match_data) const { | 121 bool IsFulfilled(const MatchData& match_data) const { |
| 122 if (condition_set_id != -1 && | 122 if (condition_set_id != -1 && |
| 123 !ContainsKey(match_data.url_matches, condition_set_id)) | 123 !base::ContainsKey(match_data.url_matches, condition_set_id)) |
| 124 return false; | 124 return false; |
| 125 return match_data.value <= max_value; | 125 return match_data.value <= max_value; |
| 126 } | 126 } |
| 127 | 127 |
| 128 static std::unique_ptr<FulfillableCondition> Create( | 128 static std::unique_ptr<FulfillableCondition> Create( |
| 129 const Extension* extension, | 129 const Extension* extension, |
| 130 URLMatcherConditionFactory* url_matcher_condition_factory, | 130 URLMatcherConditionFactory* url_matcher_condition_factory, |
| 131 const base::Value& condition, | 131 const base::Value& condition, |
| 132 std::string* error) { | 132 std::string* error) { |
| 133 std::unique_ptr<FulfillableCondition> result(new FulfillableCondition()); | 133 std::unique_ptr<FulfillableCondition> result(new FulfillableCondition()); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 extension.get(), | 416 extension.get(), |
| 417 base::Time(), | 417 base::Time(), |
| 418 json_rule, | 418 json_rule, |
| 419 base::Bind(AtLeastOneCondition), | 419 base::Bind(AtLeastOneCondition), |
| 420 &error); | 420 &error); |
| 421 EXPECT_FALSE(rule); | 421 EXPECT_FALSE(rule); |
| 422 EXPECT_EQ("No conditions", error); | 422 EXPECT_EQ("No conditions", error); |
| 423 } | 423 } |
| 424 | 424 |
| 425 } // namespace extensions | 425 } // namespace extensions |
| OLD | NEW |