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.h" | 5 #include "components/url_matcher/url_matcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
13 #include "url/url_canon.h" | 14 #include "url/url_canon.h" |
14 | 15 |
15 namespace url_matcher { | 16 namespace url_matcher { |
16 | 17 |
17 // This set of classes implement a mapping of URL Component Patterns, such as | 18 // This set of classes implement a mapping of URL Component Patterns, such as |
18 // host_prefix, host_suffix, host_equals, ..., etc., to StringPatterns | 19 // host_prefix, host_suffix, host_equals, ..., etc., to StringPatterns |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 : id_(id), | 736 : id_(id), |
736 conditions_(conditions) {} | 737 conditions_(conditions) {} |
737 | 738 |
738 URLMatcherConditionSet::URLMatcherConditionSet( | 739 URLMatcherConditionSet::URLMatcherConditionSet( |
739 ID id, | 740 ID id, |
740 const Conditions& conditions, | 741 const Conditions& conditions, |
741 scoped_ptr<URLMatcherSchemeFilter> scheme_filter, | 742 scoped_ptr<URLMatcherSchemeFilter> scheme_filter, |
742 scoped_ptr<URLMatcherPortFilter> port_filter) | 743 scoped_ptr<URLMatcherPortFilter> port_filter) |
743 : id_(id), | 744 : id_(id), |
744 conditions_(conditions), | 745 conditions_(conditions), |
745 scheme_filter_(scheme_filter.Pass()), | 746 scheme_filter_(std::move(scheme_filter)), |
746 port_filter_(port_filter.Pass()) {} | 747 port_filter_(std::move(port_filter)) {} |
747 | 748 |
748 URLMatcherConditionSet::URLMatcherConditionSet( | 749 URLMatcherConditionSet::URLMatcherConditionSet( |
749 ID id, | 750 ID id, |
750 const Conditions& conditions, | 751 const Conditions& conditions, |
751 const QueryConditions& query_conditions, | 752 const QueryConditions& query_conditions, |
752 scoped_ptr<URLMatcherSchemeFilter> scheme_filter, | 753 scoped_ptr<URLMatcherSchemeFilter> scheme_filter, |
753 scoped_ptr<URLMatcherPortFilter> port_filter) | 754 scoped_ptr<URLMatcherPortFilter> port_filter) |
754 : id_(id), | 755 : id_(id), |
755 conditions_(conditions), | 756 conditions_(conditions), |
756 query_conditions_(query_conditions), | 757 query_conditions_(query_conditions), |
757 scheme_filter_(scheme_filter.Pass()), | 758 scheme_filter_(std::move(scheme_filter)), |
758 port_filter_(port_filter.Pass()) {} | 759 port_filter_(std::move(port_filter)) {} |
759 | 760 |
760 bool URLMatcherConditionSet::IsMatch( | 761 bool URLMatcherConditionSet::IsMatch( |
761 const std::set<StringPattern::ID>& matching_patterns, | 762 const std::set<StringPattern::ID>& matching_patterns, |
762 const GURL& url) const { | 763 const GURL& url) const { |
763 return IsMatch(matching_patterns, url, std::string()); | 764 return IsMatch(matching_patterns, url, std::string()); |
764 } | 765 } |
765 | 766 |
766 bool URLMatcherConditionSet::IsMatch( | 767 bool URLMatcherConditionSet::IsMatch( |
767 const std::set<StringPattern::ID>& matching_patterns, | 768 const std::set<StringPattern::ID>& matching_patterns, |
768 const GURL& url, | 769 const GURL& url, |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 | 1097 |
1097 void URLMatcher::UpdateInternalDatastructures() { | 1098 void URLMatcher::UpdateInternalDatastructures() { |
1098 UpdateSubstringSetMatcher(false); | 1099 UpdateSubstringSetMatcher(false); |
1099 UpdateSubstringSetMatcher(true); | 1100 UpdateSubstringSetMatcher(true); |
1100 UpdateRegexSetMatcher(); | 1101 UpdateRegexSetMatcher(); |
1101 UpdateTriggers(); | 1102 UpdateTriggers(); |
1102 UpdateConditionFactory(); | 1103 UpdateConditionFactory(); |
1103 } | 1104 } |
1104 | 1105 |
1105 } // namespace url_matcher | 1106 } // namespace url_matcher |
OLD | NEW |