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

Side by Side Diff: extensions/common/extension_api.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 7 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 "extensions/common/extension_api.h" 5 #include "extensions/common/extension_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 schema->SetString(key, schema_namespace + "." + old_id); 125 schema->SetString(key, schema_namespace + "." + old_id);
126 } 126 }
127 127
128 // Modify all "$ref" keys anywhere in |schema| to be prefxied by 128 // Modify all "$ref" keys anywhere in |schema| to be prefxied by
129 // |schema_namespace| if they do not already specify a namespace. 129 // |schema_namespace| if they do not already specify a namespace.
130 void PrefixRefsWithNamespace(const std::string& schema_namespace, 130 void PrefixRefsWithNamespace(const std::string& schema_namespace,
131 base::Value* value) { 131 base::Value* value) {
132 base::ListValue* list = NULL; 132 base::ListValue* list = NULL;
133 base::DictionaryValue* dict = NULL; 133 base::DictionaryValue* dict = NULL;
134 if (value->GetAsList(&list)) { 134 if (value->GetAsList(&list)) {
135 for (base::ListValue::iterator i = list->begin(); i != list->end(); ++i) { 135 for (const auto& i : *list) {
136 PrefixRefsWithNamespace(schema_namespace, *i); 136 PrefixRefsWithNamespace(schema_namespace, i.get());
137 } 137 }
138 } else if (value->GetAsDictionary(&dict)) { 138 } else if (value->GetAsDictionary(&dict)) {
139 MaybePrefixFieldWithNamespace(schema_namespace, dict, "$ref"); 139 MaybePrefixFieldWithNamespace(schema_namespace, dict, "$ref");
140 for (base::DictionaryValue::Iterator i(*dict); !i.IsAtEnd(); i.Advance()) { 140 for (base::DictionaryValue::Iterator i(*dict); !i.IsAtEnd(); i.Advance()) {
141 base::Value* value = NULL; 141 base::Value* value = NULL;
142 CHECK(dict->GetWithoutPathExpansion(i.key(), &value)); 142 CHECK(dict->GetWithoutPathExpansion(i.key(), &value));
143 PrefixRefsWithNamespace(schema_namespace, value); 143 PrefixRefsWithNamespace(schema_namespace, value);
144 } 144 }
145 } 145 }
146 } 146 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 break; 388 break;
389 389
390 api_name_candidate = api_name_candidate.substr(0, last_dot_index); 390 api_name_candidate = api_name_candidate.substr(0, last_dot_index);
391 } 391 }
392 392
393 *child_name = ""; 393 *child_name = "";
394 return std::string(); 394 return std::string();
395 } 395 }
396 396
397 } // namespace extensions 397 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/verified_contents.cc ('k') | extensions/common/features/base_feature_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698