Chromium Code Reviews| 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..9c8d71e81cc8fa6d90332cdc6bebed9ef855950e |
| --- /dev/null |
| +++ b/chrome/common/extensions/features/complex_feature.h |
| @@ -0,0 +1,49 @@ |
| +// 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 <vector> |
| + |
| +#include "chrome/common/extensions/extension.h" |
| +#include "chrome/common/extensions/features/feature.h" |
| +#include "chrome/common/extensions/features/permission_feature.h" |
| + |
| +namespace extensions { |
| + |
| +// A ComplexFeature is composed of one or many SimpleFeatures. Currently, we |
| +// only support PermissionFeatures. A ComplexFeature is available if any |
|
not at google - send to devlin
2012/12/12 17:42:41
"we only support PermissionFeatures" -> is there a
justinlin
2012/12/14 12:26:26
Done. Removed.
|
| +// SimpleFeature (i.e. a permission rule) that composes it is available, but not |
| +// if only some combination of SimpleFeatures is available. |
| +class ComplexFeature : public Feature { |
| + public: |
| + ComplexFeature(); |
| + virtual ~ComplexFeature(); |
| + |
| + // Adds a SimpleFeature to the list that composes this ComplexFeature. |
|
not at google - send to devlin
2012/12/12 17:42:41
SimpleFeature -> Feature. In any case, is it possi
justinlin
2012/12/14 12:26:26
Done.
|
| + void AddSimpleFeature(const PermissionFeature* feature); |
|
not at google - send to devlin
2012/12/12 17:42:41
PermissionFeature -> Feature, take a scoped_ptr<Fe
justinlin
2012/12/14 12:26:26
Done.
|
| + |
| + // 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; |
| + virtual std::string GetAvailabilityMessage( |
| + AvailabilityResult result, |
| + Extension::Type type) const OVERRIDE; |
| + |
| + private: |
| + typedef std::vector<PermissionFeature> SimpleFeatureList; |
|
not at google - send to devlin
2012/12/12 17:42:41
PermissionFeature -> Feature
justinlin
2012/12/14 12:26:26
Done.
|
| + SimpleFeatureList simple_features_; |
|
not at google - send to devlin
2012/12/12 17:42:41
DISALLOW_COPY_AND_ASSIGN
This might be an interes
justinlin
2012/12/14 12:26:26
Done. Since we pretty much never reference Complex
|
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_H_ |