diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/chrome_common.gypi | 3 | ||||
-rw-r--r-- | chrome/common/common_resources.grd | 1 | ||||
-rw-r--r-- | chrome/common/extensions/api/experimental.dns.json | 46 | ||||
-rw-r--r-- | chrome/common/extensions/api/extension_api.cc | 14 | ||||
-rw-r--r-- | chrome/common/extensions/api/extension_api.h | 4 | ||||
-rw-r--r-- | chrome/common/extensions/docs/js/api_page_generator.js | 1 |
6 files changed, 14 insertions, 55 deletions
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 5e9ac64..69f558e 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -258,9 +258,6 @@ 'common/zip_internal.h', 'common/zip_reader.cc', 'common/zip_reader.h', - - # Generated by the api.gyp:api target - '<(SHARED_INTERMEDIATE_DIR)/chrome/common/extensions/api/generated_api.h' ], 'conditions': [ ['OS=="android"', { diff --git a/chrome/common/common_resources.grd b/chrome/common/common_resources.grd index e898d36..fb47109 100644 --- a/chrome/common/common_resources.grd +++ b/chrome/common/common_resources.grd @@ -28,7 +28,6 @@ <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_APP" file="extensions\api\experimental.app.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_BOOKMARKMANAGER" file="extensions\api\experimental.bookmarkManager.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_DECLARATIVE" file="extensions\api\experimental.declarative.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_DNS" file="extensions\api\experimental.dns.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_DOWNLOADS" file="extensions\api\experimental.downloads.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_EXTENSIONS" file="extensions\api\experimental.extension.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_FONTS" file="extensions\api\experimental.fontSettings.json" type="BINDATA" /> diff --git a/chrome/common/extensions/api/experimental.dns.json b/chrome/common/extensions/api/experimental.dns.json deleted file mode 100644 index 2e99d68..0000000 --- a/chrome/common/extensions/api/experimental.dns.json +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -[ - { - "namespace": "experimental.dns", - "nodoc": true, - "functions": [ - { - "name": "resolve", - "type": "function", - "description": "Resolves the given hostname or IP address literal.", - "parameters": [ - { - "name": "hostname", - "type": "string", - "description": "The hostname to resolve." - }, - { - "name": "callback", - "type": "function", - "description": "Called when the resolution operation completes.", - "parameters": [ - { - "type": "object", - "name": "resolveInfo", - "properties": { - "resultCode": { - "type": "integer", - "description": "The result code. Zero indicates success." - }, - "address": { - "type": "string", - "description": "A string representing the IP address literal. Supplied only if resultCode indicates success. Note that we presently return only IPv4 addresses.", - "optional": true - } - } - } - ] - } - ] - } - ] - } -] diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc index a36989d..6350d04 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 "googleurl/src/gurl.h" @@ -66,11 +67,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)); @@ -96,7 +102,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, @@ -148,6 +153,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) { diff --git a/chrome/common/extensions/api/extension_api.h b/chrome/common/extensions/api/extension_api.h index 6e2c604..4907152 100644 --- a/chrome/common/extensions/api/extension_api.h +++ b/chrome/common/extensions/api/extension_api.h @@ -63,6 +63,10 @@ class ExtensionAPI { // Loads a schema from a resource. void LoadSchemaFromResource(int resource_id); + // Given a schema in ListValue form, registers it in a map. Takes ownership + // of |loaded_schema|. + void RegisterSchema(base::ListValue* loaded_schema); + // Find an item in |list| with the specified property name and value, or NULL // if no such item exists. base::DictionaryValue* FindListItem(const base::ListValue* list, diff --git a/chrome/common/extensions/docs/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js index 9d06222..6325535 100644 --- a/chrome/common/extensions/docs/js/api_page_generator.js +++ b/chrome/common/extensions/docs/js/api_page_generator.js @@ -34,7 +34,6 @@ var MODULE_SCHEMAS = [ '../api/experimental.accessibility.json', '../api/experimental.app.json', '../api/experimental.bookmarkManager.json', - '../api/experimental.dns.json', '../api/experimental.downloads.json', '../api/experimental.extension.json', '../api/experimental.fontSettings.json', |