| Index: extensions/common/extension_api.cc
|
| diff --git a/extensions/common/extension_api.cc b/extensions/common/extension_api.cc
|
| index 50d4316b6944f9690e745a88585036de20b3c541..f93128a1708695b6ff5727c4d568908bbc364b32 100644
|
| --- a/extensions/common/extension_api.cc
|
| +++ b/extensions/common/extension_api.cc
|
| @@ -27,7 +27,6 @@
|
| #include "extensions/common/features/simple_feature.h"
|
| #include "extensions/common/permissions/permission_set.h"
|
| #include "extensions/common/permissions/permissions_data.h"
|
| -#include "ui/base/resource/resource_bundle.h"
|
| #include "url/gurl.h"
|
|
|
| namespace extensions {
|
| @@ -39,11 +38,6 @@ const char* kChildKinds[] = {
|
| "events"
|
| };
|
|
|
| -base::StringPiece ReadFromResource(int resource_id) {
|
| - return ResourceBundle::GetSharedInstance().GetRawDataResource(
|
| - resource_id);
|
| -}
|
| -
|
| std::unique_ptr<base::ListValue> LoadSchemaList(
|
| const std::string& name,
|
| const base::StringPiece& schema) {
|
| @@ -228,8 +222,6 @@ void ExtensionAPI::LoadSchema(const std::string& name,
|
| CHECK(schema->GetString("namespace", &schema_namespace));
|
| PrefixWithNamespace(schema_namespace, schema.get());
|
| schemas_[schema_namespace] = std::move(schema);
|
| - if (!extensions_client->IsAPISchemaGenerated(schema_namespace))
|
| - CHECK_EQ(1u, unloaded_schemas_.erase(schema_namespace));
|
| }
|
| }
|
|
|
| @@ -244,15 +236,9 @@ void ExtensionAPI::InitDefaultConfiguration() {
|
| for (size_t i = 0; i < arraysize(names); ++i)
|
| RegisterDependencyProvider(names[i], FeatureProvider::GetByName(names[i]));
|
|
|
| - ExtensionsClient::Get()->RegisterAPISchemaResources(this);
|
| default_configuration_initialized_ = true;
|
| }
|
|
|
| -void ExtensionAPI::RegisterSchemaResource(const std::string& name,
|
| - int resource_id) {
|
| - unloaded_schemas_[name] = resource_id;
|
| -}
|
| -
|
| void ExtensionAPI::RegisterDependencyProvider(const std::string& name,
|
| const FeatureProvider* provider) {
|
| dependency_providers_[name] = provider;
|
| @@ -308,19 +294,14 @@ 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 =
|
| - 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_ &&
|
| - extensions_client->IsAPISchemaGenerated(api_name)) {
|
| + if (default_configuration_initialized_ &&
|
| + extensions_client->IsAPISchemaGenerated(api_name)) {
|
| LoadSchema(api_name, extensions_client->GetAPISchema(api_name));
|
| } else {
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| maybe_schema = schemas_.find(api_name);
|
| @@ -354,6 +335,10 @@ Feature* ExtensionAPI::GetFeatureDependency(const std::string& full_name) {
|
| return feature;
|
| }
|
|
|
| +void ExtensionAPI::RegisterFakeSchemaForTesting(const std::string& name) {
|
| + fake_schemas_.insert(name);
|
| +}
|
| +
|
| std::string ExtensionAPI::GetAPINameFromFullName(const std::string& full_name,
|
| std::string* child_name) {
|
| std::string api_name_candidate = full_name;
|
| @@ -363,7 +348,7 @@ std::string ExtensionAPI::GetAPINameFromFullName(const std::string& full_name,
|
| while (true) {
|
| if (schemas_.find(api_name_candidate) != schemas_.end() ||
|
| extensions_client->IsAPISchemaGenerated(api_name_candidate) ||
|
| - unloaded_schemas_.find(api_name_candidate) != unloaded_schemas_.end()) {
|
| + fake_schemas_.find(api_name_candidate) != fake_schemas_.end()) {
|
| std::string result = api_name_candidate;
|
|
|
| if (child_name) {
|
|
|