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

Unified Diff: chrome/common/extensions/api/extension_api.cc

Issue 9774001: Remove dependence on .json files for IDL-specified extensions/apps APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: resolved conflicts with head Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/extension_api.cc
diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc
index 511f134f8e3b460b56f7daa6889f9f5f803762b6..b4f17ca6a66e35bbbaef86bcaec2f9e0fce7d430 100644
--- a/chrome/common/extensions/api/extension_api.cc
+++ b/chrome/common/extensions/api/extension_api.cc
@@ -13,6 +13,7 @@
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/values.h"
+#include "chrome/common/extensions/api/generated_schemas.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_permission_set.h"
#include "grit/common_resources.h"
@@ -81,11 +82,16 @@ static base::ListValue* LoadSchemaList(int resource_id) {
}
void ExtensionAPI::LoadSchemaFromResource(int resource_id) {
- scoped_ptr<base::ListValue> loaded(LoadSchemaList(resource_id));
+ RegisterSchema(LoadSchemaList(resource_id));
+}
+
+void ExtensionAPI::RegisterSchema(base::ListValue* loaded_schema) {
+ // We take ownership of loaded_schema, so we need to delete it.
+ scoped_ptr<base::ListValue> scoped_loaded_schema(loaded_schema);
Value* value = NULL;
std::string schema_namespace;
- while (!loaded->empty()) {
- loaded->Remove(loaded->GetSize() - 1, &value);
+ while (!loaded_schema->empty()) {
+ loaded_schema->Remove(loaded_schema->GetSize() - 1, &value);
CHECK(value->IsType(Value::TYPE_DICTIONARY));
const DictionaryValue* schema = static_cast<const DictionaryValue*>(value);
CHECK(schema->GetString("namespace", &schema_namespace));
@@ -110,7 +116,6 @@ ExtensionAPI::ExtensionAPI() {
IDR_EXTENSION_API_JSON_EXPERIMENTAL_APP,
IDR_EXTENSION_API_JSON_EXPERIMENTAL_BOOKMARKMANAGER,
IDR_EXTENSION_API_JSON_EXPERIMENTAL_DECLARATIVE,
- IDR_EXTENSION_API_JSON_EXPERIMENTAL_DNS,
IDR_EXTENSION_API_JSON_EXPERIMENTAL_DOWNLOADS,
IDR_EXTENSION_API_JSON_EXPERIMENTAL_EXTENSIONS,
IDR_EXTENSION_API_JSON_EXPERIMENTAL_FONTS,
@@ -163,6 +168,7 @@ ExtensionAPI::ExtensionAPI() {
for (size_t i = 0; i < arraysize(kJsonApiResourceIds); i++) {
LoadSchemaFromResource(kJsonApiResourceIds[i]);
}
+ RegisterSchema(api::GeneratedSchemas::Get());
// Populate {completely,partially}_unprivileged_apis_.
for (SchemaMap::iterator it = schemas_.begin(); it != schemas_.end(); ++it) {
« no previous file with comments | « chrome/common/extensions/api/extension_api.h ('k') | chrome/common/extensions/docs/js/api_page_generator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698