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

Unified Diff: chrome/common/extensions/features/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/feature.h
diff --git a/chrome/common/extensions/features/feature.h b/chrome/common/extensions/features/feature.h
index 41711835c9972685793281e50dfef9015090cb26..5b47b9f87d93ba158112d9dec0d25f6967b9c7bd 100644
--- a/chrome/common/extensions/features/feature.h
+++ b/chrome/common/extensions/features/feature.h
@@ -73,7 +73,7 @@ class Feature {
const std::string& message() const { return message_; }
private:
- friend class Feature;
+ friend class SimpleFeature;
// Instances should be created via Feature::CreateAvailability.
Availability(AvailabilityResult result, const std::string& message)
@@ -83,8 +83,6 @@ class Feature {
const std::string message_;
};
- Feature();
- Feature(const Feature& other);
virtual ~Feature();
// Gets the current channel as seen by the Feature system.
@@ -124,33 +122,8 @@ class Feature {
// Gets the Feature::Location value for the specified Extension::Location.
static Location ConvertLocation(Extension::Location extension_location);
- std::set<std::string>* whitelist() { return &whitelist_; }
- std::set<Extension::Type>* extension_types() { return &extension_types_; }
- std::set<Context>* contexts() { return &contexts_; }
-
- Location location() const { return location_; }
- void set_location(Location location) { location_ = location; }
-
- Platform platform() const { return platform_; }
- void set_platform(Platform platform) { platform_ = platform; }
-
- int min_manifest_version() const { return min_manifest_version_; }
- void set_min_manifest_version(int min_manifest_version) {
- min_manifest_version_ = min_manifest_version;
- }
-
- int max_manifest_version() const { return max_manifest_version_; }
- void set_max_manifest_version(int max_manifest_version) {
- max_manifest_version_ = max_manifest_version;
- }
-
- // Parses the JSON representation of a feature into the fields of this object.
- // Unspecified values in the JSON are not modified in the object. This allows
- // us to implement inheritance by parsing one value after another.
- void Parse(const DictionaryValue* value);
-
- // Returns true if the feature contains the same values as another.
- bool Equals(const Feature& other) const;
+ // TODO(justinlin): Remove and move to APIFeature when it exists.
+ virtual std::set<Context>* GetContexts() = 0;
// Returns true if the feature is available to be parsed into a new extension
// manifest.
@@ -161,11 +134,11 @@ class Feature {
return IsAvailableToManifest(extension_id, type, location, manifest_version,
GetCurrentPlatform());
}
- Availability IsAvailableToManifest(const std::string& extension_id,
- Extension::Type type,
- Location location,
- int manifest_version,
- Platform platform) const;
+ virtual Availability IsAvailableToManifest(const std::string& extension_id,
+ Extension::Type type,
+ Location location,
+ int manifest_version,
+ Platform platform) const = 0;
// Returns true if the feature is available to be used in the specified
// extension and context.
@@ -175,31 +148,13 @@ class Feature {
}
virtual Availability IsAvailableToContext(const Extension* extension,
Context context,
- Platform platform) const;
+ Platform platform) const = 0;
- protected:
- Availability CreateAvailability(AvailabilityResult result) const;
- Availability CreateAvailability(AvailabilityResult result,
- Extension::Type type) const;
-
- private:
- std::string GetAvailabilityMessage(
- AvailabilityResult result, Extension::Type type) const;
+ virtual std::string GetAvailabilityMessage(
+ AvailabilityResult result, Extension::Type type) const = 0;
+ protected:
std::string name_;
-
- // For clarify and consistency, we handle the default value of each of these
- // members the same way: it matches everything. It is up to the higher level
- // code that reads Features out of static data to validate that data and set
- // sensible defaults.
- std::set<std::string> whitelist_;
- std::set<Extension::Type> extension_types_;
- std::set<Context> contexts_;
- Location location_; // we only care about component/not-component now
- Platform platform_; // we only care about chromeos/not-chromeos now
- int min_manifest_version_;
- int max_manifest_version_;
- chrome::VersionInfo::Channel channel_;
};
} // namespace extensions
« no previous file with comments | « chrome/common/extensions/features/complex_feature_unittest.cc ('k') | chrome/common/extensions/features/feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698