Index: chrome/common/extensions/features/complex_feature.h |
diff --git a/chrome/common/extensions/features/complex_feature.h b/chrome/common/extensions/features/complex_feature.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f2cfbf57d7bd8263893df1c89d2488b516c824a6 |
--- /dev/null |
+++ b/chrome/common/extensions/features/complex_feature.h |
@@ -0,0 +1,55 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ |
+#define CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/scoped_vector.h" |
+#include "chrome/common/extensions/extension.h" |
+#include "chrome/common/extensions/features/feature.h" |
+ |
+namespace extensions { |
+ |
+class SimpleFeature; |
+ |
+// 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.
|
+// is available if any SimpleFeature (i.e. permission rule) that composes it is |
+// available, but not if only some combination of SimpleFeatures is available. |
+class ComplexFeature : public Feature { |
+ public: |
+ 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
|
+ |
+ explicit ComplexFeature(scoped_ptr<FeatureList> features); |
+ virtual ~ComplexFeature(); |
+ |
+ // extensions::Feature: |
+ virtual Availability IsAvailableToManifest(const std::string& extension_id, |
+ Extension::Type type, |
+ Location location, |
+ int manifest_version, |
+ Platform platform) const OVERRIDE; |
+ |
+ virtual Availability IsAvailableToContext(const Extension* extension, |
+ Context context, |
+ Platform platform) const OVERRIDE; |
+ |
+ protected: |
+ // extensions::Feature: |
+ virtual std::string GetAvailabilityMessage( |
+ AvailabilityResult result, |
+ Extension::Type type) const OVERRIDE; |
+ |
+ virtual std::set<Context>* contexts() OVERRIDE; |
+ |
+ private: |
+ ScopedVector<SimpleFeature> features_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ComplexFeature); |
+}; |
+ |
+} // namespace extensions |
+ |
+#endif // CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ |