summaryrefslogtreecommitdiffstats
path: root/extensions/common/extension_api.cc
diff options
context:
space:
mode:
authorrockot@chromium.org <rockot@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-12 06:41:29 +0000
committerrockot@chromium.org <rockot@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-12 06:41:29 +0000
commit68cb5657f36c7fcc75074146bedc77ae60e13b24 (patch)
treebe4466255116a981d0ad60a43f047fcd277f2d00 /extensions/common/extension_api.cc
parent21bbb2cea53c40cd2a463756e969a0ce1651fe92 (diff)
downloadchromium_src-68cb5657f36c7fcc75074146bedc77ae60e13b24.zip
chromium_src-68cb5657f36c7fcc75074146bedc77ae60e13b24.tar.gz
chromium_src-68cb5657f36c7fcc75074146bedc77ae60e13b24.tar.bz2
Move sockets APIs out of src/chrome
This moves sockets APIs out of src/chrome and into src/extensions. The IDLs and function implementations are moved, and the groundwork is set for moving additional APIs. The API tests remain in src/chrome, and several references to src/chrome still remain for permissions/features/manifest stuff. BUG=349787 TBR=erg@chromium.org for profiles change TBR=jar@chromium.org for +net to //extensions/browser/DEPS Review URL: https://codereview.chromium.org/183893041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256456 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/common/extension_api.cc')
-rw-r--r--extensions/common/extension_api.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/extensions/common/extension_api.cc b/extensions/common/extension_api.cc
index 8e27f2b..b418734 100644
--- a/extensions/common/extension_api.cc
+++ b/extensions/common/extension_api.cc
@@ -16,8 +16,8 @@
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/values.h"
-#include "chrome/common/extensions/api/generated_schemas.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extensions_client.h"
#include "extensions/common/features/feature.h"
#include "extensions/common/features/feature_provider.h"
#include "extensions/common/permissions/permission_set.h"
@@ -29,8 +29,6 @@
namespace extensions {
-using api::GeneratedSchemas;
-
namespace {
const char* kChildKinds[] = {
@@ -200,7 +198,9 @@ void ExtensionAPI::LoadSchema(const std::string& name,
const base::StringPiece& schema) {
scoped_ptr<base::ListValue> schema_list(LoadSchemaList(name, schema));
std::string schema_namespace;
-
+ extensions::ExtensionsClient* extensions_client =
+ extensions::ExtensionsClient::Get();
+ DCHECK(extensions_client);
while (!schema_list->empty()) {
base::DictionaryValue* schema = NULL;
{
@@ -212,7 +212,7 @@ void ExtensionAPI::LoadSchema(const std::string& name,
CHECK(schema->GetString("namespace", &schema_namespace));
PrefixWithNamespace(schema_namespace, schema);
schemas_[schema_namespace] = make_linked_ptr(schema);
- if (!GeneratedSchemas::IsGenerated(schema_namespace))
+ if (!extensions_client->IsAPISchemaGenerated(schema_namespace))
CHECK_EQ(1u, unloaded_schemas_.erase(schema_namespace));
}
}
@@ -344,14 +344,17 @@ const base::DictionaryValue* ExtensionAPI::GetSchema(
result = maybe_schema->second.get();
} else {
// Might not have loaded yet; or might just not exist.
- UnloadedSchemaMap::iterator maybe_schema_resource =
+ UnloadedSchemaMap::iterator maybe_schema_resource =
unloaded_schemas_.find(api_name);
+ extensions::ExtensionsClient* extensions_client =
+ extensions::ExtensionsClient::Get();
+ DCHECK(extensions_client);
if (maybe_schema_resource != unloaded_schemas_.end()) {
LoadSchema(maybe_schema_resource->first,
ReadFromResource(maybe_schema_resource->second));
} else if (default_configuration_initialized_ &&
- GeneratedSchemas::IsGenerated(api_name)) {
- LoadSchema(api_name, GeneratedSchemas::Get(api_name));
+ extensions_client->IsAPISchemaGenerated(api_name)) {
+ LoadSchema(api_name, extensions_client->GetAPISchema(api_name));
} else {
return NULL;
}
@@ -390,9 +393,12 @@ Feature* ExtensionAPI::GetFeatureDependency(const std::string& full_name) {
std::string ExtensionAPI::GetAPINameFromFullName(const std::string& full_name,
std::string* child_name) {
std::string api_name_candidate = full_name;
+ extensions::ExtensionsClient* extensions_client =
+ extensions::ExtensionsClient::Get();
+ DCHECK(extensions_client);
while (true) {
if (schemas_.find(api_name_candidate) != schemas_.end() ||
- GeneratedSchemas::IsGenerated(api_name_candidate) ||
+ extensions_client->IsAPISchemaGenerated(api_name_candidate) ||
unloaded_schemas_.find(api_name_candidate) != unloaded_schemas_.end()) {
std::string result = api_name_candidate;