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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 scoped_ptr<ListValue> LoadSchemaList(const base::StringPiece& schema) { | 57 scoped_ptr<ListValue> LoadSchemaList(const base::StringPiece& schema) { |
58 std::string error_message; | 58 std::string error_message; |
59 scoped_ptr<Value> result( | 59 scoped_ptr<Value> result( |
60 base::JSONReader::ReadAndReturnError( | 60 base::JSONReader::ReadAndReturnError( |
61 schema.as_string(), | 61 schema.as_string(), |
62 false, // allow trailing commas | 62 false, // allow trailing commas |
63 NULL, // error code | 63 NULL, // error code |
64 &error_message)); | 64 &error_message)); |
65 CHECK(result.get()) << error_message; | 65 CHECK(result.get()) << error_message << " for schema " << schema; |
66 CHECK(result->IsType(Value::TYPE_LIST)); | 66 CHECK(result->IsType(Value::TYPE_LIST)) << " for schema " << schema; |
67 return scoped_ptr<ListValue>(static_cast<ListValue*>(result.release())); | 67 return scoped_ptr<ListValue>(static_cast<ListValue*>(result.release())); |
68 } | 68 } |
69 | 69 |
70 } // namespace | 70 } // namespace |
71 | 71 |
72 // static | 72 // static |
73 ExtensionAPI* ExtensionAPI::GetInstance() { | 73 ExtensionAPI* ExtensionAPI::GetInstance() { |
74 return Singleton<ExtensionAPI>::get(); | 74 return Singleton<ExtensionAPI>::get(); |
75 } | 75 } |
76 | 76 |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 459 } |
460 } | 460 } |
461 | 461 |
462 void ExtensionAPI::LoadAllSchemas() { | 462 void ExtensionAPI::LoadAllSchemas() { |
463 while (unloaded_schemas_.size()) { | 463 while (unloaded_schemas_.size()) { |
464 LoadSchema(unloaded_schemas_.begin()->second); | 464 LoadSchema(unloaded_schemas_.begin()->second); |
465 } | 465 } |
466 } | 466 } |
467 | 467 |
468 } // namespace extensions | 468 } // namespace extensions |
OLD | NEW |