This source file includes following definitions.
- IsAvailableToContext
- Parse
#include "extensions/common/features/manifest_feature.h"
#include "extensions/common/manifest.h"
namespace extensions {
ManifestFeature::ManifestFeature() {
}
ManifestFeature::~ManifestFeature() {
}
Feature::Availability ManifestFeature::IsAvailableToContext(
const Extension* extension,
Feature::Context context,
const GURL& url,
Feature::Platform platform) const {
Availability availability = SimpleFeature::IsAvailableToContext(extension,
context,
url,
platform);
if (!availability.is_available())
return availability;
if (extension && !extension->manifest()->value()->HasKey(name()))
return CreateAvailability(NOT_PRESENT, extension->GetType());
return CreateAvailability(IS_AVAILABLE);
}
std::string ManifestFeature::Parse(const base::DictionaryValue* value) {
std::string error = SimpleFeature::Parse(value);
if (!error.empty())
return error;
if (extension_types()->empty()) {
return name() + ": Manifest features must specify at least one " +
"value for extension_types.";
}
if (!GetContexts()->empty())
return name() + ": Manifest features do not support contexts.";
return std::string();
}
}