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

Unified Diff: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc

Issue 598173003: Run clang-modernize -use-nullptr over src/extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
diff --git a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
index 10295d26ee45c11a3a22c28f092cc8af4aeed987..573e32fb4a0bf88a84c77f5482c6d04ee8454236 100644
--- a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
+++ b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
@@ -113,7 +113,7 @@ WebRequestConditionAttribute::Create(
const std::string& name,
const base::Value* value,
std::string* error) {
- CHECK(value != NULL && error != NULL);
+ CHECK(value != nullptr && error != nullptr);
bool bad_message = false;
return g_web_request_condition_attribute_factory.Get().factory.Instantiate(
name, value, error, &bad_message);
@@ -139,11 +139,11 @@ WebRequestConditionAttributeResourceType::Create(
std::string* error,
bool* bad_message) {
DCHECK(instance_type == keys::kResourceTypeKey);
- const base::ListValue* value_as_list = NULL;
+ const base::ListValue* value_as_list = nullptr;
if (!value->GetAsList(&value_as_list)) {
*error = ErrorUtils::FormatErrorMessage(kInvalidValue,
keys::kResourceTypeKey);
- return scoped_refptr<const WebRequestConditionAttribute>(NULL);
+ return scoped_refptr<const WebRequestConditionAttribute>(nullptr);
}
size_t number_types = value_as_list->GetSize();
@@ -157,7 +157,7 @@ WebRequestConditionAttributeResourceType::Create(
!utils::ParseResourceType(resource_type_string, &type)) {
*error = ErrorUtils::FormatErrorMessage(kInvalidValue,
keys::kResourceTypeKey);
- return scoped_refptr<const WebRequestConditionAttribute>(NULL);
+ return scoped_refptr<const WebRequestConditionAttribute>(nullptr);
}
passed_types.push_back(type);
}
@@ -225,10 +225,10 @@ WebRequestConditionAttributeContentType::Create(
bool* bad_message) {
DCHECK(name == keys::kContentTypeKey || name == keys::kExcludeContentTypeKey);
- const base::ListValue* value_as_list = NULL;
+ const base::ListValue* value_as_list = nullptr;
if (!value->GetAsList(&value_as_list)) {
*error = ErrorUtils::FormatErrorMessage(kInvalidValue, name);
- return scoped_refptr<const WebRequestConditionAttribute>(NULL);
+ return scoped_refptr<const WebRequestConditionAttribute>(nullptr);
}
std::vector<std::string> content_types;
for (base::ListValue::const_iterator it = value_as_list->begin();
@@ -236,7 +236,7 @@ WebRequestConditionAttributeContentType::Create(
std::string content_type;
if (!(*it)->GetAsString(&content_type)) {
*error = ErrorUtils::FormatErrorMessage(kInvalidValue, name);
- return scoped_refptr<const WebRequestConditionAttribute>(NULL);
+ return scoped_refptr<const WebRequestConditionAttribute>(nullptr);
}
content_types.push_back(content_type);
}
@@ -261,7 +261,7 @@ bool WebRequestConditionAttributeContentType::IsFulfilled(
std::string charset;
bool had_charset = false;
net::HttpUtil::ParseContentType(
- content_type, &mime_type, &charset, &had_charset, NULL);
+ content_type, &mime_type, &charset, &had_charset, nullptr);
if (inclusive_) {
return std::find(content_types_.begin(), content_types_.end(),
@@ -377,13 +377,13 @@ scoped_ptr<const HeaderMatcher> HeaderMatcher::Create(
ScopedVector<const HeaderMatchTest> header_tests;
for (base::ListValue::const_iterator it = tests->begin();
it != tests->end(); ++it) {
- const base::DictionaryValue* tests = NULL;
+ const base::DictionaryValue* tests = nullptr;
if (!(*it)->GetAsDictionary(&tests))
return scoped_ptr<const HeaderMatcher>();
scoped_ptr<const HeaderMatchTest> header_test(
HeaderMatchTest::Create(tests));
- if (header_test.get() == NULL)
+ if (header_test.get() == nullptr)
return scoped_ptr<const HeaderMatcher>();
header_tests.push_back(header_test.release());
}
@@ -498,7 +498,7 @@ HeaderMatcher::HeaderMatchTest::Create(const base::DictionaryValue* tests) {
is_name ? &name_match : &value_match;
switch (content->GetType()) {
case base::Value::TYPE_LIST: {
- const base::ListValue* list = NULL;
+ const base::ListValue* list = nullptr;
CHECK(content->GetAsList(&list));
for (base::ListValue::const_iterator it = list->begin();
it != list->end(); ++it) {
@@ -558,7 +558,7 @@ scoped_ptr<const HeaderMatcher> PrepareHeaderMatcher(
const std::string& name,
const base::Value* value,
std::string* error) {
- const base::ListValue* value_as_list = NULL;
+ const base::ListValue* value_as_list = nullptr;
if (!value->GetAsList(&value_as_list)) {
*error = ErrorUtils::FormatErrorMessage(kInvalidValue, name);
return scoped_ptr<const HeaderMatcher>();
@@ -566,7 +566,7 @@ scoped_ptr<const HeaderMatcher> PrepareHeaderMatcher(
scoped_ptr<const HeaderMatcher> header_matcher(
HeaderMatcher::Create(value_as_list));
- if (header_matcher.get() == NULL)
+ if (header_matcher.get() == nullptr)
*error = ErrorUtils::FormatErrorMessage(kInvalidValue, name);
return header_matcher.Pass();
}
@@ -585,8 +585,8 @@ WebRequestConditionAttributeRequestHeaders::Create(
scoped_ptr<const HeaderMatcher> header_matcher(
PrepareHeaderMatcher(name, value, error));
- if (header_matcher.get() == NULL)
- return scoped_refptr<const WebRequestConditionAttribute>(NULL);
+ if (header_matcher.get() == nullptr)
+ return scoped_refptr<const WebRequestConditionAttribute>(nullptr);
return scoped_refptr<const WebRequestConditionAttribute>(
new WebRequestConditionAttributeRequestHeaders(
@@ -659,8 +659,8 @@ WebRequestConditionAttributeResponseHeaders::Create(
scoped_ptr<const HeaderMatcher> header_matcher(
PrepareHeaderMatcher(name, value, error));
- if (header_matcher.get() == NULL)
- return scoped_refptr<const WebRequestConditionAttribute>(NULL);
+ if (header_matcher.get() == nullptr)
+ return scoped_refptr<const WebRequestConditionAttribute>(nullptr);
return scoped_refptr<const WebRequestConditionAttribute>(
new WebRequestConditionAttributeResponseHeaders(
@@ -678,7 +678,7 @@ bool WebRequestConditionAttributeResponseHeaders::IsFulfilled(
const net::HttpResponseHeaders* headers =
request_data.original_response_headers;
- if (headers == NULL) {
+ if (headers == nullptr) {
// Each header of an empty set satisfies (the negation of) everything;
// OTOH, there is no header to satisfy even the most permissive test.
return !positive_;
@@ -687,7 +687,7 @@ bool WebRequestConditionAttributeResponseHeaders::IsFulfilled(
bool passed = false; // Did some header pass TestNameValue?
std::string name;
std::string value;
- void* iter = NULL;
+ void* iter = nullptr;
while (!passed && headers->EnumerateHeaderLines(&iter, &name, &value)) {
passed |= header_matcher_->TestNameValue(name, value);
}
@@ -734,7 +734,7 @@ WebRequestConditionAttributeThirdParty::Create(
if (!value->GetAsBoolean(&third_party)) {
*error = ErrorUtils::FormatErrorMessage(kInvalidValue,
keys::kThirdPartyKey);
- return scoped_refptr<const WebRequestConditionAttribute>(NULL);
+ return scoped_refptr<const WebRequestConditionAttribute>(nullptr);
}
return scoped_refptr<const WebRequestConditionAttribute>(
@@ -798,7 +798,7 @@ namespace {
// sets corresponding bits (see RequestStage) in |out_stages|. Returns true on
// success, false otherwise.
bool ParseListOfStages(const base::Value& value, int* out_stages) {
- const base::ListValue* list = NULL;
+ const base::ListValue* list = nullptr;
if (!value.GetAsList(&list))
return false;
@@ -840,7 +840,7 @@ WebRequestConditionAttributeStages::Create(const std::string& name,
if (!ParseListOfStages(*value, &allowed_stages)) {
*error = ErrorUtils::FormatErrorMessage(kInvalidValue,
keys::kStagesKey);
- return scoped_refptr<const WebRequestConditionAttribute>(NULL);
+ return scoped_refptr<const WebRequestConditionAttribute>(nullptr);
}
return scoped_refptr<const WebRequestConditionAttribute>(

Powered by Google App Engine
This is Rietveld 408576698