| 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 base::StringPiece ReadFromResource(int resource_id) { | 64 base::StringPiece ReadFromResource(int resource_id) { |
| 65 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 65 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 66 resource_id, ui::SCALE_FACTOR_NONE); | 66 resource_id, ui::SCALE_FACTOR_NONE); |
| 67 } | 67 } |
| 68 | 68 |
| 69 scoped_ptr<ListValue> LoadSchemaList(const std::string& name, | 69 scoped_ptr<ListValue> LoadSchemaList(const std::string& name, |
| 70 const base::StringPiece& schema) { | 70 const base::StringPiece& schema) { |
| 71 std::string error_message; | 71 std::string error_message; |
| 72 scoped_ptr<Value> result( | 72 scoped_ptr<Value> result( |
| 73 base::JSONReader::ReadAndReturnError( | 73 base::JSONReader::ReadAndReturnError( |
| 74 schema.as_string(), | 74 schema, |
| 75 base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options | 75 base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options |
| 76 NULL, // error code | 76 NULL, // error code |
| 77 &error_message)); | 77 &error_message)); |
| 78 | 78 |
| 79 // Tracking down http://crbug.com/121424 | 79 // Tracking down http://crbug.com/121424 |
| 80 char buf[128]; | 80 char buf[128]; |
| 81 base::snprintf(buf, arraysize(buf), "%s: (%d) '%s'", | 81 base::snprintf(buf, arraysize(buf), "%s: (%d) '%s'", |
| 82 name.c_str(), | 82 name.c_str(), |
| 83 result.get() ? result->GetType() : -1, | 83 result.get() ? result->GetType() : -1, |
| 84 error_message.c_str()); | 84 error_message.c_str()); |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 | 799 |
| 800 void ExtensionAPI::LoadAllSchemas() { | 800 void ExtensionAPI::LoadAllSchemas() { |
| 801 while (unloaded_schemas_.size()) { | 801 while (unloaded_schemas_.size()) { |
| 802 std::map<std::string, base::StringPiece>::iterator it = | 802 std::map<std::string, base::StringPiece>::iterator it = |
| 803 unloaded_schemas_.begin(); | 803 unloaded_schemas_.begin(); |
| 804 LoadSchema(it->first, it->second); | 804 LoadSchema(it->first, it->second); |
| 805 } | 805 } |
| 806 } | 806 } |
| 807 | 807 |
| 808 } // namespace extensions | 808 } // namespace extensions |
| OLD | NEW |