| 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 "chrome/common/extensions/matcher/url_matcher_factory.h" | 5 #include "chrome/common/extensions/matcher/url_matcher_factory.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 factory_methods_[keys::kPathSuffixKey] = &F::CreatePathSuffixCondition; | 41 factory_methods_[keys::kPathSuffixKey] = &F::CreatePathSuffixCondition; |
| 42 factory_methods_[keys::kQueryContainsKey] = | 42 factory_methods_[keys::kQueryContainsKey] = |
| 43 &F::CreateQueryContainsCondition; | 43 &F::CreateQueryContainsCondition; |
| 44 factory_methods_[keys::kQueryEqualsKey] = &F::CreateQueryEqualsCondition; | 44 factory_methods_[keys::kQueryEqualsKey] = &F::CreateQueryEqualsCondition; |
| 45 factory_methods_[keys::kQueryPrefixKey] = &F::CreateQueryPrefixCondition; | 45 factory_methods_[keys::kQueryPrefixKey] = &F::CreateQueryPrefixCondition; |
| 46 factory_methods_[keys::kQuerySuffixKey] = &F::CreateQuerySuffixCondition; | 46 factory_methods_[keys::kQuerySuffixKey] = &F::CreateQuerySuffixCondition; |
| 47 factory_methods_[keys::kURLContainsKey] = &F::CreateURLContainsCondition; | 47 factory_methods_[keys::kURLContainsKey] = &F::CreateURLContainsCondition; |
| 48 factory_methods_[keys::kURLEqualsKey] = &F::CreateURLEqualsCondition; | 48 factory_methods_[keys::kURLEqualsKey] = &F::CreateURLEqualsCondition; |
| 49 factory_methods_[keys::kURLPrefixKey] = &F::CreateURLPrefixCondition; | 49 factory_methods_[keys::kURLPrefixKey] = &F::CreateURLPrefixCondition; |
| 50 factory_methods_[keys::kURLSuffixKey] = &F::CreateURLSuffixCondition; | 50 factory_methods_[keys::kURLSuffixKey] = &F::CreateURLSuffixCondition; |
| 51 factory_methods_[keys::kURLMatchesKey] = &F::CreateURLMatchesCondition; |
| 51 } | 52 } |
| 52 | 53 |
| 53 // Returns whether a factory method for the specified |pattern_type| (e.g. | 54 // Returns whether a factory method for the specified |pattern_type| (e.g. |
| 54 // "host_suffix") is known. | 55 // "host_suffix") is known. |
| 55 bool Contains(const std::string& pattern_type) const { | 56 bool Contains(const std::string& pattern_type) const { |
| 56 return factory_methods_.find(pattern_type) != factory_methods_.end(); | 57 return factory_methods_.find(pattern_type) != factory_methods_.end(); |
| 57 } | 58 } |
| 58 | 59 |
| 59 // Creates a URLMatcherCondition instance from |url_matcher_condition_factory| | 60 // Creates a URLMatcherCondition instance from |url_matcher_condition_factory| |
| 60 // of the given |pattern_type| (e.g. "host_suffix") for the given | 61 // of the given |pattern_type| (e.g. "host_suffix") for the given |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } else { | 217 } else { |
| 217 *error = kInvalidPortRanges; | 218 *error = kInvalidPortRanges; |
| 218 return scoped_ptr<URLMatcherPortFilter>(NULL); | 219 return scoped_ptr<URLMatcherPortFilter>(NULL); |
| 219 } | 220 } |
| 220 } | 221 } |
| 221 | 222 |
| 222 return scoped_ptr<URLMatcherPortFilter>(new URLMatcherPortFilter(ranges)); | 223 return scoped_ptr<URLMatcherPortFilter>(new URLMatcherPortFilter(ranges)); |
| 223 } | 224 } |
| 224 | 225 |
| 225 } // namespace extensions | 226 } // namespace extensions |
| OLD | NEW |