OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/scoped_vector.h" |
| 11 #include "chrome/common/extensions/extension.h" |
| 12 #include "chrome/common/extensions/features/feature.h" |
| 13 |
| 14 namespace extensions { |
| 15 |
| 16 class SimpleFeature; |
| 17 |
| 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 { |
| 22 public: |
| 23 typedef ScopedVector<Feature> FeatureList; |
| 24 |
| 25 explicit ComplexFeature(scoped_ptr<FeatureList> features); |
| 26 virtual ~ComplexFeature(); |
| 27 |
| 28 // extensions::Feature: |
| 29 virtual Availability IsAvailableToManifest(const std::string& extension_id, |
| 30 Extension::Type type, |
| 31 Location location, |
| 32 int manifest_version, |
| 33 Platform platform) const OVERRIDE; |
| 34 |
| 35 virtual Availability IsAvailableToContext(const Extension* extension, |
| 36 Context context, |
| 37 Platform platform) const OVERRIDE; |
| 38 |
| 39 protected: |
| 40 // extensions::Feature: |
| 41 virtual std::string GetAvailabilityMessage( |
| 42 AvailabilityResult result, |
| 43 Extension::Type type) const OVERRIDE; |
| 44 |
| 45 virtual std::set<Context>* GetContexts() OVERRIDE; |
| 46 |
| 47 private: |
| 48 FeatureList features_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ComplexFeature); |
| 51 }; |
| 52 |
| 53 } // namespace extensions |
| 54 |
| 55 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ |
OLD | NEW |