| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ | 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 11 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
| 12 #include "chrome/common/extensions/features/feature.h" | 12 #include "chrome/common/extensions/features/feature.h" |
| 13 #include "chrome/common/extensions/manifest.h" |
| 13 | 14 |
| 14 namespace extensions { | 15 namespace extensions { |
| 15 | 16 |
| 16 class SimpleFeature; | 17 class SimpleFeature; |
| 17 | 18 |
| 18 // A ComplexFeature is composed of one or many Features. A ComplexFeature | 19 // 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 // 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 // available, but not if only some combination of Features is available. |
| 21 class ComplexFeature : public Feature { | 22 class ComplexFeature : public Feature { |
| 22 public: | 23 public: |
| 23 typedef ScopedVector<Feature> FeatureList; | 24 typedef ScopedVector<Feature> FeatureList; |
| 24 | 25 |
| 25 explicit ComplexFeature(scoped_ptr<FeatureList> features); | 26 explicit ComplexFeature(scoped_ptr<FeatureList> features); |
| 26 virtual ~ComplexFeature(); | 27 virtual ~ComplexFeature(); |
| 27 | 28 |
| 28 // extensions::Feature: | 29 // extensions::Feature: |
| 29 virtual Availability IsAvailableToManifest(const std::string& extension_id, | 30 virtual Availability IsAvailableToManifest(const std::string& extension_id, |
| 30 Extension::Type type, | 31 Manifest::Type type, |
| 31 Location location, | 32 Location location, |
| 32 int manifest_version, | 33 int manifest_version, |
| 33 Platform platform) const OVERRIDE; | 34 Platform platform) const OVERRIDE; |
| 34 | 35 |
| 35 virtual Availability IsAvailableToContext(const Extension* extension, | 36 virtual Availability IsAvailableToContext(const Extension* extension, |
| 36 Context context, | 37 Context context, |
| 37 Platform platform) const OVERRIDE; | 38 Platform platform) const OVERRIDE; |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 // extensions::Feature: | 41 // extensions::Feature: |
| 41 virtual std::string GetAvailabilityMessage( | 42 virtual std::string GetAvailabilityMessage( |
| 42 AvailabilityResult result, | 43 AvailabilityResult result, |
| 43 Extension::Type type) const OVERRIDE; | 44 Manifest::Type type) const OVERRIDE; |
| 44 | 45 |
| 45 virtual std::set<Context>* GetContexts() OVERRIDE; | 46 virtual std::set<Context>* GetContexts() OVERRIDE; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 FeatureList features_; | 49 FeatureList features_; |
| 49 | 50 |
| 50 DISALLOW_COPY_AND_ASSIGN(ComplexFeature); | 51 DISALLOW_COPY_AND_ASSIGN(ComplexFeature); |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 } // namespace extensions | 54 } // namespace extensions |
| 54 | 55 |
| 55 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ | 56 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ |
| OLD | NEW |