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/common/matcher/url_matcher_factory.h" | 5 #include "extensions/common/matcher/url_matcher_factory.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cctype> | 8 #include <cctype> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return scoped_refptr<URLMatcherConditionSet>(NULL); | 144 return scoped_refptr<URLMatcherConditionSet>(NULL); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 // As the URL is the preliminary matching criterion that triggers the tests | 148 // As the URL is the preliminary matching criterion that triggers the tests |
149 // for the remaining condition attributes, we insert an empty URL match if | 149 // for the remaining condition attributes, we insert an empty URL match if |
150 // no other url match conditions were specified. Such an empty URL is always | 150 // no other url match conditions were specified. Such an empty URL is always |
151 // matched. | 151 // matched. |
152 if (url_matcher_conditions.empty()) { | 152 if (url_matcher_conditions.empty()) { |
153 url_matcher_conditions.insert( | 153 url_matcher_conditions.insert( |
154 url_matcher_condition_factory->CreateHostPrefixCondition("")); | 154 url_matcher_condition_factory->CreateHostPrefixCondition( |
| 155 std::string())); |
155 } | 156 } |
156 | 157 |
157 scoped_refptr<URLMatcherConditionSet> url_matcher_condition_set( | 158 scoped_refptr<URLMatcherConditionSet> url_matcher_condition_set( |
158 new URLMatcherConditionSet(id, url_matcher_conditions, | 159 new URLMatcherConditionSet(id, url_matcher_conditions, |
159 url_matcher_schema_filter.Pass(), url_matcher_port_filter.Pass())); | 160 url_matcher_schema_filter.Pass(), url_matcher_port_filter.Pass())); |
160 return url_matcher_condition_set; | 161 return url_matcher_condition_set; |
161 } | 162 } |
162 | 163 |
163 // static | 164 // static |
164 bool URLMatcherFactory::IsURLMatcherConditionAttribute( | 165 bool URLMatcherFactory::IsURLMatcherConditionAttribute( |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } else { | 265 } else { |
265 *error = kInvalidPortRanges; | 266 *error = kInvalidPortRanges; |
266 return scoped_ptr<URLMatcherPortFilter>(NULL); | 267 return scoped_ptr<URLMatcherPortFilter>(NULL); |
267 } | 268 } |
268 } | 269 } |
269 | 270 |
270 return scoped_ptr<URLMatcherPortFilter>(new URLMatcherPortFilter(ranges)); | 271 return scoped_ptr<URLMatcherPortFilter>(new URLMatcherPortFilter(ranges)); |
271 } | 272 } |
272 | 273 |
273 } // namespace extensions | 274 } // namespace extensions |
OLD | NEW |