Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: components/url_matcher/url_matcher_factory.cc

Issue 2257793002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/undo/undo_manager_test.cc ('k') | components/user_prefs/tracked/segregated_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698