| 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 #include <utility> |
| 10 | 10 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 *error = base::StringPrintf(kVectorOfStringsExpected, keys::kSchemesKey); | 227 *error = base::StringPrintf(kVectorOfStringsExpected, keys::kSchemesKey); |
| 228 return nullptr; | 228 return nullptr; |
| 229 } | 229 } |
| 230 for (std::vector<std::string>::const_iterator it = schemas.begin(); | 230 for (std::vector<std::string>::const_iterator it = schemas.begin(); |
| 231 it != schemas.end(); ++it) { | 231 it != schemas.end(); ++it) { |
| 232 if (ContainsUpperCase(*it)) { | 232 if (ContainsUpperCase(*it)) { |
| 233 *error = base::StringPrintf(kLowerCaseExpected, "Scheme"); | 233 *error = base::StringPrintf(kLowerCaseExpected, "Scheme"); |
| 234 return nullptr; | 234 return nullptr; |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 return base::WrapUnique(new URLMatcherSchemeFilter(schemas)); | 237 return base::MakeUnique<URLMatcherSchemeFilter>(schemas); |
| 238 } | 238 } |
| 239 | 239 |
| 240 // static | 240 // static |
| 241 std::unique_ptr<URLMatcherPortFilter> URLMatcherFactory::CreateURLMatcherPorts( | 241 std::unique_ptr<URLMatcherPortFilter> URLMatcherFactory::CreateURLMatcherPorts( |
| 242 const base::Value* value, | 242 const base::Value* value, |
| 243 std::string* error) { | 243 std::string* error) { |
| 244 std::vector<URLMatcherPortFilter::Range> ranges; | 244 std::vector<URLMatcherPortFilter::Range> ranges; |
| 245 const base::ListValue* value_list = NULL; | 245 const base::ListValue* value_list = NULL; |
| 246 if (!value->GetAsList(&value_list)) { | 246 if (!value->GetAsList(&value_list)) { |
| 247 *error = kInvalidPortRanges; | 247 *error = kInvalidPortRanges; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 261 *error = kInvalidPortRanges; | 261 *error = kInvalidPortRanges; |
| 262 return nullptr; | 262 return nullptr; |
| 263 } | 263 } |
| 264 ranges.push_back(URLMatcherPortFilter::CreateRange(from, to)); | 264 ranges.push_back(URLMatcherPortFilter::CreateRange(from, to)); |
| 265 } else { | 265 } else { |
| 266 *error = kInvalidPortRanges; | 266 *error = kInvalidPortRanges; |
| 267 return nullptr; | 267 return nullptr; |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 return base::WrapUnique(new URLMatcherPortFilter(ranges)); | 271 return base::MakeUnique<URLMatcherPortFilter>(ranges); |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace url_matcher | 274 } // namespace url_matcher |
| OLD | NEW |