1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "extensions/common/features/manifest_feature.h"
6
7 #include "extensions/common/manifest.h"
8
9 namespace extensions {
10
ManifestFeature()11 ManifestFeature::ManifestFeature() {
12 }
13
~ManifestFeature()14 ManifestFeature::~ManifestFeature() {
15 }
16
IsAvailableToContext(const Extension * extension,Feature::Context context,const GURL & url,Feature::Platform platform) const17 Feature::Availability ManifestFeature::IsAvailableToContext(
18 const Extension* extension,
19 Feature::Context context,
20 const GURL& url,
21 Feature::Platform platform) const {
22 Availability availability = SimpleFeature::IsAvailableToContext(extension,
23 context,
24 url,
25 platform);
26 if (!availability.is_available())
27 return availability;
28
29 // We know we can skip manifest()->GetKey() here because we just did the same
30 // validation it would do above.
31 if (extension && !extension->manifest()->value()->HasKey(name()))
32 return CreateAvailability(NOT_PRESENT, extension->GetType());
33
34 return CreateAvailability(IS_AVAILABLE);
35 }
36
37 } // namespace extensions
38