OLD | NEW |
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 scoped_ptr<ListValue> LoadSchemaList(const base::StringPiece& schema) { | 66 scoped_ptr<ListValue> LoadSchemaList(const base::StringPiece& schema) { |
67 std::string error_message; | 67 std::string error_message; |
68 scoped_ptr<Value> result( | 68 scoped_ptr<Value> result( |
69 base::JSONReader::ReadAndReturnError( | 69 base::JSONReader::ReadAndReturnError( |
70 schema.as_string(), | 70 schema.as_string(), |
71 false, // allow trailing commas | 71 false, // allow trailing commas |
72 NULL, // error code | 72 NULL, // error code |
73 &error_message)); | 73 &error_message)); |
74 CHECK(result.get()) << error_message; | 74 CHECK(result.get()) << error_message << " for schema " << schema; |
75 CHECK(result->IsType(Value::TYPE_LIST)); | 75 CHECK(result->IsType(Value::TYPE_LIST)) << " for schema " << schema; |
76 return scoped_ptr<ListValue>(static_cast<ListValue*>(result.release())); | 76 return scoped_ptr<ListValue>(static_cast<ListValue*>(result.release())); |
77 } | 77 } |
78 | 78 |
79 DictionaryValue* FindListItem(const ListValue* list, | 79 DictionaryValue* FindListItem(const ListValue* list, |
80 const std::string& property_name, | 80 const std::string& property_name, |
81 const std::string& property_value) { | 81 const std::string& property_value) { |
82 for (size_t i = 0; i < list->GetSize(); ++i) { | 82 for (size_t i = 0; i < list->GetSize(); ++i) { |
83 DictionaryValue* item = NULL; | 83 DictionaryValue* item = NULL; |
84 CHECK(list->GetDictionary(i, &item)) | 84 CHECK(list->GetDictionary(i, &item)) |
85 << property_value << "/" << property_name; | 85 << property_value << "/" << property_name; |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 719 } |
720 } | 720 } |
721 | 721 |
722 void ExtensionAPI::LoadAllSchemas() { | 722 void ExtensionAPI::LoadAllSchemas() { |
723 while (unloaded_schemas_.size()) { | 723 while (unloaded_schemas_.size()) { |
724 LoadSchema(unloaded_schemas_.begin()->second); | 724 LoadSchema(unloaded_schemas_.begin()->second); |
725 } | 725 } |
726 } | 726 } |
727 | 727 |
728 } // namespace extensions | 728 } // namespace extensions |
OLD | NEW |