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

Unified Diff: extensions/common/extension_api.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/common/extension_api.cc
diff --git a/extensions/common/extension_api.cc b/extensions/common/extension_api.cc
index d10084cbb792d9a1cffe0ab31d8cb0c677386d21..2dc1fae0949b9b8e92c0619980d09575faf07dd7 100644
--- a/extensions/common/extension_api.cc
+++ b/extensions/common/extension_api.cc
@@ -43,12 +43,11 @@ base::StringPiece ReadFromResource(int resource_id) {
scoped_ptr<base::ListValue> LoadSchemaList(const std::string& name,
const base::StringPiece& schema) {
std::string error_message;
- scoped_ptr<base::Value> result(
- base::JSONReader::ReadAndReturnError(
- schema,
- base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options
- NULL, // error code
- &error_message));
+ scoped_ptr<base::Value> result(base::JSONReader::ReadAndReturnError(
+ schema,
+ base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options
+ nullptr, // error code
+ &error_message));
// Tracking down http://crbug.com/121424
char buf[128];
@@ -67,7 +66,7 @@ const base::DictionaryValue* FindListItem(const base::ListValue* list,
const std::string& property_name,
const std::string& property_value) {
for (size_t i = 0; i < list->GetSize(); ++i) {
- const base::DictionaryValue* item = NULL;
+ const base::DictionaryValue* item = nullptr;
CHECK(list->GetDictionary(i, &item))
<< property_value << "/" << property_name;
std::string value;
@@ -75,15 +74,15 @@ const base::DictionaryValue* FindListItem(const base::ListValue* list,
return item;
}
- return NULL;
+ return nullptr;
}
const base::DictionaryValue* GetSchemaChild(
const base::DictionaryValue* schema_node,
const std::string& child_name) {
- const base::DictionaryValue* child_node = NULL;
+ const base::DictionaryValue* child_node = nullptr;
for (size_t i = 0; i < arraysize(kChildKinds); ++i) {
- const base::ListValue* list_node = NULL;
+ const base::ListValue* list_node = nullptr;
if (!schema_node->GetList(kChildKinds[i], &list_node))
continue;
child_node = FindListItem(list_node, "name", child_name);
@@ -91,7 +90,7 @@ const base::DictionaryValue* GetSchemaChild(
return child_node;
}
- return NULL;
+ return nullptr;
}
struct Static {
@@ -104,7 +103,7 @@ struct Static {
base::LazyInstance<Static> g_lazy_instance = LAZY_INSTANCE_INITIALIZER;
// May override |g_lazy_instance| for a test.
-ExtensionAPI* g_shared_instance_for_test = NULL;
+ExtensionAPI* g_shared_instance_for_test = nullptr;
// If it exists and does not already specify a namespace, then the value stored
// with key |key| in |schema| will be updated to |schema_namespace| + "." +
@@ -125,8 +124,8 @@ void MaybePrefixFieldWithNamespace(const std::string& schema_namespace,
// |schema_namespace| if they do not already specify a namespace.
void PrefixRefsWithNamespace(const std::string& schema_namespace,
base::Value* value) {
- base::ListValue* list = NULL;
- base::DictionaryValue* dict = NULL;
+ base::ListValue* list = nullptr;
+ base::DictionaryValue* dict = nullptr;
if (value->GetAsList(&list)) {
for (base::ListValue::iterator i = list->begin(); i != list->end(); ++i) {
PrefixRefsWithNamespace(schema_namespace, *i);
@@ -134,7 +133,7 @@ void PrefixRefsWithNamespace(const std::string& schema_namespace,
} else if (value->GetAsDictionary(&dict)) {
MaybePrefixFieldWithNamespace(schema_namespace, dict, "$ref");
for (base::DictionaryValue::Iterator i(*dict); !i.IsAtEnd(); i.Advance()) {
- base::Value* value = NULL;
+ base::Value* value = nullptr;
CHECK(dict->GetWithoutPathExpansion(i.key(), &value));
PrefixRefsWithNamespace(schema_namespace, value);
}
@@ -149,10 +148,10 @@ void PrefixTypesWithNamespace(const std::string& schema_namespace,
return;
// Add the namespace to all of the types defined in this schema
- base::ListValue *types = NULL;
+ base::ListValue* types = nullptr;
CHECK(schema->GetList("types", &types));
for (size_t i = 0; i < types->GetSize(); ++i) {
- base::DictionaryValue *type = NULL;
+ base::DictionaryValue* type = nullptr;
CHECK(types->GetDictionary(i, &type));
MaybePrefixFieldWithNamespace(schema_namespace, type, "id");
MaybePrefixFieldWithNamespace(schema_namespace, type, "customBindings");
@@ -215,7 +214,7 @@ void ExtensionAPI::LoadSchema(const std::string& name,
extensions::ExtensionsClient::Get();
DCHECK(extensions_client);
while (!schema_list->empty()) {
- base::DictionaryValue* schema = NULL;
+ base::DictionaryValue* schema = nullptr;
{
scoped_ptr<base::Value> value;
schema_list->Remove(schema_list->GetSize() - 1, &value);
@@ -305,7 +304,7 @@ bool ExtensionAPI::IsAvailableInUntrustedContext(const std::string& name,
bool ExtensionAPI::IsAvailableToWebUI(const std::string& name,
const GURL& url) {
- return IsAvailable(name, NULL, Feature::WEBUI_CONTEXT, url).is_available();
+ return IsAvailable(name, nullptr, Feature::WEBUI_CONTEXT, url).is_available();
}
const base::DictionaryValue* ExtensionAPI::GetSchema(
@@ -313,7 +312,7 @@ const base::DictionaryValue* ExtensionAPI::GetSchema(
std::string child_name;
std::string api_name = GetAPINameFromFullName(full_name, &child_name);
- const base::DictionaryValue* result = NULL;
+ const base::DictionaryValue* result = nullptr;
SchemaMap::iterator maybe_schema = schemas_.find(api_name);
if (maybe_schema != schemas_.end()) {
result = maybe_schema->second.get();
@@ -331,7 +330,7 @@ const base::DictionaryValue* ExtensionAPI::GetSchema(
extensions_client->IsAPISchemaGenerated(api_name)) {
LoadSchema(api_name, extensions_client->GetAPISchema(api_name));
} else {
- return NULL;
+ return nullptr;
}
maybe_schema = schemas_.find(api_name);
@@ -353,7 +352,7 @@ Feature* ExtensionAPI::GetFeatureDependency(const std::string& full_name) {
FeatureProviderMap::iterator provider =
dependency_providers_.find(feature_type);
if (provider == dependency_providers_.end())
- return NULL;
+ return nullptr;
Feature* feature = provider->second->GetFeature(feature_name);
// Try getting the feature for the parent API, if this was a child.

Powered by Google App Engine
This is Rietveld 408576698