OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/url_matcher/url_matcher_factory.h" | 5 #include "components/url_matcher/url_matcher_factory.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cctype> | 8 #include <cctype> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "components/url_matcher/url_matcher_constants.h" | 16 #include "components/url_matcher/url_matcher_constants.h" |
16 #include "components/url_matcher/url_matcher_helpers.h" | 17 #include "components/url_matcher/url_matcher_helpers.h" |
17 #include "third_party/re2/src/re2/re2.h" | 18 #include "third_party/re2/src/re2/re2.h" |
18 | 19 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // no other url match conditions were specified. Such an empty URL is always | 153 // no other url match conditions were specified. Such an empty URL is always |
153 // matched. | 154 // matched. |
154 if (url_matcher_conditions.empty()) { | 155 if (url_matcher_conditions.empty()) { |
155 url_matcher_conditions.insert( | 156 url_matcher_conditions.insert( |
156 url_matcher_condition_factory->CreateHostPrefixCondition( | 157 url_matcher_condition_factory->CreateHostPrefixCondition( |
157 std::string())); | 158 std::string())); |
158 } | 159 } |
159 | 160 |
160 scoped_refptr<URLMatcherConditionSet> url_matcher_condition_set( | 161 scoped_refptr<URLMatcherConditionSet> url_matcher_condition_set( |
161 new URLMatcherConditionSet(id, url_matcher_conditions, | 162 new URLMatcherConditionSet(id, url_matcher_conditions, |
162 url_matcher_schema_filter.Pass(), url_matcher_port_filter.Pass())); | 163 std::move(url_matcher_schema_filter), |
| 164 std::move(url_matcher_port_filter))); |
163 return url_matcher_condition_set; | 165 return url_matcher_condition_set; |
164 } | 166 } |
165 | 167 |
166 // static | 168 // static |
167 bool URLMatcherFactory::IsURLMatcherConditionAttribute( | 169 bool URLMatcherFactory::IsURLMatcherConditionAttribute( |
168 const std::string& condition_attribute_name) { | 170 const std::string& condition_attribute_name) { |
169 return g_url_matcher_condition_factory_methods.Get().Contains( | 171 return g_url_matcher_condition_factory_methods.Get().Contains( |
170 condition_attribute_name); | 172 condition_attribute_name); |
171 } | 173 } |
172 | 174 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } else { | 267 } else { |
266 *error = kInvalidPortRanges; | 268 *error = kInvalidPortRanges; |
267 return scoped_ptr<URLMatcherPortFilter>(); | 269 return scoped_ptr<URLMatcherPortFilter>(); |
268 } | 270 } |
269 } | 271 } |
270 | 272 |
271 return scoped_ptr<URLMatcherPortFilter>(new URLMatcherPortFilter(ranges)); | 273 return scoped_ptr<URLMatcherPortFilter>(new URLMatcherPortFilter(ranges)); |
272 } | 274 } |
273 | 275 |
274 } // namespace url_matcher | 276 } // namespace url_matcher |
OLD | NEW |