Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8395)

Unified Diff: chrome/common/extensions/features/complex_feature.h

Issue 11316164: Implement ComplexFeature to support permission features with multiple rules. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renames and add TODO Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e83d1d2f31ad6990ae1c5df3c31d86369c380af0
--- /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 Features. A ComplexFeature
+// is available if any Feature (i.e. permission rule) that composes it is
+// available, but not if only some combination of Features is available.
+class ComplexFeature : public Feature {
+ public:
+ typedef ScopedVector<Feature> FeatureList;
+
+ 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>* GetContexts() OVERRIDE;
+
+ private:
+ FeatureList features_;
+
+ DISALLOW_COPY_AND_ASSIGN(ComplexFeature);
+};
+
+} // namespace extensions
+
+#endif // CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_

Powered by Google App Engine
This is Rietveld 408576698