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

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

Issue 21030009: Make element removal methods in DictionaryValue and ListValue take scoped_ptr's as outparams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/common/extensions/api/extension_api.h" 5 #include "chrome/common/extensions/api/extension_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 void ExtensionAPI::LoadSchema(const std::string& name, 199 void ExtensionAPI::LoadSchema(const std::string& name,
200 const base::StringPiece& schema) { 200 const base::StringPiece& schema) {
201 scoped_ptr<base::ListValue> schema_list(LoadSchemaList(name, schema)); 201 scoped_ptr<base::ListValue> schema_list(LoadSchemaList(name, schema));
202 std::string schema_namespace; 202 std::string schema_namespace;
203 203
204 while (!schema_list->empty()) { 204 while (!schema_list->empty()) {
205 base::DictionaryValue* schema = NULL; 205 base::DictionaryValue* schema = NULL;
206 { 206 {
207 base::Value* value = NULL; 207 scoped_ptr<base::Value> value;
208 schema_list->Remove(schema_list->GetSize() - 1, &value); 208 schema_list->Remove(schema_list->GetSize() - 1, &value);
209 CHECK(value->IsType(base::Value::TYPE_DICTIONARY)); 209 CHECK(value.release()->GetAsDictionary(&schema));
210 schema = static_cast<base::DictionaryValue*>(value);
211 } 210 }
212 211
213 CHECK(schema->GetString("namespace", &schema_namespace)); 212 CHECK(schema->GetString("namespace", &schema_namespace));
214 PrefixWithNamespace(schema_namespace, schema); 213 PrefixWithNamespace(schema_namespace, schema);
215 schemas_[schema_namespace] = make_linked_ptr(schema); 214 schemas_[schema_namespace] = make_linked_ptr(schema);
216 if (!GeneratedSchemas::IsGenerated(schema_namespace)) 215 if (!GeneratedSchemas::IsGenerated(schema_namespace))
217 CHECK_EQ(1u, unloaded_schemas_.erase(schema_namespace)); 216 CHECK_EQ(1u, unloaded_schemas_.erase(schema_namespace));
218 } 217 }
219 } 218 }
220 219
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 break; 414 break;
416 415
417 api_name_candidate = api_name_candidate.substr(0, last_dot_index); 416 api_name_candidate = api_name_candidate.substr(0, last_dot_index);
418 } 417 }
419 418
420 *child_name = ""; 419 *child_name = "";
421 return std::string(); 420 return std::string();
422 } 421 }
423 422
424 } // namespace extensions 423 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/value_store/value_store_frontend.cc ('k') | chrome/test/automation/automation_json_requests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698