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

Unified Diff: extensions/common/api/declarative/declarative_manifest_data.cc

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? 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
Index: extensions/common/api/declarative/declarative_manifest_data.cc
diff --git a/extensions/common/api/declarative/declarative_manifest_data.cc b/extensions/common/api/declarative/declarative_manifest_data.cc
index 77460f1a8d5267319c21bb1c0cd9bc2eaacce9a2..97bc5ebca369466171dc955444cddd31c4990215 100644
--- a/extensions/common/api/declarative/declarative_manifest_data.cc
+++ b/extensions/common/api/declarative/declarative_manifest_data.cc
@@ -61,8 +61,8 @@ class ErrorBuilder {
bool ConvertManifestRule(const linked_ptr<DeclarativeManifestData::Rule>& rule,
ErrorBuilder* error_builder) {
auto convert_list =
- [error_builder](std::vector<scoped_ptr<base::Value>>& list) {
- for (const scoped_ptr<base::Value>& value : list) {
+ [error_builder](std::vector<std::unique_ptr<base::Value>>& list) {
+ for (const std::unique_ptr<base::Value>& value : list) {
base::DictionaryValue* dictionary = nullptr;
if (!value->GetAsDictionary(&dictionary)) {
error_builder->Append("expected dictionary, got %s",
@@ -98,7 +98,7 @@ DeclarativeManifestData* DeclarativeManifestData::Get(
}
// static
-scoped_ptr<DeclarativeManifestData> DeclarativeManifestData::FromValue(
+std::unique_ptr<DeclarativeManifestData> DeclarativeManifestData::FromValue(
const base::Value& value,
base::string16* error) {
// The following is an example of how an event programmatic rule definition
@@ -134,12 +134,13 @@ scoped_ptr<DeclarativeManifestData> DeclarativeManifestData::FromValue(
// event it applies to.
//
ErrorBuilder error_builder(error);
- scoped_ptr<DeclarativeManifestData> result(new DeclarativeManifestData());
+ std::unique_ptr<DeclarativeManifestData> result(
+ new DeclarativeManifestData());
const base::ListValue* list = nullptr;
if (!value.GetAsList(&list)) {
error_builder.Append("'event_rules' expected list, got %s",
ValueTypeToString(&value));
- return scoped_ptr<DeclarativeManifestData>();
+ return std::unique_ptr<DeclarativeManifestData>();
}
for (size_t i = 0; i < list->GetSize(); ++i) {
@@ -151,22 +152,22 @@ scoped_ptr<DeclarativeManifestData> DeclarativeManifestData::FromValue(
ValueTypeToString(value));
else
error_builder.Append("expected dictionary");
- return scoped_ptr<DeclarativeManifestData>();
+ return std::unique_ptr<DeclarativeManifestData>();
}
std::string event;
if (!dict->GetString("event", &event)) {
error_builder.Append("'event' is required");
- return scoped_ptr<DeclarativeManifestData>();
+ return std::unique_ptr<DeclarativeManifestData>();
}
linked_ptr<Rule> rule(new Rule());
if (!Rule::Populate(*dict, rule.get())) {
error_builder.Append("rule failed to populate");
- return scoped_ptr<DeclarativeManifestData>();
+ return std::unique_ptr<DeclarativeManifestData>();
}
if (!ConvertManifestRule(rule, &error_builder))
- return scoped_ptr<DeclarativeManifestData>();
+ return std::unique_ptr<DeclarativeManifestData>();
result->event_rules_map_[event].push_back(rule);
}

Powered by Google App Engine
This is Rietveld 408576698