Chromium Code Reviews| 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 SimpleFeatures. A ComplexFeature | |
|
not at google - send to devlin
2012/12/14 19:10:42
s/SimpleFeatures/Features/
justinlin
2012/12/14 21:07:52
Done.
| |
| 19 // is available if any SimpleFeature (i.e. permission rule) that composes it is | |
| 20 // available, but not if only some combination of SimpleFeatures is available. | |
| 21 class ComplexFeature : public Feature { | |
| 22 public: | |
| 23 typedef std::vector<SimpleFeature*> FeatureList; | |
|
not at google - send to devlin
2012/12/14 19:10:42
std::vector<Feature*> (actually, ScopedVector<Simp
justinlin
2012/12/14 21:07:52
The "reason" was that GetAvailabilityMessage was a
| |
| 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>* contexts() OVERRIDE; | |
| 46 | |
| 47 private: | |
| 48 ScopedVector<SimpleFeature> 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 |