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.
5 #ifndef EXTENSIONS_COMMON_FEATURES_COMPLEX_FEATURE_H_
6 #define EXTENSIONS_COMMON_FEATURES_COMPLEX_FEATURE_H_
11 #include "base/memory/scoped_vector.h"
12 #include "extensions/common/extension.h"
13 #include "extensions/common/features/feature.h"
14 #include "extensions/common/manifest.h"
16 namespace extensions {
18 // A ComplexFeature is composed of one or many Features. A ComplexFeature
19 // is available if any Feature (i.e. permission rule) that composes it is
20 // available, but not if only some combination of Features is available.
21 class ComplexFeature : public Feature {
23 typedef ScopedVector<Feature> FeatureList;
25 explicit ComplexFeature(scoped_ptr<FeatureList> features);
26 ~ComplexFeature() override;
28 // extensions::Feature:
29 Availability IsAvailableToManifest(const std::string& extension_id,
31 Manifest::Location location,
33 Platform platform) const override;
35 Availability IsAvailableToContext(const Extension* extension,
38 Platform platform) const override;
40 bool IsIdInBlacklist(const std::string& extension_id) const override;
41 bool IsIdInWhitelist(const std::string& extension_id) const override;
44 // extensions::Feature:
45 std::string GetAvailabilityMessage(AvailabilityResult result,
48 Context context) const override;
50 bool IsInternal() const override;
53 FeatureList features_;
55 DISALLOW_COPY_AND_ASSIGN(ComplexFeature);
58 } // namespace extensions
60 #endif // EXTENSIONS_COMMON_FEATURES_COMPLEX_FEATURE_H_