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_
10 #include "base/memory/scoped_vector.h"
11 #include "extensions/common/extension.h"
12 #include "extensions/common/features/feature.h"
13 #include "extensions/common/manifest.h"
15 namespace extensions
{
17 // A ComplexFeature is composed of one or many Features. A ComplexFeature
18 // is available if any Feature (i.e. permission rule) that composes it is
19 // available, but not if only some combination of Features is available.
20 class ComplexFeature
: public Feature
{
22 typedef ScopedVector
<Feature
> FeatureList
;
24 explicit ComplexFeature(scoped_ptr
<FeatureList
> features
);
25 virtual ~ComplexFeature();
27 // extensions::Feature:
28 virtual Availability
IsAvailableToManifest(const std::string
& extension_id
,
32 Platform platform
) const OVERRIDE
;
34 virtual Availability
IsAvailableToContext(const Extension
* extension
,
37 Platform platform
) const OVERRIDE
;
39 virtual bool IsIdInWhitelist(const std::string
& extension_id
) const OVERRIDE
;
40 virtual bool IsBlockedInServiceWorker() const OVERRIDE
;
43 // extensions::Feature:
44 virtual std::string
GetAvailabilityMessage(
45 AvailabilityResult result
,
48 Context context
) const OVERRIDE
;
50 virtual std::set
<Context
>* GetContexts() OVERRIDE
;
52 virtual bool IsInternal() const OVERRIDE
;
55 FeatureList features_
;
57 DISALLOW_COPY_AND_ASSIGN(ComplexFeature
);
60 } // namespace extensions
62 #endif // EXTENSIONS_COMMON_FEATURES_COMPLEX_FEATURE_H_