Chromium Code Reviews| Index: chrome/common/extensions/features/base_feature_provider.cc |
| diff --git a/chrome/common/extensions/features/base_feature_provider.cc b/chrome/common/extensions/features/base_feature_provider.cc |
| index 44cc4544a9388b45f275856a9c533fba8820bc06..df102759b0c91dba335914ee6e30c5976193b862 100644 |
| --- a/chrome/common/extensions/features/base_feature_provider.cc |
| +++ b/chrome/common/extensions/features/base_feature_provider.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/json/json_reader.h" |
| #include "base/lazy_instance.h" |
| +#include "chrome/common/extensions/features/api_feature.h" |
| #include "chrome/common/extensions/features/complex_feature.h" |
| #include "chrome/common/extensions/features/manifest_feature.h" |
| #include "chrome/common/extensions/features/permission_feature.h" |
| @@ -23,7 +24,11 @@ SimpleFeature* CreateFeature() { |
| struct Static { |
| Static() |
| - : manifest_features( |
| + : api_features( |
| + LoadProvider("api", |
| + &CreateFeature<APIFeature>, |
| + IDR_EXTENSION_API_FEATURES)), |
| + manifest_features( |
| LoadProvider("manifest", |
| &CreateFeature<ManifestFeature>, |
| IDR_EXTENSION_MANIFEST_FEATURES)), |
| @@ -33,6 +38,7 @@ struct Static { |
| IDR_EXTENSION_PERMISSION_FEATURES)) { |
| } |
| + scoped_ptr<BaseFeatureProvider> api_features; |
| scoped_ptr<BaseFeatureProvider> manifest_features; |
| scoped_ptr<BaseFeatureProvider> permission_features; |
| @@ -67,20 +73,7 @@ bool ParseFeature(const DictionaryValue* value, |
| const std::string& name, |
| SimpleFeature* feature) { |
| feature->set_name(name); |
| - feature->Parse(value); |
| - |
| - if (feature->extension_types()->empty()) { |
| - LOG(ERROR) << name << ": Simple features must specify at least one " |
| - << "value for extension_types."; |
| - return false; |
| - } |
| - |
| - if (!feature->GetContexts()->empty()) { |
| - LOG(ERROR) << name << ": Simple features do not support contexts."; |
| - return false; |
| - } |
| - |
| - return true; |
| + return feature->Parse(value); |
|
not at google - send to devlin
2013/03/26 00:34:48
yeah, this could be
std::string error = feature->
cduvall
2013/03/26 19:24:05
Done.
|
| } |
| base::LazyInstance<Static> g_static = LAZY_INSTANCE_INITIALIZER; |
| @@ -141,6 +134,11 @@ BaseFeatureProvider::~BaseFeatureProvider() { |
| } |
| // static |
| +BaseFeatureProvider* BaseFeatureProvider::GetApiFeatures() { |
| + return g_static.Get().api_features.get(); |
| +} |
| + |
| +// static |
| BaseFeatureProvider* BaseFeatureProvider::GetManifestFeatures() { |
| return g_static.Get().manifest_features.get(); |
| } |