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

Unified Diff: components/url_matcher/url_matcher_factory.cc

Issue 1917673002: Convert //components/[u-z]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/url_matcher/url_matcher_factory.h ('k') | components/url_matcher/url_matcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/url_matcher/url_matcher_factory.cc
diff --git a/components/url_matcher/url_matcher_factory.cc b/components/url_matcher/url_matcher_factory.cc
index ac5522e353d0579283e8d037036b16d35919f508..e7ce483cd025fe32fec90543d86b53a4dbad4509 100644
--- a/components/url_matcher/url_matcher_factory.cc
+++ b/components/url_matcher/url_matcher_factory.cc
@@ -11,6 +11,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "components/url_matcher/url_matcher_constants.h"
@@ -109,8 +110,8 @@ URLMatcherFactory::CreateFromURLFilterDictionary(
const base::DictionaryValue* url_filter_dict,
URLMatcherConditionSet::ID id,
std::string* error) {
- scoped_ptr<URLMatcherSchemeFilter> url_matcher_schema_filter;
- scoped_ptr<URLMatcherPortFilter> url_matcher_port_filter;
+ std::unique_ptr<URLMatcherSchemeFilter> url_matcher_schema_filter;
+ std::unique_ptr<URLMatcherPortFilter> url_matcher_port_filter;
URLMatcherConditionSet::Conditions url_matcher_conditions;
for (base::DictionaryValue::Iterator iter(*url_filter_dict);
@@ -218,34 +219,33 @@ URLMatcherCondition URLMatcherFactory::CreateURLMatcherCondition(
}
// static
-scoped_ptr<URLMatcherSchemeFilter> URLMatcherFactory::CreateURLMatcherScheme(
- const base::Value* value,
- std::string* error) {
+std::unique_ptr<URLMatcherSchemeFilter>
+URLMatcherFactory::CreateURLMatcherScheme(const base::Value* value,
+ std::string* error) {
std::vector<std::string> schemas;
if (!helpers::GetAsStringVector(value, &schemas)) {
*error = base::StringPrintf(kVectorOfStringsExpected, keys::kSchemesKey);
- return scoped_ptr<URLMatcherSchemeFilter>();
+ return nullptr;
}
for (std::vector<std::string>::const_iterator it = schemas.begin();
it != schemas.end(); ++it) {
if (ContainsUpperCase(*it)) {
*error = base::StringPrintf(kLowerCaseExpected, "Scheme");
- return scoped_ptr<URLMatcherSchemeFilter>();
+ return nullptr;
}
}
- return scoped_ptr<URLMatcherSchemeFilter>(
- new URLMatcherSchemeFilter(schemas));
+ return base::WrapUnique(new URLMatcherSchemeFilter(schemas));
}
// static
-scoped_ptr<URLMatcherPortFilter> URLMatcherFactory::CreateURLMatcherPorts(
+std::unique_ptr<URLMatcherPortFilter> URLMatcherFactory::CreateURLMatcherPorts(
const base::Value* value,
std::string* error) {
std::vector<URLMatcherPortFilter::Range> ranges;
const base::ListValue* value_list = NULL;
if (!value->GetAsList(&value_list)) {
*error = kInvalidPortRanges;
- return scoped_ptr<URLMatcherPortFilter>();
+ return nullptr;
}
for (base::ListValue::const_iterator i = value_list->begin();
@@ -261,16 +261,16 @@ scoped_ptr<URLMatcherPortFilter> URLMatcherFactory::CreateURLMatcherPorts(
!range->GetInteger(0, &from) ||
!range->GetInteger(1, &to)) {
*error = kInvalidPortRanges;
- return scoped_ptr<URLMatcherPortFilter>();
+ return nullptr;
}
ranges.push_back(URLMatcherPortFilter::CreateRange(from, to));
} else {
*error = kInvalidPortRanges;
- return scoped_ptr<URLMatcherPortFilter>();
+ return nullptr;
}
}
- return scoped_ptr<URLMatcherPortFilter>(new URLMatcherPortFilter(ranges));
+ return base::WrapUnique(new URLMatcherPortFilter(ranges));
}
} // namespace url_matcher
« no previous file with comments | « components/url_matcher/url_matcher_factory.h ('k') | components/url_matcher/url_matcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698